Revision 12331
branches/v10/extensions/extAnnotations/src/com/iver/cit/gvsig/fmap/edition/Annotation_EditableAdapter.java | ||
---|---|---|
48 | 48 |
|
49 | 49 |
import com.hardcode.driverManager.DriverLoadException; |
50 | 50 |
import com.hardcode.gdbms.engine.values.NumericValue; |
51 |
import com.hardcode.gdbms.engine.values.StringValue; |
|
51 | 52 |
import com.hardcode.gdbms.engine.values.Value; |
52 | 53 |
import com.hardcode.gdbms.engine.values.ValueFactory; |
53 | 54 |
import com.iver.andami.PluginServices; |
... | ... | |
59 | 60 |
import com.iver.cit.gvsig.fmap.core.IFeature; |
60 | 61 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
61 | 62 |
import com.iver.cit.gvsig.fmap.core.IRow; |
63 |
import com.iver.cit.gvsig.fmap.core.ShapeFactory; |
|
62 | 64 |
import com.iver.cit.gvsig.fmap.core.v02.FConverter; |
63 | 65 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
64 | 66 |
import com.iver.cit.gvsig.fmap.layers.Annotation_Layer; |
... | ... | |
125 | 127 |
values[mapping.getColumnHeight()] = ValueFactory.createValue(height); |
126 | 128 |
values[mapping.getColumnRotate()] = ValueFactory.createValue(rotate); |
127 | 129 |
values[mapping.getColumnColor()] = ValueFactory.createValue(intColor); |
128 |
IGeometry geom; |
|
129 |
ViewPort vp=lyrAnnotation.getMapContext().getViewPort(); |
|
130 |
geom = lyrAnnotation.getTextWrappingGeometry(height, text, rotate, |
|
131 |
position,vp); |
|
132 |
feat = new DefaultFeature(geom, values, feat.getID()); |
|
130 |
// IGeometry geom;
|
|
131 |
// ViewPort vp=lyrAnnotation.getMapContext().getViewPort();
|
|
132 |
// geom = lyrAnnotation.getTextWrappingGeometry(height, text, rotate,
|
|
133 |
// position,vp);
|
|
134 |
// feat = new DefaultFeature(geom, values, feat.getID());
|
|
133 | 135 |
return position; |
134 | 136 |
} |
135 | 137 |
|
... | ... | |
185 | 187 |
DefaultRowEdited edRow = null; |
186 | 188 |
ViewPort vp=lyrAnnotation.getMapContext().getViewPort(); |
187 | 189 |
try { |
190 |
IFeature f = null; |
|
188 | 191 |
if (!relations.containsKey(integer)) { |
189 |
IFeature f = ova.getFeature(calculatedIndex); |
|
190 |
String s = f.getID(); |
|
192 |
f = ova.getFeature(calculatedIndex); |
|
191 | 193 |
|
192 |
Annotation_Mapping mapping = lyrAnnotation.getAnnotatonMapping(); |
|
193 |
NumericValue vRotation = (NumericValue) f.getAttribute(mapping.getColumnRotate()); |
|
194 |
NumericValue vHeight = (NumericValue) f.getAttribute(mapping.getColumnHeight()); |
|
195 |
Value vText = f.getAttribute(mapping.getColumnText()); |
|
196 |
|
|
197 |
IGeometry geom = lyrAnnotation.getTextWrappingGeometry(vHeight.floatValue(), |
|
198 |
vText.toString(), vRotation.doubleValue(), index, vp); |
|
199 |
f = new DefaultFeature(geom, f.getAttributes(), s); |
|
200 |
edRow = new DefaultRowEdited(f, |
|
201 |
DefaultRowEdited.STATUS_ORIGINAL, index); |
|
202 |
|
|
203 |
return edRow; |
|
204 | 194 |
} else { |
205 | 195 |
int num = ((Integer) relations.get(integer)).intValue(); |
206 | 196 |
IRowEdited aux = expansionFile.getRow(num); |
207 |
IFeature f = (IFeature) aux.getLinkedRow().cloneRow(); |
|
197 |
f = (IFeature) aux.getLinkedRow().cloneRow(); |
|
198 |
} |
|
199 |
String s = f.getID(); |
|
208 | 200 |
|
209 |
Annotation_Mapping mapping = lyrAnnotation.getAnnotatonMapping();
|
|
210 |
NumericValue vRotation = (NumericValue) f.getAttribute(mapping.getColumnRotate());
|
|
211 |
NumericValue vHeight = (NumericValue) f.getAttribute(mapping.getColumnHeight());
|
|
212 |
Value vText = f.getAttribute(mapping.getColumnText());
|
|
213 |
IGeometry geom = lyrAnnotation.getTextWrappingGeometry(vHeight.floatValue(),
|
|
214 |
vText.toString(), vRotation.doubleValue(), index, vp);
|
|
201 |
Annotation_Mapping mapping = lyrAnnotation.getAnnotatonMapping(); |
|
202 |
NumericValue vRotation = (NumericValue) f.getAttribute(mapping.getColumnRotate()); |
|
203 |
NumericValue vHeight = (NumericValue) f.getAttribute(mapping.getColumnHeight()); |
|
204 |
NumericValue vStyle = (NumericValue) f.getAttribute(mapping.getColumnStyleFont());
|
|
205 |
StringValue vType = (StringValue) f.getAttribute(mapping.getColumnTypeFont());
|
|
206 |
Value vText = f.getAttribute(mapping.getColumnText());
|
|
215 | 207 |
|
216 |
String s = f.getID(); |
|
217 |
f = new DefaultFeature(geom, f.getAttributes(), s); |
|
208 |
IGeometry geom = lyrAnnotation.getTextWrappingGeometry(vHeight.floatValue(), |
|
209 |
vText.toString(), vRotation.doubleValue(),vType.getValue(),vStyle.intValue(), index, vp); |
|
210 |
f = new DefaultFeature(geom, f.getAttributes(), s); |
|
211 |
edRow = new DefaultRowEdited(f, |
|
212 |
DefaultRowEdited.STATUS_ORIGINAL, index); |
|
218 | 213 |
|
219 |
edRow = new DefaultRowEdited(f, aux.getStatus(), index); |
|
220 |
|
|
221 |
return edRow; |
|
222 |
} |
|
214 |
return edRow; |
|
223 | 215 |
} catch (DriverException e) { |
224 | 216 |
throw new DriverIOException(e); |
225 | 217 |
} |
226 | 218 |
} |
219 |
/** |
|
220 |
* Si se intenta modificar una geometr?a original de la capa en edici?n se |
|
221 |
* a?ade al fichero de expansi?n y se registra la posici?n en la que se |
|
222 |
* a?adi?. Si se intenta modificar una geometria que se encuentra en el |
|
223 |
* fichero de expansi?n (por ser nueva o original pero modificada) se invoca |
|
224 |
* el m?todo modifyGeometry y se actualiza el ?ndice de la geometria en el |
|
225 |
* fichero. |
|
226 |
* |
|
227 |
* @param calculatedIndex |
|
228 |
* DOCUMENT ME! |
|
229 |
* @param feat |
|
230 |
* DOCUMENT ME! |
|
231 |
* |
|
232 |
* @return position inside ExpansionFile |
|
233 |
* |
|
234 |
* @throws IOException |
|
235 |
* @throws DriverIOException |
|
236 |
*/ |
|
237 |
public int doModifyRow(int calculatedIndex, IRow feat, int sourceType) |
|
238 |
throws IOException, DriverIOException { |
|
239 |
boolean cancel = fireBeforeModifyRow(feat, calculatedIndex, sourceType); |
|
240 |
if (cancel) |
|
241 |
return -1; |
|
242 |
int posAnteriorInExpansionFile = -1; |
|
243 |
Integer integer = new Integer(calculatedIndex); |
|
244 |
|
|
245 |
IFeature featAnt = null; |
|
246 |
IGeometry geom; |
|
247 |
// ViewPort vp=lyrAnnotation.getMapContext().getViewPort(); |
|
248 |
Rectangle2D rec=((DefaultFeature)feat).getGeometry().getBounds2D(); |
|
249 |
geom = ShapeFactory.createPoint2D(rec.getX(),rec.getY()); |
|
250 |
Value[] values=feat.getAttributes(); |
|
251 |
feat = new DefaultFeature(geom, values, feat.getID()); |
|
252 |
if (!relations.containsKey(integer)) { |
|
253 |
int newPosition = expansionFile.addRow(feat, |
|
254 |
IRowEdited.STATUS_MODIFIED, actualIndexFields); |
|
255 |
relations.put(integer, new Integer(newPosition)); |
|
256 |
|
|
257 |
if (sourceType == EditionEvent.GRAPHIC) { |
|
258 |
// Se actualiza el ?ndice espacial |
|
259 |
try { |
|
260 |
featAnt = (DefaultFeature) (ova.getFeature(calculatedIndex)); |
|
261 |
} catch (DriverException e) { |
|
262 |
e.printStackTrace(); |
|
263 |
} |
|
264 |
IGeometry g = featAnt.getGeometry(); |
|
265 |
Rectangle2D rAnt = g.getBounds2D(); |
|
266 |
Rectangle2D r = ((IFeature) feat).getGeometry().getBounds2D(); |
|
267 |
this.index.remove(new Envelope(rAnt.getX(), rAnt.getX() |
|
268 |
+ rAnt.getWidth(), rAnt.getY(), rAnt.getY() |
|
269 |
+ rAnt.getHeight()), new Integer(calculatedIndex)); |
|
270 |
this.index.insert(new Envelope(r.getX(), r.getX() |
|
271 |
+ r.getWidth(), r.getY(), r.getY() + r.getHeight()), |
|
272 |
new Integer(calculatedIndex)); |
|
273 |
} |
|
274 |
} else { |
|
275 |
// Obtenemos el ?ndice en el fichero de expansi?n |
|
276 |
int num = ((Integer) relations.get(integer)).intValue(); |
|
277 |
posAnteriorInExpansionFile = num; |
|
278 |
|
|
279 |
// Obtenemos la geometr?a para actualiza el ?ndice |
|
280 |
// espacialposteriormente |
|
281 |
featAnt = (IFeature) expansionFile.getRow(num).getLinkedRow(); |
|
282 |
|
|
283 |
/* |
|
284 |
* Se modifica la geometr?a y nos guardamos el ?ndice dentro del |
|
285 |
* fichero de expansi?n en el que se encuentra la geometr?a |
|
286 |
* modificada |
|
287 |
*/ |
|
288 |
num = expansionFile.modifyRow(num, feat, actualIndexFields); |
|
289 |
|
|
290 |
/* |
|
291 |
* Actualiza la relaci?n del ?ndice de la geometr?a al ?ndice en el |
|
292 |
* fichero de expansi?n. |
|
293 |
*/ |
|
294 |
relations.put(integer, new Integer(num)); |
|
295 |
if (sourceType == EditionEvent.GRAPHIC) { |
|
296 |
// Se modifica el ?ndice espacial |
|
297 |
Rectangle2D rAnt = featAnt.getGeometry().getBounds2D(); |
|
298 |
Rectangle2D r = ((IFeature) feat).getGeometry().getBounds2D(); |
|
299 |
this.index.remove(new Envelope(rAnt.getX(), rAnt.getX() |
|
300 |
+ rAnt.getWidth(), rAnt.getY(), rAnt.getY() |
|
301 |
+ rAnt.getHeight()), new Integer(calculatedIndex)); |
|
302 |
this.index.insert(new Envelope(r.getX(), r.getX() |
|
303 |
+ r.getWidth(), r.getY(), r.getY() + r.getHeight()), |
|
304 |
new Integer(calculatedIndex)); |
|
305 |
} |
|
306 |
} |
|
307 |
isFullExtentDirty = true; |
|
308 |
fireAfterModifyRow(calculatedIndex, sourceType); |
|
309 |
return posAnteriorInExpansionFile; |
|
310 |
} |
|
311 |
|
|
227 | 312 |
} |
branches/v10/extensions/extAnnotations/src/com/iver/cit/gvsig/fmap/layers/Annotation_Layer.java | ||
---|---|---|
103 | 103 |
private int indexEditing = -1; |
104 | 104 |
private Annotation_Legend aLegend; |
105 | 105 |
private Strategy strategy = null; |
106 |
|
|
106 |
private static AffineTransform ati=new AffineTransform(); |
|
107 | 107 |
/** |
108 | 108 |
* Crea un nuevo FLyrAnnotation. |
109 | 109 |
*/ |
... | ... | |
531 | 531 |
* @throws DriverIOException DOCUMENT ME! |
532 | 532 |
*/ |
533 | 533 |
public IGeometry getTextWrappingGeometry(float height, String description, |
534 |
double rotation, int numReg, ViewPort vp) throws DriverIOException { |
|
534 |
double rotation, String type, int style, int numReg, ViewPort vp) throws DriverIOException {
|
|
535 | 535 |
ReadableVectorial adapter = getSource(); |
536 | 536 |
ICoordTrans ct = getCoordTrans(); |
537 | 537 |
IGeometry geom = adapter.getShape(numReg); |
... | ... | |
561 | 561 |
h = vp.toMapDistance((int) (height)); |
562 | 562 |
} |
563 | 563 |
|
564 |
Font font = new Font("Arial", 0,
|
|
564 |
Font font = new Font(type, style,
|
|
565 | 565 |
(int) (h * FConstant.FONT_HEIGHT_SCALE_FACTOR)); |
566 |
FontRenderContext frc = new FontRenderContext(new AffineTransform(),
|
|
566 |
FontRenderContext frc = new FontRenderContext(ati,
|
|
567 | 567 |
false, true); |
568 | 568 |
GlyphVector gv = font.createGlyphVector(frc, description); |
569 | 569 |
|
... | ... | |
580 | 580 |
return geomResult; |
581 | 581 |
} |
582 | 582 |
public IGeometry getTextWrappingGeometryInPixels(float height, String description, |
583 |
double rotation, int numReg,ViewPort vp) throws DriverIOException { |
|
583 |
double rotation, String type, int style, int numReg,ViewPort vp) throws DriverIOException {
|
|
584 | 584 |
ReadableVectorial adapter = getSource(); |
585 | 585 |
ICoordTrans ct = getCoordTrans(); |
586 | 586 |
IGeometry geom = adapter.getShape(numReg); |
... | ... | |
605 | 605 |
} |
606 | 606 |
p=new Point2D.Double(r.getCenterX(),r.getCenterY()); |
607 | 607 |
|
608 |
double h = height; |
|
609 |
|
|
610 | 608 |
if (!((FSymbol) getLegend().getDefaultSymbol()).isFontSizeInPixels()) { |
611 |
h = vp.fromMapDistance((int) (height)); |
|
609 |
height = vp.fromMapDistance((int) (height));
|
|
612 | 610 |
} |
613 | 611 |
|
614 |
Font font = new Font("Arial", 0,
|
|
615 |
(int) (h * FConstant.FONT_HEIGHT_SCALE_FACTOR)); |
|
616 |
FontRenderContext frc = new FontRenderContext(new AffineTransform(),
|
|
612 |
Font font = new Font(type, style,
|
|
613 |
(int) (height * FConstant.FONT_HEIGHT_SCALE_FACTOR));
|
|
614 |
FontRenderContext frc = new FontRenderContext(ati,
|
|
617 | 615 |
false, true); |
618 | 616 |
GlyphVector gv = font.createGlyphVector(frc, description); |
619 |
Shape shape = gv.getOutline((float) p.getX(), (float) (p.getY() + h)); |
|
617 |
Shape shape = gv.getOutline((float) p.getX(), (float) (p.getY() + height));
|
|
620 | 618 |
|
621 | 619 |
IGeometry geomResult = ShapeFactory.createPolygon2D(new GeneralPathX( |
622 | 620 |
shape.getBounds2D())); |
branches/v10/extensions/extAnnotations/src/com/iver/cit/gvsig/fmap/operation/strategies/Annotation_Strategy.java | ||
---|---|---|
98 | 98 |
private FSymbol symbolPoint = new FSymbol(FShape.POINT, Color.black); |
99 | 99 |
private Annotation_Layer capa; |
100 | 100 |
private Geometry geometry; |
101 |
private AffineTransform ati=new AffineTransform(); |
|
101 |
private static AffineTransform ati=new AffineTransform();
|
|
102 | 102 |
/** |
103 | 103 |
* Crea un nuevo AnotationStrategy. |
104 | 104 |
* |
... | ... | |
110 | 110 |
symbolPoint.setSize(5); |
111 | 111 |
} |
112 | 112 |
|
113 |
// /** |
|
114 |
// * @see |
|
115 |
// com.iver.cit.gvsig.fmap.operations.LayerOperations#draw(java.awt.image.BufferedImage, |
|
116 |
// * java.awt.Graphics2D, ISymbol) |
|
117 |
// */ |
|
118 |
// public void draw(BufferedImage image, Graphics2D g, ViewPort viewPort, |
|
119 |
// Cancellable cancel) throws DriverException { |
|
120 |
// Annotation_Legend l = (Annotation_Legend) capa.getLegend(); |
|
121 |
// FSymbol sym = (FSymbol) l.getDefaultSymbol(); |
|
122 |
// |
|
123 |
// Rectangle2D elExtent = viewPort.getAdjustedExtent(); |
|
124 |
// List lstIndexes=null; |
|
125 |
// |
|
126 |
// try { |
|
127 |
// int sc; |
|
128 |
// ReadableVectorial source = capa.getSource(); |
|
129 |
// sc=source.getShapeCount(); |
|
130 |
// |
|
131 |
// SelectableDataSource recordSet = source.getRecordset(); |
|
132 |
// FBitSet bitSet=recordSet.getSelection(); |
|
133 |
// // If area of needed extent is less than fullExtent / 4, |
|
134 |
// // it will be worthy to use SpatialIndex. |
|
135 |
// // Otherwhise, we will not use it. |
|
136 |
// boolean bUseSpatialIndex = false; |
|
137 |
// if(capa.getISpatialIndex() != null) |
|
138 |
// { |
|
139 |
// if(isSpatialIndexNecessary(elExtent)){ |
|
140 |
// lstIndexes = capa.getISpatialIndex().query(elExtent); |
|
141 |
// sc = lstIndexes.size(); |
|
142 |
// System.out.println("LISTA DEL SPATIALINDEX.SIZE = " + sc); |
|
143 |
// bUseSpatialIndex = true; |
|
144 |
// }//if |
|
145 |
// }//if |
|
146 |
// FontMetrics metrics = g.getFontMetrics(); |
|
147 |
// Annotation_Mapping mapping = ((Annotation_Layer) capa) |
|
148 |
// .getMapping(); |
|
149 |
// int idHeightField = mapping.getColumnHeight(); |
|
150 |
// int idFontName = mapping.getColumnTypeFont(); |
|
151 |
// int idFontStyle = mapping.getColumnStyleFont(); |
|
152 |
// int idRotationField = mapping.getColumnRotate(); |
|
153 |
// int idFontColor = mapping.getColumnColor(); |
|
154 |
// int idTextField = mapping.getColumnText(); |
|
155 |
// |
|
156 |
// double rotation = 0D; |
|
157 |
// double size = sym.getFont().getSize(); |
|
158 |
// sym.setFontSizeInPixels(((Annotation_Layer)capa).isInPixels()); |
|
159 |
// String fontName = "Dialog"; |
|
160 |
// int fontStyle = sym.getFont().getStyle(); |
|
161 |
// int fontColor = sym.getFontColor().getRGB(); |
|
162 |
// SpatialCache cache = capa.getSpatialCache(); |
|
163 |
// cache.clearAll(); |
|
164 |
// int numOriginal; |
|
165 |
// for (int numReg = 0; numReg < sc; numReg++) { |
|
166 |
// if (cancel.isCanceled()){ |
|
167 |
// break; |
|
168 |
// } |
|
169 |
// if (bUseSpatialIndex){ |
|
170 |
// Integer idRec = (Integer) lstIndexes.get(numReg); |
|
171 |
// numOriginal = idRec.intValue(); |
|
172 |
// }else{ |
|
173 |
// numOriginal = numReg; |
|
174 |
// } |
|
175 |
// Value[] vv = recordSet.getRow(numOriginal); |
|
176 |
// if (idHeightField != -1) { |
|
177 |
// // text size is defined in the table |
|
178 |
// try { |
|
179 |
// size = ((NumericValue) vv[idHeightField]).doubleValue() |
|
180 |
// * FConstant.FONT_HEIGHT_SCALE_FACTOR; |
|
181 |
// } catch (ClassCastException ccEx) { |
|
182 |
// if (!NullValue.class.equals(vv[idHeightField] |
|
183 |
// .getClass())) { |
|
184 |
// // throw new ReadDriverException("Unknown", ccEx); |
|
185 |
// } |
|
186 |
// // a null value |
|
187 |
// // Logger.getAnonymousLogger(). |
|
188 |
// // warning("Null text height value for text |
|
189 |
// // '"+vv[idTextField].toString()+"'"); |
|
190 |
// continue; |
|
191 |
// } |
|
192 |
// } else { |
|
193 |
// // otherwise will use the size in the symbol |
|
194 |
// |
|
195 |
// } |
|
196 |
// |
|
197 |
// // size = CartographicSupportToolkit. |
|
198 |
// // toScreenUnitYAxis(size, |
|
199 |
// // unit, |
|
200 |
// // viewPort |
|
201 |
// // ); |
|
202 |
// |
|
203 |
// // if (size <= 3) { |
|
204 |
// // // label is too small to be readable, will be skipped |
|
205 |
// // // this speeds up the rendering in wider zooms |
|
206 |
// // continue; |
|
207 |
// // } |
|
208 |
// |
|
209 |
// |
|
210 |
// if (idFontName != -1) { |
|
211 |
// fontName = ((StringValue) vv[idFontName]).toString(); |
|
212 |
// } |
|
213 |
// |
|
214 |
// |
|
215 |
// if (idFontStyle != -1) { |
|
216 |
// fontStyle = ((NumericValue) vv[idFontStyle]).intValue(); |
|
217 |
// } |
|
218 |
// |
|
219 |
// |
|
220 |
// |
|
221 |
// if (idRotationField != -1) { |
|
222 |
// // text rotation is defined in the table |
|
223 |
// rotation = ((NumericValue) vv[idRotationField]) |
|
224 |
// .doubleValue(); |
|
225 |
// } |
|
226 |
// |
|
227 |
// |
|
228 |
// if (idFontColor != -1) { |
|
229 |
// // text rotation is defined in the table |
|
230 |
// fontColor = ((NumericValue) vv[idFontColor]).intValue(); |
|
231 |
// sym.setFontColor(new Color(fontColor)); |
|
232 |
// } |
|
233 |
// |
|
234 |
// if (bitSet.get(numOriginal)){ |
|
235 |
// sym = (FSymbol)sym.getSymbolForSelection(); |
|
236 |
// } |
|
237 |
// IGeometry geom = source.getShape(numOriginal); |
|
238 |
// |
|
239 |
// sym.setFont(new Font(fontName, fontStyle, (int) size)); |
|
240 |
// |
|
241 |
// |
|
242 |
// // sym.setDescription(vv[idTextField].toString()); |
|
243 |
// // sym.setRotation((int) rotation); |
|
244 |
// FLabel[] aux = geom.createLabels(0, true); |
|
245 |
// aux[0].setHeight(size); |
|
246 |
// aux[0].setRotation((int) rotation); |
|
247 |
// aux[0].setString(vv[idTextField].toString()); |
|
248 |
// symbolPoint.draw((Graphics2D)g,viewPort.getAffineTransform(),new |
|
249 |
// FPoint2D(viewPort.fromMapPoint(aux[0].getOrig()))); |
|
250 |
// FGraphicUtilities.DrawAnnotation(g, viewPort |
|
251 |
// .getAffineTransform(), sym, aux[0], metrics, false); |
|
252 |
// } |
|
253 |
// |
|
254 |
// // System.out.println("..................Fin del dibujado |
|
255 |
// .............."); |
|
256 |
// } catch (DriverIOException e) { |
|
257 |
// e.printStackTrace(); |
|
258 |
// } catch (DriverException e) { |
|
259 |
// // TODO Auto-generated catch block |
|
260 |
// e.printStackTrace(); |
|
261 |
// } |
|
262 |
// heightDefault=-1; |
|
263 |
// } |
|
264 | 113 |
public void draw(BufferedImage image, Graphics2D g, ViewPort viewPort, |
265 | 114 |
Cancellable cancel) { |
266 |
// geometry=null; |
|
267 | 115 |
BufferedImage bi=new BufferedImage(image.getWidth(),image.getHeight(),BufferedImage.TYPE_INT_ARGB); |
268 | 116 |
Graphics2D gBi=(Graphics2D)bi.getGraphics(); |
269 | 117 |
Point2D offset=viewPort.getOffset(); |
270 | 118 |
gBi.translate(-offset.getX(),-offset.getY()); |
271 |
// Copia draw AttrInTableLabeling |
|
272 | 119 |
Annotation_Legend l = (Annotation_Legend) capa.getLegend(); |
273 | 120 |
FSymbol sym = (FSymbol) l.getDefaultSymbol(); |
274 | 121 |
|
275 | 122 |
try { |
276 | 123 |
ReadableVectorial source = capa.getSource(); |
277 |
|
|
278 | 124 |
// limit the labeling to the visible extent |
279 | 125 |
FBitSet bs = capa.queryByRect(viewPort.getAdjustedExtent()); |
280 | 126 |
|
... | ... | |
292 | 138 |
double rotation = 0D; |
293 | 139 |
float size = sym.getFont().getSize(); |
294 | 140 |
|
295 |
// sym.setFontSizeInPixels(((Annotation_Layer) capa).isInPixels()); |
|
296 | 141 |
String fontName = "Dialog"; |
297 | 142 |
int fontStyle = sym.getFont().getStyle(); |
298 | 143 |
int fontColor = sym.getFontColor().getRGB(); |
... | ... | |
316 | 161 |
} |
317 | 162 |
continue; |
318 | 163 |
} |
319 |
} else { |
|
320 |
// otherwise will use the size in the symbol |
|
321 | 164 |
} |
322 | 165 |
|
323 | 166 |
if (idFontName != -1) { |
... | ... | |
348 | 191 |
//Si el tama?o de la fuente est? en unidades de mapa. |
349 | 192 |
if (!sym.isFontSizeInPixels()){ |
350 | 193 |
boolean draw=false; |
351 |
Rectangle2D r=capa.getTextWrappingGeometry(size,vv[idTextField].toString(),rotation,i,viewPort).getBounds2D(); |
|
194 |
Rectangle2D r=capa.getTextWrappingGeometry(size,vv[idTextField].toString(),rotation,fontName, fontStyle,i,viewPort).getBounds2D();
|
|
352 | 195 |
Rectangle2D rPixels=viewPort.fromMapRectangle(r); |
353 | 196 |
//Point2D fp=new Point2D.Double(r.getX(),r.getY()); |
354 | 197 |
Point2D p=new Point2D.Double(rPixels.getX(),rPixels.getY()); |
... | ... | |
373 | 216 |
aux[0].setHeight(size); |
374 | 217 |
aux[0].setRotation((int) rotation); |
375 | 218 |
aux[0].setString(vv[idTextField].toString()); |
376 |
|
|
219 |
AffineTransform at = viewPort.getAffineTransform(); |
|
377 | 220 |
if (sym.isShapeVisible()) { |
378 | 221 |
symbolPoint.draw(gBi, |
379 |
viewPort.getAffineTransform(),
|
|
222 |
at,
|
|
380 | 223 |
fpPixels); |
381 | 224 |
} |
382 | 225 |
// g.drawRect((int)rPixels.getX(),(int)rPixels.getY(),(int)rPixels.getWidth(),(int)rPixels.getHeight()); |
383 | 226 |
FGraphicUtilities.DrawAnnotation(gBi, |
384 |
viewPort.getAffineTransform(), sym, aux[0], metrics, false);
|
|
227 |
at, sym, aux[0], metrics, false);
|
|
385 | 228 |
} |
386 | 229 |
}else{ |
387 | 230 |
|
388 | 231 |
// Si el tama?o de la fuente est? en pixels. |
389 | 232 |
boolean draw=false; |
390 |
Rectangle2D r=capa.getTextWrappingGeometryInPixels(size,vv[idTextField].toString(),rotation,i,viewPort).getBounds2D(); |
|
233 |
Rectangle2D r=capa.getTextWrappingGeometryInPixels(size,vv[idTextField].toString(),rotation,fontName,fontStyle,i,viewPort).getBounds2D();
|
|
391 | 234 |
Rectangle2D rPixels=r;//capa.getMapContext().getViewPort().fromMapRectangle(r); |
392 | 235 |
FPoint2D fp=new FPoint2D(rPixels.getX(),rPixels.getY()); |
393 | 236 |
Point2D p=new Point2D.Double(rPixels.getX(),rPixels.getY()); |
... | ... | |
882 | 725 |
mapping.getColumnRotate()); |
883 | 726 |
NumericValue vHeight = (NumericValue) sds.getFieldValue(index, |
884 | 727 |
mapping.getColumnHeight()); |
728 |
NumericValue vStyle = (NumericValue) sds.getFieldValue(index,mapping.getColumnStyleFont()); |
|
729 |
StringValue vType = (StringValue) sds.getFieldValue(index,mapping.getColumnTypeFont()); |
|
885 | 730 |
Value vText = sds.getFieldValue(index, |
886 | 731 |
mapping.getColumnText()); |
887 | 732 |
IGeometry geom = ((Annotation_Layer) capa).getTextWrappingGeometry(vHeight.floatValue(), |
888 |
vText.toString(), vRotation.doubleValue(), index, vp); |
|
733 |
vText.toString(), vRotation.doubleValue(),vType.getValue(),vStyle.intValue(), index, vp);
|
|
889 | 734 |
|
890 | 735 |
if (ct != null) { |
891 | 736 |
if (bMustClone) { |
... | ... | |
1024 | 869 |
|
1025 | 870 |
//Si el tama?o de la fuente est? en unidades de mapa. |
1026 | 871 |
if (!sym.isFontSizeInPixels()){ |
1027 |
Rectangle2D r=capa.getTextWrappingGeometry(size,vv[idTextField].toString(),rotation,i,vp).getBounds2D(); |
|
872 |
Rectangle2D r=capa.getTextWrappingGeometry(size,vv[idTextField].toString(),rotation,fontName,fontStyle,i,vp).getBounds2D();
|
|
1028 | 873 |
Rectangle2D rPixels=viewPort.fromMapRectangle(r); |
1029 | 874 |
Point2D p = vp.fromMapPoint((int)r.getX(),(int)r.getY()); |
1030 | 875 |
FPoint2D fpPixels=new FPoint2D(rPixels.getX(),rPixels.getY()); |
... | ... | |
1044 | 889 |
viewPort.getAffineTransform(), sym, aux[0], metrics, false); |
1045 | 890 |
}else{ |
1046 | 891 |
// Si el tama?o de la fuente est? en pixels. |
1047 |
Rectangle2D r=capa.getTextWrappingGeometryInPixels(size,vv[idTextField].toString(),rotation,i,viewPort).getBounds2D(); |
|
892 |
Rectangle2D r=capa.getTextWrappingGeometryInPixels(size,vv[idTextField].toString(),rotation,fontName,fontStyle,i,viewPort).getBounds2D();
|
|
1048 | 893 |
Rectangle2D rPixels=r;//capa.getMapContext().getViewPort().fromMapRectangle(r); |
1049 | 894 |
FPoint2D fp=new FPoint2D(rPixels.getX(),rPixels.getY()); |
1050 | 895 |
Point2D p=new Point2D.Double(rPixels.getX(),rPixels.getY()); |
Also available in: Unified diff