Revision 47476 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/style/SimpleMarkerFillPropertiesStyle.java
SimpleMarkerFillPropertiesStyle.java | ||
---|---|---|
29 | 29 |
import java.awt.RenderingHints; |
30 | 30 |
import java.awt.TexturePaint; |
31 | 31 |
import java.awt.image.BufferedImage; |
32 |
|
|
33 | 32 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
34 | 33 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
35 | 34 |
import org.gvsig.fmap.mapcontext.rendering.symbols.IWarningSymbol; |
... | ... | |
64 | 63 |
private double ySeparation = 20; |
65 | 64 |
private int fillStyle = MarkerFillSymbol.DefaultFillStyle; |
66 | 65 |
|
66 |
@Override |
|
67 | 67 |
public void drawInsideRectangle(Graphics2D g, Rectangle r) { |
68 | 68 |
int s = (int) sampleSymbol.getSize(); |
69 | 69 |
Rectangle rProv = new Rectangle(); |
70 | 70 |
rProv.setFrame(0, 0, s, s); |
71 |
Paint resulPatternFill = null;
|
|
72 |
BufferedImage bi = null;
|
|
71 |
Paint resulPatternFill; |
|
72 |
BufferedImage bi; |
|
73 | 73 |
bi= new BufferedImage(s, s, BufferedImage.TYPE_INT_ARGB); |
74 | 74 |
Graphics2D gAux = bi.createGraphics(); |
75 | 75 |
try { |
76 |
sampleSymbol.drawInsideRectangle(gAux, gAux.getTransform(), rProv, null);
|
|
76 |
sampleSymbol.drawInsideRectangle(gAux, gAux.getTransform(), rProv); |
|
77 | 77 |
} catch (SymbolDrawingException e) { |
78 | 78 |
if (e.getType() == SymbolDrawingException.UNSUPPORTED_SET_OF_SETTINGS) { |
79 | 79 |
try { |
... | ... | |
83 | 83 |
SymbolDrawingException.STR_UNSUPPORTED_SET_OF_SETTINGS, |
84 | 84 |
"", |
85 | 85 |
SymbolDrawingException.UNSUPPORTED_SET_OF_SETTINGS); |
86 |
warning.drawInsideRectangle(gAux, gAux.getTransform(), rProv, null);
|
|
86 |
warning.drawInsideRectangle(gAux, gAux.getTransform(), rProv); |
|
87 | 87 |
} catch (SymbolDrawingException e1) { |
88 | 88 |
// IMPOSSIBLE TO REACH THIS |
89 | 89 |
} |
... | ... | |
99 | 99 |
|
100 | 100 |
} |
101 | 101 |
|
102 |
@Override |
|
102 | 103 |
public boolean isSuitableFor(ISymbol symbol) { |
103 | 104 |
return (symbol instanceof IFillSymbol); |
104 | 105 |
} |
... | ... | |
107 | 108 |
return getClass().getName(); |
108 | 109 |
} |
109 | 110 |
|
111 |
@Override |
|
110 | 112 |
public void drawOutline(Graphics2D g, Rectangle r) { |
111 | 113 |
drawInsideRectangle(g, r); |
112 | 114 |
} |
... | ... | |
122 | 124 |
* If <b>marker</b> is null, it does nothing |
123 | 125 |
* </p> |
124 | 126 |
*/ |
127 |
@Override |
|
125 | 128 |
public void setSampleSymbol(IMarkerSymbol marker) { |
126 | 129 |
if (marker != null) |
127 | 130 |
this.sampleSymbol = marker; |
128 | 131 |
} |
129 | 132 |
|
130 | 133 |
|
134 |
@Override |
|
131 | 135 |
public double getRotation() { |
132 | 136 |
return rotation; |
133 | 137 |
} |
134 | 138 |
|
139 |
@Override |
|
135 | 140 |
public void setRotation(double rotation) { |
136 | 141 |
this.rotation = rotation; |
137 | 142 |
} |
138 | 143 |
|
144 |
@Override |
|
139 | 145 |
public double getXOffset() { |
140 | 146 |
return xOffset; |
141 | 147 |
} |
142 | 148 |
|
149 |
@Override |
|
143 | 150 |
public void setXOffset(double offset) { |
144 | 151 |
xOffset = offset; |
145 | 152 |
} |
146 | 153 |
|
154 |
@Override |
|
147 | 155 |
public double getXSeparation() { |
148 | 156 |
return xSeparation; |
149 | 157 |
} |
150 | 158 |
|
159 |
@Override |
|
151 | 160 |
public void setXSeparation(double separation) { |
152 | 161 |
xSeparation = separation; |
153 | 162 |
} |
154 | 163 |
|
164 |
@Override |
|
155 | 165 |
public double getYOffset() { |
156 | 166 |
return yOffset; |
157 | 167 |
} |
158 | 168 |
|
169 |
@Override |
|
159 | 170 |
public void setYOffset(double offset) { |
160 | 171 |
yOffset = offset; |
161 | 172 |
} |
162 | 173 |
|
174 |
@Override |
|
163 | 175 |
public double getYSeparation() { |
164 | 176 |
return ySeparation; |
165 | 177 |
} |
166 | 178 |
|
179 |
@Override |
|
167 | 180 |
public void setYSeparation(double separation) { |
168 | 181 |
ySeparation = separation; |
169 | 182 |
} |
170 | 183 |
|
184 |
@Override |
|
171 | 185 |
public void setFillStyle(int fillStyle) { |
172 | 186 |
this.fillStyle = fillStyle; |
173 | 187 |
} |
174 | 188 |
|
189 |
@Override |
|
175 | 190 |
public int getFillStyle() { |
176 | 191 |
return fillStyle; |
177 | 192 |
} |
178 | 193 |
|
194 |
@Override |
|
179 | 195 |
public Object clone() throws CloneNotSupportedException { |
180 | 196 |
SimpleMarkerFillPropertiesStyle copy = (SimpleMarkerFillPropertiesStyle) super.clone(); |
181 | 197 |
if (sampleSymbol != null) { |
... | ... | |
184 | 200 |
return copy; |
185 | 201 |
} |
186 | 202 |
|
203 |
@Override |
|
187 | 204 |
public void loadFromState(PersistentState state) |
188 | 205 |
throws PersistenceException { |
189 | 206 |
// Set parent style properties |
... | ... | |
202 | 219 |
|
203 | 220 |
} |
204 | 221 |
|
222 |
@Override |
|
205 | 223 |
public void saveToState(PersistentState state) throws PersistenceException { |
206 | 224 |
// Save parent fill symbol properties |
207 | 225 |
super.saveToState(state); |
... | ... | |
223 | 241 |
|
224 | 242 |
public static class RegisterPersistence implements Callable { |
225 | 243 |
|
244 |
@Override |
|
226 | 245 |
public Object call() throws Exception { |
227 | 246 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
228 | 247 |
if( manager.getDefinition(SIMPLE_MARKER_FILL_STYLE_PERSISTENCE_DEFINITION_NAME)==null ) { |
Also available in: Unified diff