Revision 1634
trunk/org.gvsig.app.document.layout2.app/pom.xml | ||
---|---|---|
11 | 11 |
<parent> |
12 | 12 |
<groupId>org.gvsig</groupId> |
13 | 13 |
<artifactId>org.gvsig.desktop</artifactId> |
14 |
<version>2.0.429</version>
|
|
14 |
<version>2.0.430-SNAPSHOT</version>
|
|
15 | 15 |
</parent> |
16 | 16 |
|
17 | 17 |
<url>https://devel.gvsig.org/redmine/projects/gvsig-app-document-layout</url> |
trunk/org.gvsig.app.document.layout2.app/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/project/documents/layout/fframes/FFrameGroup.java | ||
---|---|---|
28 | 28 |
import java.awt.image.BufferedImage; |
29 | 29 |
import java.util.ArrayList; |
30 | 30 |
import java.util.List; |
31 |
|
|
32 | 31 |
import org.gvsig.andami.PluginServices; |
33 | 32 |
import org.gvsig.app.project.Project; |
34 | 33 |
import org.gvsig.app.project.documents.layout.FLayoutUtilities; |
... | ... | |
53 | 52 |
|
54 | 53 |
private static final String FFRAMES_FIELD = "fframes"; |
55 | 54 |
|
56 |
private List<IFFrame> m_fframes = new ArrayList<IFFrame>();
|
|
55 |
private List<IFFrame> m_fframes = new ArrayList<>(); |
|
57 | 56 |
private Rectangle2D.Double rg = null; |
58 | 57 |
private AffineTransform m_at; |
59 | 58 |
private Project project; |
... | ... | |
97 | 96 |
boolean first = true; |
98 | 97 |
Rectangle2D.Double rec = new Rectangle2D.Double(); |
99 | 98 |
IFFrame[] fframes = getFFrames(); |
100 |
for (int i = 0; i < fframes.length; i++) { |
|
101 |
Rectangle2D.Double rs = fframes[i].getBoundingBox(at); |
|
102 |
|
|
99 |
for (IFFrame fframe : fframes) { |
|
100 |
Rectangle2D.Double rs = fframe.getBoundingBox(at); |
|
103 | 101 |
if (first) { |
104 | 102 |
rec.setRect(rs); |
105 | 103 |
first = false; |
106 | 104 |
} |
107 |
|
|
108 | 105 |
rec.add(rs); |
109 | 106 |
} |
110 | 107 |
|
... | ... | |
128 | 125 |
* @param imgBase |
129 | 126 |
* Imagen utilizada para acelerar el dibujado. |
130 | 127 |
*/ |
128 |
@Override |
|
131 | 129 |
public void draw(Graphics2D g, AffineTransform at, Rectangle2D rv, |
132 | 130 |
BufferedImage imgBase) { |
133 | 131 |
Rectangle2D.Double r = getBoundingBox(at); |
... | ... | |
160 | 158 |
* @param r |
161 | 159 |
* Rect?ngulo. |
162 | 160 |
*/ |
161 |
@Override |
|
163 | 162 |
public void setBoundBox(Rectangle2D r) { |
164 | 163 |
getBoundBox().setRect(r.getX(), r.getY(), r.getWidth(), r.getHeight()); |
165 | 164 |
|
166 |
double dx = 1; |
|
167 |
double dy = 1; |
|
168 |
double dw = 1; |
|
169 |
double dh = 1; |
|
165 |
double dx; // = 1;
|
|
166 |
double dy; // = 1;
|
|
167 |
double dw; // = 1;
|
|
168 |
double dh; // = 1;
|
|
170 | 169 |
|
171 | 170 |
if (rg != null) { |
172 | 171 |
Rectangle2D.Double raux1 = |
... | ... | |
176 | 175 |
dw = r.getWidth() / raux1.width; |
177 | 176 |
dh = r.getHeight() / raux1.height; |
178 | 177 |
IFFrame[] fframes = getFFrames(); |
179 |
for (int i = 0; i < fframes.length; i++) { |
|
180 |
IFFrame fframe = fframes[i]; |
|
178 |
for (IFFrame fframe : fframes) { |
|
181 | 179 |
Rectangle2D.Double raux = new Rectangle2D.Double(); |
182 | 180 |
raux.setRect(fframe.getBoundBox()); |
183 | 181 |
|
... | ... | |
207 | 205 |
/** |
208 | 206 |
* @see org.gvsig.app.project.documents.layout.fframes.IFFrame#getNameFFrame() |
209 | 207 |
*/ |
208 |
@Override |
|
210 | 209 |
public String getNameFFrame() { |
211 | 210 |
return PluginServices.getText(this, "grupo") + num; |
212 | 211 |
} |
213 | 212 |
|
213 |
@Override |
|
214 | 214 |
public String getName() { |
215 | 215 |
return PERSISTENCE_DEFINITION_NAME; |
216 | 216 |
} |
... | ... | |
219 | 219 |
* @see org.gvsig.app.project.documents.layout.fframes.IFFrame#print(java.awt.Graphics2D, |
220 | 220 |
* java.awt.geom.AffineTransform) |
221 | 221 |
*/ |
222 |
@Override |
|
222 | 223 |
public void print(Graphics2D g, AffineTransform at, Geometry geom, |
223 | 224 |
PrintAttributes printingProperties) { |
224 | 225 |
Rectangle2D.Double r = getBoundingBox(at); |
225 | 226 |
g.rotate(Math.toRadians(getRotation()), r.x + (r.width / 2), r.y |
226 | 227 |
+ (r.height / 2)); |
227 | 228 |
IFFrame[] fframes = m_fframes.toArray(new IFFrame[0]); |
228 |
for (int i = 0; i < fframes.length; i++) {
|
|
229 |
fframes[i].print(g, at, geom, printingProperties);
|
|
229 |
for (IFFrame fframe : fframes) {
|
|
230 |
fframe.print(g, at, geom, printingProperties); |
|
230 | 231 |
} |
231 | 232 |
|
232 | 233 |
g.rotate(Math.toRadians(-getRotation()), r.x + (r.width / 2), r.y |
... | ... | |
239 | 240 |
* @param project |
240 | 241 |
* DOCUMENT ME! |
241 | 242 |
*/ |
243 |
@Override |
|
242 | 244 |
public void setProject(Project project) { |
243 | 245 |
this.project = project; |
244 | 246 |
} |
... | ... | |
259 | 261 |
m_fframes.remove(fframe); |
260 | 262 |
} |
261 | 263 |
|
264 |
@Override |
|
262 | 265 |
public IFFrame clone() throws CloneNotSupportedException { |
263 | 266 |
FFrameGroup frame = (FFrameGroup) super.clone(); |
264 | 267 |
frame.setSelected(this.getSelected() != IFFrame.NOSELECT); |
265 |
frame.m_fframes = new ArrayList<IFFrame>();
|
|
268 |
frame.m_fframes = new ArrayList<>(); |
|
266 | 269 |
|
267 | 270 |
for (int i = 0; i < m_fframes.size(); i++) { |
268 | 271 |
frame.addFFrame((IFFrame) m_fframes.get(i).clone()); |
269 | 272 |
} |
270 |
frame.m_at = new AffineTransform(m_at); |
|
273 |
if(m_at != null){ |
|
274 |
frame.m_at = new AffineTransform(m_at); |
|
275 |
} else { |
|
276 |
frame.m_at = new AffineTransform(); |
|
277 |
} |
|
271 | 278 |
frame.rg = new Rectangle2D.Double(rg.x, rg.y, rg.width, rg.height); |
272 | 279 |
return frame; |
273 | 280 |
} |
274 | 281 |
|
282 |
@Override |
|
275 | 283 |
public void setFFrameDependence(IFFrame f) { |
276 | 284 |
IFFrame[] frames = getFFrames(); |
277 |
for (int i = 0; i < frames.length; i++) {
|
|
278 |
if (frames[i] instanceof IFFrameViewDependence) {
|
|
279 |
((IFFrameViewDependence) frames[i]).setFFrameDependence(f);
|
|
285 |
for (IFFrame frame : frames) {
|
|
286 |
if (frame instanceof IFFrameViewDependence) { |
|
287 |
((IFFrameViewDependence) frame).setFFrameDependence(f); |
|
280 | 288 |
} |
281 | 289 |
} |
282 | 290 |
} |
283 | 291 |
|
292 |
@Override |
|
284 | 293 |
public IFFrame[] getFFrameDependence() { |
285 | 294 |
IFFrame[] frames = getFFrames(); |
286 |
ArrayList<IFFrame> dependences = new ArrayList<IFFrame>();
|
|
295 |
ArrayList<IFFrame> dependences = new ArrayList<>(); |
|
287 | 296 |
for (int i = 0; i < frames.length; i++) { |
288 | 297 |
if (frames[i] instanceof IFFrameViewDependence) { |
289 | 298 |
IFFrame[] framesAux = |
290 | 299 |
((IFFrameViewDependence) frames[i]).getFFrameDependence(); |
291 |
for (int j = 0; j < framesAux.length; j++) {
|
|
300 |
for (IFFrame framesAux1 : framesAux) {
|
|
292 | 301 |
dependences.add(framesAux[i]); |
293 | 302 |
} |
294 | 303 |
} |
... | ... | |
296 | 305 |
return dependences.toArray(new IFFrame[0]); |
297 | 306 |
} |
298 | 307 |
|
308 |
@Override |
|
299 | 309 |
public void refreshDependence(IFFrame fant, IFFrame fnew) { |
300 | 310 |
IFFrame[] frames = getFFrames(); |
301 |
for (int i = 0; i < frames.length; i++) { |
|
302 |
|
|
311 |
for (IFFrame frame : frames) { |
|
303 | 312 |
if (fnew instanceof FFrameGroup) { |
304 | 313 |
IFFrame[] framesGroupNew = ((FFrameGroup) fnew).getFFrames(); |
305 |
for (int j = 0; j < framesGroupNew.length; j++) {
|
|
314 |
for (IFFrame framesGroupNew1 : framesGroupNew) {
|
|
306 | 315 |
if (fant instanceof FFrameGroup) { |
307 | 316 |
IFFrame[] framesGroupAnt = |
308 |
((FFrameGroup) fant).getFFrames(); |
|
309 |
for (int k = 0; k < framesGroupAnt.length; k++) { |
|
310 |
if (framesGroupAnt[k] instanceof IFFrameViewDependence) { |
|
311 |
refreshDependence(framesGroupAnt[k], |
|
312 |
framesGroupNew[j]); |
|
317 |
((FFrameGroup) fant).getFFrames(); |
|
318 |
for (IFFrame framesGroupAnt1 : framesGroupAnt) { |
|
319 |
if (framesGroupAnt1 instanceof IFFrameViewDependence) { |
|
320 |
refreshDependence(framesGroupAnt1, framesGroupNew1); |
|
313 | 321 |
} |
314 | 322 |
} |
315 | 323 |
} |
316 | 324 |
} |
317 |
} else |
|
318 |
if (frames[i] instanceof IFFrameViewDependence) { |
|
319 |
((IFFrameViewDependence) frames[i]).refreshDependence(fant, |
|
320 |
fnew); |
|
321 |
} |
|
325 |
} else if (frame instanceof IFFrameViewDependence) { |
|
326 |
((IFFrameViewDependence) frame).refreshDependence(fant, fnew); |
|
327 |
} |
|
322 | 328 |
} |
323 | 329 |
} |
324 | 330 |
|
trunk/org.gvsig.app.document.layout2.app/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/project/documents/layout/fframes/FFrameLegend.java | ||
---|---|---|
31 | 31 |
import java.awt.image.BufferedImage; |
32 | 32 |
import java.util.ArrayList; |
33 | 33 |
import java.util.List; |
34 |
|
|
35 | 34 |
import org.gvsig.andami.PluginServices; |
36 | 35 |
import org.gvsig.app.project.documents.layout.FLayoutUtilities; |
37 | 36 |
import org.gvsig.app.project.documents.layout.LayoutContext; |
... | ... | |
40 | 39 |
import org.gvsig.fmap.geom.Geometry; |
41 | 40 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
42 | 41 |
import org.gvsig.fmap.mapcontext.MapContextManager; |
42 |
import org.gvsig.fmap.mapcontext.ViewPort; |
|
43 | 43 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
44 | 44 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
45 | 45 |
import org.gvsig.fmap.mapcontext.layers.operations.Classifiable; |
46 | 46 |
import org.gvsig.fmap.mapcontext.layers.operations.IHasImageLegend; |
47 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
|
47 | 48 |
import org.gvsig.fmap.mapcontext.rendering.legend.IClassifiedLegend; |
48 | 49 |
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend; |
50 |
import org.gvsig.fmap.mapcontext.rendering.symbols.CartographicSupport; |
|
49 | 51 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
50 | 52 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ITextSymbol; |
51 | 53 |
import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolDrawingException; |
... | ... | |
81 | 83 |
private int m_max; |
82 | 84 |
private int m_numLayers; |
83 | 85 |
private FLayers layers = null; |
84 |
private List<String> nameLayers = new ArrayList<String>();
|
|
85 |
private List<Boolean> areVisible = new ArrayList<Boolean>();
|
|
86 |
private List<String> nameLayers = new ArrayList<>(); |
|
87 |
private List<Boolean> areVisible = new ArrayList<>(); |
|
86 | 88 |
private PrintAttributes properties; |
87 | 89 |
|
88 |
private MapContextManager mapContextManager = MapContextLocator |
|
90 |
private final MapContextManager mapContextManager = MapContextLocator
|
|
89 | 91 |
.getMapContextManager(); |
90 | 92 |
|
91 | 93 |
public FFrameLegend() { |
... | ... | |
144 | 146 |
* @param imgBase |
145 | 147 |
* Imagen para acelerar el dibujado. |
146 | 148 |
*/ |
149 |
@Override |
|
147 | 150 |
public void draw(Graphics2D g, AffineTransform at, Rectangle2D rv, |
148 | 151 |
BufferedImage imgBase) { |
149 | 152 |
Rectangle2D.Double re = getBoundingBox(at); |
... | ... | |
199 | 202 |
*/ |
200 | 203 |
private void drawLegendOrToFFrame(Graphics2D g, Rectangle2D re, double h, |
201 | 204 |
FLayers layers, int[] n, LayoutContext layoutContext) { |
202 |
float sizefont = 0; |
|
205 |
float sizefont; // = 0;
|
|
203 | 206 |
|
204 | 207 |
if ((re.getHeight() / m_numLayers) < (re.getWidth() / (m_max * 0.7))) { |
205 | 208 |
sizefont = (float) (re.getHeight() / m_numLayers); |
206 | 209 |
} else { |
207 | 210 |
sizefont = (float) (re.getWidth() / (m_max * 0.7)); |
208 | 211 |
} |
212 |
|
|
213 |
ViewPort viewPort = layers.getMapContext().getViewPort(); |
|
209 | 214 |
|
210 | 215 |
int l = 0; |
211 | 216 |
// ////Se recorren los layers dibujando el s?mbolo y su nombre sobre el |
212 | 217 |
// graphics |
213 | 218 |
for (int i = layers.getLayersCount() - 1; i >= 0; i--) { |
214 | 219 |
FLayer layer = layers.getLayer(i); |
215 |
boolean b = false; |
|
220 |
boolean b;// = false;
|
|
216 | 221 |
|
217 | 222 |
if (nameLayers.size() > l |
218 | 223 |
&& nameLayers.get(l).equals(layer.getName())) { |
219 |
b = ((Boolean) areVisible.get(l)).booleanValue();
|
|
224 |
b = (areVisible.get(l));
|
|
220 | 225 |
} else { |
221 | 226 |
b = layer.isVisible(); |
222 | 227 |
} |
... | ... | |
333 | 338 |
xl = (re.getX() + dX); |
334 | 339 |
yl = (re.getY() + dY); |
335 | 340 |
|
336 |
String s = descriptions[j];
|
|
341 |
String desc = descriptions[j];
|
|
337 | 342 |
if (layoutContext != null) { |
338 |
toFFrameText(layoutContext, s, re, sizefont, xl,
|
|
343 |
toFFrameText(layoutContext, desc, re, sizefont, xl,
|
|
339 | 344 |
yl, h); |
340 | 345 |
} else { |
341 |
drawNameLegend(g, s, re, sizefont, xl, yl,
|
|
346 |
drawNameLegend(g, desc, re, sizefont, xl, yl,
|
|
342 | 347 |
h); |
343 | 348 |
} |
344 | 349 |
ISymbol fs2d = symbols[j]; |
... | ... | |
347 | 352 |
toFFrameSymbol(layoutContext, re, xl, yl, |
348 | 353 |
fs2d, sizefont, h, |
349 | 354 |
cla_layer.getShapeType()); |
350 |
} catch (ReadException e) { |
|
351 |
e.printStackTrace(); |
|
355 |
} catch (ReadException ex) {
|
|
356 |
ex.printStackTrace();
|
|
352 | 357 |
} |
353 | 358 |
} else { |
359 |
if(fs2d instanceof CartographicSupport){ |
|
360 |
Geometry geom = null; |
|
361 |
if(layer instanceof FLyrVect){ |
|
362 |
geom = ((FLyrVect) layer).getFeatureStore().getSampleFeature().getDefaultGeometry(); |
|
363 |
} |
|
364 |
((CartographicSupport) fs2d).setCartographicContext(viewPort, properties, geom); |
|
365 |
} |
|
354 | 366 |
drawSymbolLegend(g, re, xl, yl, fs2d, |
355 | 367 |
sizefont, h); |
356 | 368 |
} |
... | ... | |
383 | 395 |
e.printStackTrace(); |
384 | 396 |
} |
385 | 397 |
} else { |
398 |
if(fs2d instanceof CartographicSupport){ |
|
399 |
Geometry geom = null; |
|
400 |
if(layer instanceof FLyrVect){ |
|
401 |
geom = ((FLyrVect) layer).getFeatureStore().getSampleFeature().getDefaultGeometry(); |
|
402 |
} |
|
403 |
((CartographicSupport) fs2d).setCartographicContext(viewPort, properties, geom); |
|
404 |
} |
|
386 | 405 |
drawSymbolLegend(g, re, xl, yl, fs2d, |
387 | 406 |
sizefont, h); |
388 | 407 |
} |
... | ... | |
524 | 543 |
new Rectangle((int) x, (int) ((y + (h / 2)) - haux), (int) wl, |
525 | 544 |
(int) haux); |
526 | 545 |
try { |
527 |
symbol2d.drawInsideRectangle(g, new AffineTransform(), rectangle, |
|
528 |
properties); |
|
529 |
} catch (SymbolDrawingException e) { |
|
530 |
if (e.getType() == SymbolDrawingException.UNSUPPORTED_SET_OF_SETTINGS) { |
|
546 |
// if(symbol2d instanceof CartographicSupport){ |
|
547 |
// ((CartographicSupport)symbol2d).setCartographicContext(properties); |
|
548 |
// } |
|
549 |
symbol2d.drawInsideRectangle(g, new AffineTransform(), rectangle); //,properties); |
|
550 |
} catch (SymbolDrawingException ex) { |
|
551 |
if (ex.getType() == SymbolDrawingException.UNSUPPORTED_SET_OF_SETTINGS) { |
|
531 | 552 |
try { |
532 | 553 |
mapContextManager |
533 | 554 |
.getSymbolManager() |
... | ... | |
535 | 556 |
SymbolDrawingException.STR_UNSUPPORTED_SET_OF_SETTINGS, |
536 | 557 |
symbol2d.getDescription(), |
537 | 558 |
SymbolDrawingException.UNSUPPORTED_SET_OF_SETTINGS) |
538 |
.drawInsideRectangle(g, null, rectangle, null);
|
|
559 |
.drawInsideRectangle(g, null, rectangle); |
|
539 | 560 |
} catch (SymbolDrawingException e1) { |
540 | 561 |
// IMPOSSIBLE TO REACH THIS |
541 | 562 |
} |
... | ... | |
600 | 621 |
* @return N?mero de capas y subcapas. |
601 | 622 |
*/ |
602 | 623 |
private int getSizeNum(FLayers layers) { |
603 |
int n = 0;
|
|
624 |
int count = 0;
|
|
604 | 625 |
|
605 | 626 |
// ///Aqu? hay que calcular cuantos layers y sublayers hay, para saber |
606 | 627 |
// que distancias dejar entre uno y otro. |
... | ... | |
609 | 630 |
int l = 0; |
610 | 631 |
for (int i = layers.getLayersCount() - 1; i >= 0; i--) { |
611 | 632 |
FLayer layer = layers.getLayer(i); |
612 |
boolean b = false; |
|
633 |
boolean b; // = false;
|
|
613 | 634 |
if (nameLayers.size() > l |
614 | 635 |
&& nameLayers.get(l).equals(layer.getName())) { |
615 |
b = ((Boolean) areVisible.get(l)).booleanValue();
|
|
636 |
b = areVisible.get(l);
|
|
616 | 637 |
} else { |
617 | 638 |
b = layer.isVisible(); |
618 | 639 |
} |
... | ... | |
625 | 646 |
|
626 | 647 |
if (layer instanceof FLayers) { |
627 | 648 |
// n++; |
628 |
n = n + 3;
|
|
629 |
n += getSizeNum((FLayers) layer); // m_numLayers +=
|
|
649 |
count = count + 3;
|
|
650 |
count += getSizeNum((FLayers) layer); // m_numLayers +=
|
|
630 | 651 |
// getNumInLyrGroup((FLayers) |
631 | 652 |
// layer); |
632 | 653 |
} else { |
633 | 654 |
if (layer instanceof Classifiable) { |
634 | 655 |
Classifiable cO = (Classifiable) layer; |
635 |
n++;
|
|
656 |
count++;
|
|
636 | 657 |
|
637 | 658 |
if (cO.getLegend() instanceof IClassifiedLegend) {// && |
638 | 659 |
// !(cO |
... | ... | |
643 | 664 |
(IClassifiedLegend) cO.getLegend(); |
644 | 665 |
|
645 | 666 |
for (int j = 0; j < cli.getValues().length; j++) { |
646 |
String s = cli.getDescriptions()[j];
|
|
667 |
String desc = cli.getDescriptions()[j];
|
|
647 | 668 |
|
648 |
if (s != null && s.length() > m_max) {
|
|
649 |
m_max = s.length();
|
|
669 |
if (desc != null && desc.length() > m_max) {
|
|
670 |
m_max = desc.length();
|
|
650 | 671 |
} |
651 | 672 |
|
652 |
n++;
|
|
673 |
count++;
|
|
653 | 674 |
} |
654 | 675 |
} |
655 | 676 |
} else { |
656 |
String s = layer.getName();
|
|
677 |
String layerName = layer.getName();
|
|
657 | 678 |
|
658 |
if (s != null && s.length() > m_max) {
|
|
659 |
m_max = s.length();
|
|
679 |
if (layerName != null && layerName.length() > m_max) {
|
|
680 |
m_max = layerName.length();
|
|
660 | 681 |
} |
661 | 682 |
|
662 |
n++;
|
|
683 |
count++;
|
|
663 | 684 |
} |
664 | 685 |
|
665 | 686 |
} |
666 | 687 |
} |
667 | 688 |
} |
668 | 689 |
|
669 |
return n;
|
|
690 |
return count;
|
|
670 | 691 |
} |
671 | 692 |
|
672 | 693 |
/** |
... | ... | |
715 | 736 |
return new Font("SansSerif", Font.PLAIN, 9); |
716 | 737 |
} |
717 | 738 |
|
739 |
@Override |
|
718 | 740 |
public String getNameFFrame() { |
719 | 741 |
return PluginServices.getText(this, "leyenda") + num; |
720 | 742 |
} |
721 | 743 |
|
744 |
@Override |
|
722 | 745 |
public String getName() { |
723 | 746 |
return PERSISTENCE_DEFINITION_NAME; |
724 | 747 |
} |
725 | 748 |
|
749 |
@Override |
|
726 | 750 |
public void print(Graphics2D g, AffineTransform at, Geometry geom, |
727 | 751 |
PrintAttributes properties) { |
728 | 752 |
this.properties = properties; |
trunk/org.gvsig.app.document.layout2.app/org.gvsig.app.document.layout2.app.mainplugin/src/main/java/org/gvsig/app/project/documents/layout/fframes/FFrameSymbol.java | ||
---|---|---|
26 | 26 |
import java.awt.geom.AffineTransform; |
27 | 27 |
import java.awt.geom.Rectangle2D; |
28 | 28 |
import java.awt.image.BufferedImage; |
29 |
|
|
30 | 29 |
import org.gvsig.andami.PluginServices; |
31 | 30 |
import org.gvsig.app.project.documents.layout.geometryadapters.GeometryAdapter; |
32 | 31 |
import org.gvsig.compat.print.PrintAttributes; |
33 | 32 |
import org.gvsig.fmap.geom.Geometry; |
34 | 33 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
35 | 34 |
import org.gvsig.fmap.mapcontext.MapContextManager; |
35 |
import org.gvsig.fmap.mapcontext.rendering.symbols.CartographicSupport; |
|
36 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
|
36 | 37 |
import org.gvsig.fmap.mapcontext.rendering.symbols.SymbolDrawingException; |
37 | 38 |
import org.gvsig.tools.ToolsLocator; |
38 | 39 |
import org.gvsig.tools.dynobject.DynStruct; |
... | ... | |
51 | 52 |
|
52 | 53 |
private PrintAttributes properties; |
53 | 54 |
|
54 |
private MapContextManager mapContextManager = MapContextLocator |
|
55 |
private final MapContextManager mapContextManager = MapContextLocator
|
|
55 | 56 |
.getMapContextManager(); |
56 | 57 |
|
57 | 58 |
/** |
... | ... | |
75 | 76 |
* @param imgBase |
76 | 77 |
* Imagen para acelerar el dibujado. |
77 | 78 |
*/ |
79 |
@Override |
|
78 | 80 |
public void draw(Graphics2D g, AffineTransform at, Rectangle2D rv, |
79 | 81 |
BufferedImage imgBase) { |
80 | 82 |
Rectangle2D.Double re = getBoundingBox(at); |
... | ... | |
90 | 92 |
(int) (re.height)); |
91 | 93 |
|
92 | 94 |
try { |
93 |
getFSymbol().drawInsideRectangle(g, mT2, rec, properties); |
|
94 |
} catch (SymbolDrawingException e) { |
|
95 |
if (e.getType() == SymbolDrawingException.UNSUPPORTED_SET_OF_SETTINGS) { |
|
95 |
ISymbol sym = getFSymbol(); |
|
96 |
if(sym instanceof CartographicSupport){ |
|
97 |
((CartographicSupport)sym).setCartographicContext(properties); |
|
98 |
} |
|
99 |
|
|
100 |
sym.drawInsideRectangle(g, mT2, rec); //, properties); |
|
101 |
} catch (SymbolDrawingException ex) { |
|
102 |
if (ex.getType() == SymbolDrawingException.UNSUPPORTED_SET_OF_SETTINGS) { |
|
96 | 103 |
try { |
97 | 104 |
mapContextManager |
98 | 105 |
.getSymbolManager() |
... | ... | |
100 | 107 |
SymbolDrawingException.STR_UNSUPPORTED_SET_OF_SETTINGS, |
101 | 108 |
getFSymbol().getDescription(), |
102 | 109 |
SymbolDrawingException.UNSUPPORTED_SET_OF_SETTINGS) |
103 |
.drawInsideRectangle(g, null, rec, null);
|
|
110 |
.drawInsideRectangle(g, null, rec); |
|
104 | 111 |
} catch (SymbolDrawingException e1) { |
105 | 112 |
// IMPOSSIBLE TO REACH THIS |
106 | 113 |
} |
... | ... | |
119 | 126 |
/** |
120 | 127 |
* @see org.gvsig.app.project.documents.layout.fframes.IFFrame#getNameFFrame() |
121 | 128 |
*/ |
129 |
@Override |
|
122 | 130 |
public String getNameFFrame() { |
123 | 131 |
return PluginServices.getText(this, "simbolo") + num; |
124 | 132 |
} |
125 | 133 |
|
134 |
@Override |
|
126 | 135 |
public String getName() { |
127 | 136 |
return PERSISTENCE_DEFINITION_NAME; |
128 | 137 |
} |
... | ... | |
131 | 140 |
* @see org.gvsig.app.project.documents.layout.fframes.IFFrame#print(java.awt.Graphics2D, |
132 | 141 |
* java.awt.geom.AffineTransform) |
133 | 142 |
*/ |
143 |
@Override |
|
134 | 144 |
public void print(Graphics2D g, AffineTransform at, Geometry geom, |
135 | 145 |
PrintAttributes printingProperties) { |
136 | 146 |
this.properties = printingProperties; |
... | ... | |
138 | 148 |
this.properties = null; |
139 | 149 |
} |
140 | 150 |
|
151 |
@Override |
|
141 | 152 |
public void initialize() { |
142 | 153 |
|
143 | 154 |
} |
144 | 155 |
|
156 |
@Override |
|
145 | 157 |
public void setBoundBox(Rectangle2D r) { |
146 | 158 |
m_BoundBox.setRect(r.getX(), r.getY(), r.getWidth(), r.getHeight()); |
147 | 159 |
} |
Also available in: Unified diff