Revision 47470

View differences:

trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/symbol/fill/impl/SimpleFillSymbol.java
27 27
import java.awt.Graphics2D;
28 28
import java.awt.Rectangle;
29 29
import java.awt.geom.AffineTransform;
30

  
31 30
import org.gvsig.compat.print.PrintAttributes;
32 31
import org.gvsig.fmap.dal.feature.Feature;
33 32
import org.gvsig.fmap.geom.Geometry;
......
77 76

  
78 77
    private SimpleFillSymbol symbolForSelection;
79 78
    private SimpleMarkerSymbol tempSymbol = new SimpleMarkerSymbol();
80
    private transient double transparency;
81 79

  
82 80
    public SimpleFillSymbol() {
83 81
        super();
84
        this.transparency = 1.0;
85 82
    }
86 83

  
87 84
    @Override
......
96 93
            symbolForSelection.setColor(MapContext.getSelectionColor());
97 94
        }
98 95
        if (symbolForSelection instanceof TransparencySupport) {
99
            symbolForSelection.setTransparency(this.transparency);
96
            symbolForSelection.setTransparency(this.getTransparency());
100 97
        }
101 98

  
102 99
        return symbolForSelection;
......
106 103
            Geometry geom, Feature feature, Cancellable cancel) {
107 104
        Color c = getFillColor();
108 105

  
109
        c = new Color(c.getRed(), c.getGreen(), c.getBlue(), (int) (this.transparency * c.getAlpha()));
110

  
111 106
        if (true) {
112 107
            // Esto deberia ser para optimiza el pintado de 
113 108
            // geometrias grandes.
......
125 120
                    }
126 121
                    if (getOutline() != null && hasOutline()) {
127 122
                        g.setColor(getOutline().getColor());
128
                        if (getOutline().getColor() != null) {
129

  
130
                        }
123
//                        if (getOutline().getColor() != null) {
124
//
125
//                        }
131 126
                        g.drawLine(x, y, x, y);
132 127
                    }
133 128
                    return;
......
148 143
        }
149 144
    }
150 145

  
146
    @Override
151 147
    public int getSymbolType() {
152 148
        return Geometry.TYPES.SURFACE;
153 149
    }
154 150

  
151
    @Override
155 152
    public void drawInsideRectangle(Graphics2D g,
156 153
            AffineTransform scaleInstance, Rectangle r, PrintAttributes properties) throws SymbolDrawingException {
157 154
        Rectangle rect = new Rectangle(r.x, r.y, r.width, r.height);
......
183 180
        return getClass().getName();
184 181
    }
185 182

  
183
    @Override
186 184
    public void print(Graphics2D g, AffineTransform at, Geometry geom, PrintAttributes properties) {
187 185
        Color c = getFillColor();
188 186
        if (c != null && hasFill()) {
......
194 192
        }
195 193
    }
196 194

  
195
    @Override
197 196
    public Object clone() throws CloneNotSupportedException {
198 197
        SimpleFillSymbol copy = (SimpleFillSymbol) super.clone();
199 198

  
......
210 209
        this.symbolForSelection = symbolForSelection;
211 210
    }
212 211

  
212
    @Override
213 213
    public void loadFromState(PersistentState state)
214 214
            throws PersistenceException {
215 215
        // Set parent fill symbol properties
......
217 217
        setSymbolForSelection((SimpleFillSymbol) state.get(FIELD_SYMBOL_FOR_SELECTION));
218 218
    }
219 219

  
220
    @Override
