Revision 12139
branches/v10/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/v02/FLabel.java | ||
---|---|---|
57 | 57 |
import org.apache.batik.ext.awt.geom.PathLength; |
58 | 58 |
|
59 | 59 |
import com.iver.cit.gvsig.fmap.ViewPort; |
60 |
import com.iver.cit.gvsig.fmap.core.FMultiPoint2D; |
|
60 | 61 |
import com.iver.cit.gvsig.fmap.core.FPoint2D; |
61 | 62 |
import com.iver.cit.gvsig.fmap.core.FShape; |
62 | 63 |
import com.iver.cit.gvsig.fmap.core.ISymbol; |
... | ... | |
321 | 322 |
|
322 | 323 |
return label; |
323 | 324 |
} |
324 |
public static Point2D createLabelPoint(FShape shp) {
|
|
325 |
public static Point2D createLabelPoint(Shape shp) { |
|
325 | 326 |
Point2D pAux = null; |
326 |
|
|
327 |
switch (shp.getShapeType()) {
|
|
327 |
if (shp instanceof FShape){ |
|
328 |
switch (((FShape)shp).getShapeType()) {
|
|
328 | 329 |
case FShape.POINT: |
329 | 330 |
case FShape.POINT + FShape.Z: |
330 | 331 |
pAux = new Point2D.Double(((FPoint2D) shp).getX(), |
... | ... | |
342 | 343 |
|
343 | 344 |
case FShape.POLYGON: |
344 | 345 |
case FShape.POLYGON + FShape.Z: |
345 |
Geometry geo = FConverter.java2d_to_jts(shp); |
|
346 |
Geometry geo = FConverter.java2d_to_jts((FShape)shp);
|
|
346 | 347 |
|
347 | 348 |
if (geo == null) { |
348 | 349 |
return null; |
... | ... | |
356 | 357 |
((FPoint2D) pLabel).getY()); |
357 | 358 |
} |
358 | 359 |
} // switch |
360 |
}else if (shp instanceof FMultiPoint2D){ |
|
361 |
int num=((FMultiPoint2D)shp).getNumPoints(); |
|
362 |
Rectangle2D r=null; |
|
363 |
if (num>0){ |
|
364 |
r= ((FMultiPoint2D)shp).getPoint(0).getBounds2D(); |
|
365 |
for (int i=1;i<num;i++){ |
|
366 |
FPoint2D fp=((FMultiPoint2D)shp).getPoint(i); |
|
367 |
r.add(new Point2D.Double(fp.getX(),fp.getY())); |
|
368 |
} |
|
369 |
} |
|
370 |
if (r!=null) |
|
371 |
return new Point2D.Double(r.getCenterX(),r.getCenterY()); |
|
372 |
} |
|
359 | 373 |
return null; |
360 | 374 |
} |
361 | 375 |
public void setTypeFont(String t) { |
Also available in: Unified diff