Revision 4256 trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/FLyrAnnotation.java
FLyrAnnotation.java | ||
---|---|---|
1 | 1 |
package com.iver.cit.gvsig.fmap.layers; |
2 | 2 |
|
3 |
import java.awt.Dimension; |
|
4 |
import java.awt.Graphics; |
|
3 |
import java.awt.Color; |
|
5 | 4 |
import java.awt.Graphics2D; |
6 |
import java.awt.event.MouseAdapter; |
|
7 |
import java.awt.event.MouseEvent; |
|
8 |
import java.awt.font.FontRenderContext; |
|
9 |
import java.awt.font.TextHitInfo; |
|
10 |
import java.awt.font.TextLayout; |
|
11 |
//import java.awt.font.TextLayout; |
|
12 | 5 |
import java.awt.geom.Point2D; |
13 | 6 |
import java.awt.geom.Rectangle2D; |
14 | 7 |
import java.awt.image.BufferedImage; |
... | ... | |
20 | 13 |
import org.cresques.cts.IProjection; |
21 | 14 |
import org.cresques.cts.ProjectionPool; |
22 | 15 |
|
23 |
import sun.java2d.SunGraphics2D; |
|
24 |
|
|
25 | 16 |
import com.hardcode.driverManager.Driver; |
26 | 17 |
import com.hardcode.driverManager.DriverLoadException; |
27 | 18 |
import com.hardcode.gdbms.engine.values.DoubleValue; |
28 | 19 |
import com.hardcode.gdbms.engine.values.NullValue; |
20 |
import com.hardcode.gdbms.engine.values.NumericValue; |
|
21 |
import com.hardcode.gdbms.engine.values.StringValue; |
|
29 | 22 |
import com.hardcode.gdbms.engine.values.Value; |
30 | 23 |
import com.iver.cit.gvsig.fmap.DriverException; |
31 | 24 |
import com.iver.cit.gvsig.fmap.ViewPort; |
32 |
import com.iver.cit.gvsig.fmap.core.FShape; |
|
33 | 25 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
34 | 26 |
import com.iver.cit.gvsig.fmap.core.v02.FLabel; |
35 |
import com.iver.cit.gvsig.fmap.core.v02.FSymbol; |
|
36 |
import com.iver.cit.gvsig.fmap.core.v02.FTextLayout; |
|
37 | 27 |
import com.iver.cit.gvsig.fmap.drivers.BoundedShapes; |
38 | 28 |
import com.iver.cit.gvsig.fmap.drivers.DriverAttributes; |
39 | 29 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
... | ... | |
43 | 33 |
import com.iver.cit.gvsig.fmap.operations.strategies.Strategy; |
44 | 34 |
import com.iver.cit.gvsig.fmap.operations.strategies.StrategyManager; |
45 | 35 |
import com.iver.cit.gvsig.fmap.operations.strategies.VisitException; |
46 |
import com.iver.cit.gvsig.fmap.rendering.VectorialLegend; |
|
47 | 36 |
import com.iver.utiles.XMLEntity; |
48 | 37 |
import com.vividsolutions.jts.geom.Coordinate; |
49 | 38 |
import com.vividsolutions.jts.geom.Envelope; |
... | ... | |
62 | 51 |
private int indexEditing=-1; |
63 | 52 |
private boolean inPixels; |
64 | 53 |
private double size; |
65 |
private int inEdition; |
|
66 | 54 |
|
67 | 55 |
|
68 | 56 |
/** |
... | ... | |
112 | 100 |
|
113 | 101 |
|
114 | 102 |
try { |
103 |
g.setColor(Color.black); |
|
115 | 104 |
strategy.draw(image, g, viewPort, cancel); |
116 | 105 |
if (!isCreateSpatialIndex){ |
117 | 106 |
createSpatialIndex(); |
... | ... | |
231 | 220 |
public XMLEntity getXMLEntity() throws XMLException { |
232 | 221 |
XMLEntity xml = super.getXMLEntity(); |
233 | 222 |
xml.putProperty("mapping", mapping); |
223 |
xml.putProperty("isInPixels",isInPixels()); |
|
234 | 224 |
|
235 | 225 |
return xml; |
236 | 226 |
} |
... | ... | |
240 | 230 |
*/ |
241 | 231 |
public void setXMLEntity(XMLEntity xml) throws XMLException { |
242 | 232 |
mapping = xml.getIntArrayProperty("mapping"); |
233 |
setInPixels(xml.getBooleanProperty("isInPixels")); |
|
243 | 234 |
|
244 | 235 |
IProjection proj = null; |
245 | 236 |
|
... | ... | |
277 | 268 |
} else { |
278 | 269 |
setLegend(LegendFactory.createSingleSymbolLegend(getShapeType())); |
279 | 270 |
}*/ |
271 |
|
|
280 | 272 |
super.setXMLEntity(xml); |
273 |
try { |
|
274 |
createLabels(); |
|
275 |
} catch (DriverException e) { |
|
276 |
// TODO Auto-generated catch block |
|
277 |
e.printStackTrace(); |
|
278 |
} |
|
281 | 279 |
} |
282 | 280 |
|
283 | 281 |
/*public FTextLayout getSelectedTextLayout() throws DriverIOException, com.hardcode.gdbms.engine.data.driver.DriverException { |
... | ... | |
295 | 293 |
* @throws DriverException |
296 | 294 |
*/ |
297 | 295 |
public void createLabels() throws DriverException { |
298 |
int[] mapping=getMapping(); |
|
296 |
//int[] mapping=getMapping();
|
|
299 | 297 |
SelectableDataSource ds=null; |
300 | 298 |
ds = getRecordset(); |
301 | 299 |
|
... | ... | |
311 | 309 |
// El mapping[2] es el color |
312 | 310 |
int idFieldColorText = -1; |
313 | 311 |
// El mapping[3] es el alto |
314 |
int idFieldHeightText = -1;
|
|
312 |
int idFieldHeightText = mapping[3];
|
|
315 | 313 |
// El mapping[4] es el tipo de fuente |
316 |
int idFieldTypeFontText = -1;
|
|
314 |
int idFieldTypeFontText = mapping[4];
|
|
317 | 315 |
|
318 | 316 |
sc = (int) ds.getRowCount(); |
319 | 317 |
m_labels = new ArrayList(sc); |
... | ... | |
359 | 357 |
}else{ |
360 | 358 |
lbls[j].setRotation(getLegend().getDefaultSymbol().getRotation()); |
361 | 359 |
} |
362 |
/*if (idFieldColorText != -1) {
|
|
360 |
if (idFieldColorText != -1) { |
|
363 | 361 |
DoubleValue color = (DoubleValue) ds.getFieldValue(i, |
364 | 362 |
idFieldColorText); |
365 |
la.getLegend().getDefaultSymbol().setFontColor(new Color((int)color.getValue(),true)); |
|
366 |
//lbls[j].setColor((int)color.getValue()); |
|
363 |
lbls[j].setColor((int)color.getValue()); |
|
367 | 364 |
}else{ |
368 |
//lbls[j].setColor(la.getLegend().getDefaultSymbol().getFontColor().getRGB());
|
|
369 |
}*/
|
|
370 |
/*if (idFieldHeightText != -1) {
|
|
365 |
lbls[j].setColor(getLegend().getDefaultSymbol().getFontColor().getRGB());
|
|
366 |
} |
|
367 |
if (idFieldHeightText != -1) { |
|
371 | 368 |
NumericValue height = (NumericValue) ds.getFieldValue(i, |
372 | 369 |
idFieldHeightText); |
373 | 370 |
lbls[j].setHeight(height.floatValue()); |
374 | 371 |
}else{ |
375 |
lbls[j].setHeight(la.getLegend().getDefaultSymbol().getFontSize());
|
|
376 |
}*/
|
|
377 |
/*if (idFieldTypeFontText != -1) {
|
|
372 |
lbls[j].setHeight(getLegend().getDefaultSymbol().getFontSize()); |
|
373 |
} |
|
374 |
if (idFieldTypeFontText != -1) { |
|
378 | 375 |
StringValue typefont= (StringValue) ds.getFieldValue(i, |
379 | 376 |
idFieldTypeFontText); |
380 |
la.getLegend().getDefaultSymbol().getFont(). |
|
381 |
//lbls[j].setTypeFont(typefont.getValue()); |
|
377 |
lbls[j].setTypeFont(typefont.getValue()); |
|
382 | 378 |
}else{ |
383 |
//lbls[j].setTypeFont(la.getLegend().getDefaultSymbol().getFont().getFontName());
|
|
379 |
lbls[j].setTypeFont(getLegend().getDefaultSymbol().getFont().getFontName());
|
|
384 | 380 |
} |
385 |
*/ |
|
381 |
|
|
386 | 382 |
m_labels.add(lbls[j]); |
387 | 383 |
} |
388 | 384 |
|
... | ... | |
403 | 399 |
} |
404 | 400 |
|
405 | 401 |
public FLabel getLabel(int numReg) { |
406 |
if (m_labels==null)return null; |
|
402 |
if (m_labels==null || numReg==-1)return null;
|
|
407 | 403 |
return (FLabel)m_labels.get(numReg); |
408 | 404 |
} |
409 | 405 |
/* (non-Javadoc) |
... | ... | |
459 | 455 |
public void setInPixels(boolean b) { |
460 | 456 |
inPixels=b; |
461 | 457 |
} |
458 |
public boolean isInPixels(){ |
|
459 |
return inPixels; |
|
460 |
} |
|
462 | 461 |
|
463 | 462 |
public void setInEdition(int i) { |
464 |
inEdition=i;
|
|
463 |
indexEditing=i;
|
|
465 | 464 |
|
466 | 465 |
} |
467 | 466 |
|
468 | 467 |
public int getInEdition() { |
469 |
return inEdition;
|
|
468 |
return indexEditing;
|
|
470 | 469 |
} |
470 |
|
|
471 |
public ArrayList getLabels() { |
|
472 |
return m_labels; |
|
473 |
} |
|
471 | 474 |
} |
Also available in: Unified diff