220 221
    public void saveToState(PersistentState state) throws PersistenceException {
221 222
        // Save parent fill symbol properties
222 223
        super.saveToState(state);
......
228 229

  
229 230
    @Override
230 231
    public void setTransparency(double transparency) {
231
        this.transparency = transparency;
232
        Color c = getFillColor();
233
        c = new Color(c.getRed(), c.getGreen(), c.getBlue(), (int) (transparency * 255));
234
        setFillColor(c);
235
        
232 236
        ILineSymbol theOutline = getOutline();
233 237
        if (theOutline != null && theOutline instanceof TransparencySupport) {
234 238
            ((TransparencySupport) theOutline).setTransparency(transparency);
......
242 246
    @Override
243 247
    public void setOutline(ILineSymbol outline) {
244 248
        super.setOutline(outline);
245
        if (outline != null && outline instanceof TransparencySupport) {
246
            ((TransparencySupport) outline).setTransparency(transparency);
247
        }
249
//        if (outline != null && outline instanceof TransparencySupport) {
250
//            ((TransparencySupport) outline).setTransparency(this.getTransparency());
251
//        }
248 252
    }
249 253

  
250 254
    @Override
251 255
    public double getTransparency() {
252
        return this.transparency;
256
        return ((double)getFillAlpha())/255;
253 257
    }
254 258

  
255 259
    public static class RegisterPersistence implements Callable {
256 260

  
261
        @Override
257 262
        public Object call() throws Exception {
258 263
            PersistenceManager manager = ToolsLocator.getPersistenceManager();
259 264
            if (manager.getDefinition(SIMPLE_FILL_SYMBOL_PERSISTENCE_DEFINITION_NAME) == null) {
......
278 283

  
279 284
    public static class RegisterSymbol implements Callable {
280 285

  
286
        @Override
281 287
        public Object call() throws Exception {
282 288
            int[] shapeTypes;
283 289
            SymbolManager manager = MapContextLocator.getSymbolManager();
trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/main/java/org/gvsig/symbology/fmap/mapcontext/rendering/symbol/line/impl/SimpleLineSymbol.java
28 28
import java.awt.Rectangle;
29 29
import java.awt.Shape;
30 30
import java.awt.geom.AffineTransform;
31

  
32 31
import org.gvsig.compat.print.PrintAttributes;
33 32
import org.gvsig.fmap.dal.feature.Feature;
34 33
import org.gvsig.fmap.geom.Geometry;
......
73 72

  
74 73
    SimpleLineSymbol symbolForSelection;
75 74
    private static final GeometryManager geomManager = GeometryLocator.getGeometryManager();
76
    private double transparency;
77 75

  
78 76
    public SimpleLineSymbol() {
79 77
        super();
80 78
        setLineWidth(1d);
81
        this.transparency = 1.0;
82
    }
79
   }
83 80

  
84 81
    @Override
85 82
    public ISymbol getSymbolForSelection() {
......
89 86
            symbolForSelection.setColor(MapContext.getSelectionColor());
90 87
        }
91 88
        if (symbolForSelection instanceof TransparencySupport) {
92
            symbolForSelection.setTransparency(this.transparency);
89
            symbolForSelection.setTransparency(this.getTransparency());
93 90
        }
94 91
        return symbolForSelection;
95 92
    }
96 93

  
94
    @Override
97 95
    public void draw(Graphics2D g, AffineTransform affineTransform,
98 96
            Geometry geom, Feature feature, Cancellable cancel) {
99 97

  
100 98
        Color c = getColor();
101
        c = new Color(c.getRed(), c.getGreen(), c.getBlue(), (int) (this.transparency * c.getAlpha()));
99

  
102 100
        if (true) {
103 101
            // Esto deberia ser para optimiza el pintado de 
104 102
            // geometrias grandes.
......
151 149
        }
152 150
    }
153 151

  
152
    @Override
154 153
    public int getOnePointRgb() {
155 154
        return getColor().getRGB();
156 155
    }
157 156

  
157
    @Override
158 158
    public void drawInsideRectangle(Graphics2D g,
159 159
            AffineTransform scaleInstance, Rectangle r, PrintAttributes properties) throws SymbolDrawingException {
160 160
        g.setColor(getColor());
......
162 162
        super.drawInsideRectangle(g, scaleInstance, r, properties);
163 163
    }
164 164

  
165
    @Override
165 166
    public void setLineWidth(double width) {
166 167
        getLineStyle().setLineWidth((float) width);
167 168
    }
168 169

  
170
    @Override
169 171
    public double getLineWidth() {
170 172
        return getLineStyle().getLineWidth();
171 173
    }
172 174

  
175
    @Override
173 176
    public Object clone() throws CloneNotSupportedException {
174 177
        SimpleLineSymbol copy = (SimpleLineSymbol) super.clone();
175 178

  
......
181 184
        return copy;
182 185
    }
183 186

  
187
    @Override
184 188
    public void loadFromState(PersistentState state) throws PersistenceException {
185 189
        // Set parent style properties
186 190
        super.loadFromState(state);
......
188 192
        this.symbolForSelection = (SimpleLineSymbol) state.get(SELECTION_SYMBOL);
189 193
    }
190 194

  
195
    @Override
191 196
    public void saveToState(PersistentState state) throws PersistenceException {
192 197
        // Save parent fill symbol properties
193 198
        super.saveToState(state);
......
200 205

  
201 206
    @Override
202 207
    public void setTransparency(double transparency) {
203
        this.transparency = transparency;
208
        Color c = getColor();
209
        c = new Color(c.getRed(), c.getGreen(), c.getBlue(), (int) (transparency * 255));
210
        setColor(c);
211
        
204 212
        ISymbol selectionSymbol = this.symbolForSelection;
205 213
        if (selectionSymbol != null && selectionSymbol instanceof TransparencySupport) {
206 214
            ((TransparencySupport) selectionSymbol).setTransparency(transparency);
......
209 217

  
210 218
    @Override
211 219
    public double getTransparency() {
212
        return this.transparency;
220
        return ((double)this.getAlpha())/255;
213 221
    }
214 222

  
215 223
    public static class RegisterPersistence implements Callable {
216 224

  
225
        @Override
217 226
        public Object call() throws Exception {
218 227
            PersistenceManager manager = ToolsLocator.getPersistenceManager();
219 228
            if (manager.getDefinition(SIMPLE_LINE_SYMBOL_PERSISTENCE_DEFINITION_NAME) == null) {
......
237 246

  
238 247
    public static class RegisterSymbol implements Callable {
239 248

  
249
        @Override
240 250
        public Object call() throws Exception {
241 251
            int[] shapeTypes;
242 252
            SymbolManager manager = MapContextLocator.getSymbolManager();

Also available in: Unified diff