Revision 43510 trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.labeling.app/org.gvsig.labeling.app.mainplugin/src/main/java/org/gvsig/labeling/placements/MarkerPlacementAroundPoint.java
MarkerPlacementAroundPoint.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
2 | 3 |
* |
3 |
* Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
|
|
4 |
* Copyright (C) 2007-2013 gvSIG Association.
|
|
4 | 5 |
* |
5 | 6 |
* This program is free software; you can redistribute it and/or |
6 | 7 |
* modify it under the terms of the GNU General Public License |
7 |
* as published by the Free Software Foundation; either version 2
|
|
8 |
* as published by the Free Software Foundation; either version 3
|
|
8 | 9 |
* of the License, or (at your option) any later version. |
9 | 10 |
* |
10 | 11 |
* This program is distributed in the hope that it will be useful, |
... | ... | |
14 | 15 |
* |
15 | 16 |
* You should have received a copy of the GNU General Public License |
16 | 17 |
* along with this program; if not, write to the Free Software |
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
18 | 20 |
* |
19 |
* For more information, contact: |
|
20 |
* |
|
21 |
* Generalitat Valenciana |
|
22 |
* Conselleria d'Infraestructures i Transport |
|
23 |
* Av. Blasco Ib??ez, 50 |
|
24 |
* 46010 VALENCIA |
|
25 |
* SPAIN |
|
26 |
* |
|
27 |
* +34 963862235 |
|
28 |
* gvsig@gva.es |
|
29 |
* www.gvsig.gva.es |
|
30 |
* |
|
31 |
* or |
|
32 |
* |
|
33 |
* IVER T.I. S.A |
|
34 |
* Salamanca 50 |
|
35 |
* 46005 Valencia |
|
36 |
* Spain |
|
37 |
* |
|
38 |
* +34 963163400 |
|
39 |
* dac@iver.es |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
40 | 23 |
*/ |
41 | 24 |
package org.gvsig.labeling.placements; |
42 | 25 |
|
... | ... | |
46 | 29 |
|
47 | 30 |
import org.gvsig.fmap.geom.Geometry; |
48 | 31 |
import org.gvsig.fmap.geom.Geometry.TYPES; |
32 |
import org.gvsig.fmap.geom.GeometryLocator; |
|
33 |
import org.gvsig.fmap.geom.GeometryManager; |
|
49 | 34 |
import org.gvsig.fmap.geom.primitive.Point; |
50 | 35 |
import org.gvsig.fmap.mapcontext.ViewPort; |
51 | 36 |
import org.gvsig.fmap.mapcontext.rendering.legend.styling.ILabelClass; |
... | ... | |
61 | 46 |
LoggerFactory.getLogger(MarkerPlacementAroundPoint.class); |
62 | 47 |
private static final MarkerPlacementOnPoint pos = new MarkerPlacementOnPoint(); |
63 | 48 |
|
49 |
@Override |
|
64 | 50 |
public ArrayList<LabelLocationMetrics> guess( |
65 | 51 |
ILabelClass lc, |
66 | 52 |
Geometry geom, |
67 | 53 |
IPlacementConstraints placementConstraints, |
68 | 54 |
double cartographicSymbolSize, Cancellable cancel, ViewPort vp) { |
69 | 55 |
|
70 |
if (cancel.isCanceled()) return CannotPlaceLabel.NO_PLACES; |
|
56 |
if (cancel.isCanceled()) { |
|
57 |
return CannotPlaceLabel.NO_PLACES; |
|
58 |
} |
|
71 | 59 |
|
72 | 60 |
Geometry shp = geom.cloneGeometry(); |
73 | 61 |
shp.transform(vp.getAffineTransform()); |
... | ... | |
218 | 206 |
|
219 | 207 |
|
220 | 208 |
|
209 |
@Override |
|
221 | 210 |
public boolean isSuitableFor(IPlacementConstraints placementConstraints, |
222 | 211 |
int shapeType) { |
223 | 212 |
|
224 |
if (shapeType == TYPES.POINT |
|
225 |
|| shapeType == TYPES.MULTIPOINT) { |
|
213 |
GeometryManager geomManager = GeometryLocator.getGeometryManager(); |
|
214 |
if( geomManager.isSubtype(TYPES.POINT, shapeType) || |
|
215 |
geomManager.isSubtype(TYPES.MULTIPOINT, shapeType) ) { |
|
226 | 216 |
// TODO (09/01/08) is this correct? if not fix it also in PlacementManager, PlacementProperties |
227 |
return placementConstraints.isAroundThePoint(); |
|
217 |
return placementConstraints != null && placementConstraints.isAroundThePoint();
|
|
228 | 218 |
} else { |
229 | 219 |
return false; |
230 | 220 |
} |
Also available in: Unified diff