Revision 43510

View differences:

trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.csv/src/main/java/org/gvsig/fmap/dal/store/csv/CSVStoreProvider.java
622 622
                        if (this.type == DataTypes.GEOMETRY) {
623 623
                            String s = ss[2].trim();
624 624
                            if (s.equalsIgnoreCase("line") || s.equalsIgnoreCase("linestring") || s.equalsIgnoreCase("curve")) {
625
                                this.geometryType = Geometry.TYPES.CURVE;
625
                                this.geometryType = Geometry.TYPES.LINE;
626 626
                            } else if (s.equalsIgnoreCase("multiline") || s.equalsIgnoreCase("multilinestring") || s.equalsIgnoreCase("multicurve")) {
627
                                this.geometryType = Geometry.TYPES.MULTICURVE;
627
                                this.geometryType = Geometry.TYPES.MULTILINE;
628 628
                            } else if (s.equalsIgnoreCase("point")) {
629 629
                                this.geometryType = Geometry.TYPES.POINT;
630 630
                            } else if (s.equalsIgnoreCase("multipoint")) {
......
632 632
                            } else if (s.equalsIgnoreCase("polygon") || s.equalsIgnoreCase("surface")) {
633 633
                                this.geometryType = Geometry.TYPES.POLYGON;
634 634
                            } else if (s.equalsIgnoreCase("multipolygon") || s.equalsIgnoreCase("multisurface")) {
635
                                this.geometryType = Geometry.TYPES.MULTISURFACE;
635
                                this.geometryType = Geometry.TYPES.MULTIPOLYGON;
636 636
                            }
637 637
                            this.size = 1;
638 638
                        } else {
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/pom.xml
14 14
  <modules>
15 15
      <module>org.gvsig.fmap.mapcontext.api</module>
16 16
      <module>org.gvsig.fmap.mapcontext.impl</module>
17
      <!--
17 18
      <module>org.gvsig.fmap.mapcontext.operation</module>
19
      -->
18 20
  </modules>
19 21

  
20 22
  <description>This project contains the core of the map drawer of gvSIG.</description>
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/clipboard/PasteFeaturesFromClipboardExtension.java
259 259

  
260 260
	private boolean simpleTypeOf(GeometryType simplet, GeometryType multit) {
261 261

  
262
		return (multit.getType() == Geometry.TYPES.MULTISURFACE
263
				&& simplet.isTypeOf(Geometry.TYPES.SURFACE))
264
				||
265
				(multit.getType() == Geometry.TYPES.MULTICURVE
266
				&& simplet.isTypeOf(Geometry.TYPES.CURVE))
267
				||
268
				(multit.getType() == Geometry.TYPES.MULTIPOINT
269
				&& simplet.getType() == Geometry.TYPES.POINT);
262
        return (multit.isTypeOf(Geometry.TYPES.MULTISURFACE) && 
263
                simplet.isTypeOf(Geometry.TYPES.SURFACE))
264
               ||
265
               (multit.isTypeOf(Geometry.TYPES.MULTICURVE) && 
266
                simplet.isTypeOf(Geometry.TYPES.CURVE))
267
               ||
268
               (multit.isTypeOf(Geometry.TYPES.MULTIPOINT) && 
269
                simplet.isTypeOf(Geometry.TYPES.POINT));
270 270
	}
271 271

  
272
    @Override
272 273
	public boolean isEnabled() {
273 274

  
274 275
		/*
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/pom.xml
265 265
          <artifactId>org.gvsig.fmap.mapcontext.impl</artifactId>
266 266
          <scope>runtime</scope>
267 267
      </dependency>
268
      <dependency>
268
<!--      <dependency>
269 269
          <groupId>org.gvsig</groupId>
270 270
          <artifactId>org.gvsig.fmap.mapcontext.operation</artifactId>
271 271
          <scope>runtime</scope>
272
      </dependency>
272
      </dependency>-->
273 273
      <dependency>
274 274
          <groupId>org.gvsig</groupId>
275 275
          <artifactId>org.gvsig.metadata.lib.basic.impl</artifactId>
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.selectiontools.app/org.gvsig.selectiontools.app.mainplugin/src/main/java/org/gvsig/selectiontools/app/extension/tools/buffer/process/BufferSelectionProcess.java
23 23
 */
24 24
package org.gvsig.selectiontools.app.extension.tools.buffer.process;
25 25

  
26
/* gvSIG. Geographic Information System of the Valencian Government
27
 *
28
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
29
 * of the Valencian Government (CIT)
30
 * 
31
 * This program is free software; you can redistribute it and/or
32
 * modify it under the terms of the GNU General Public License
33
 * as published by the Free Software Foundation; either version 2
34
 * of the License, or (at your option) any later version.
35
 * 
36
 * This program is distributed in the hope that it will be useful,
37
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
38
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
39
 * GNU General Public License for more details.
40
 *  
41
 * You should have received a copy of the GNU General Public License
42
 * along with this program; if not, write to the Free Software
43
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
44
 * MA  02110-1301, USA.
45
 * 
46
 */
47

  
48 26
import java.awt.event.MouseAdapter;
49 27
import java.awt.event.MouseEvent;
50 28
import java.util.ArrayList;
......
58 36
import org.gvsig.andami.messages.NotificationManager;
59 37
import org.gvsig.andami.ui.mdiManager.IWindow;
60 38
import org.gvsig.app.project.documents.view.gui.IView;
61
import org.gvsig.fmap.dal.DataSet;
62 39
import org.gvsig.fmap.dal.feature.Feature;
63 40
import org.gvsig.fmap.dal.feature.FeatureSelection;
64 41
import org.gvsig.fmap.dal.feature.FeatureSet;
65 42
import org.gvsig.fmap.dal.feature.FeatureStore;
66 43
import org.gvsig.fmap.geom.Geometry;
67
import org.gvsig.fmap.geom.GeometryException;
68
import org.gvsig.fmap.geom.operation.GeometryOperationException;
44
import org.gvsig.fmap.geom.GeometryLocator;
45
import org.gvsig.fmap.geom.GeometryManager;
69 46
import org.gvsig.fmap.mapcontext.MapContext;
70 47
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
71 48
import org.gvsig.fmap.mapcontrol.MapControl;
......
75 52
import org.gvsig.selectiontools.app.extension.tools.buffer.gui.BufferConfigurationPanel;
76 53
import org.gvsig.tools.dispose.DisposableIterator;
77 54

  
78
/**
79
 * 
80
 * 
81
 * @author Pablo Piqueras Bartolom? (pablo.piqueras@iver.es)
82
 */
83 55
public class BufferSelectionProcess extends IncrementableProcess {
84 56

  
85 57
    // private boolean layerWasBeingEdited = false;
......
313 285
                        + " \""
314 286
                        + layer.getName() + "\"");
315 287

  
316
                    switch (layer.getShapeType()) {
317
                    case Geometry.TYPES.POINT:
288
                    GeometryManager geomManager = GeometryLocator.getGeometryManager();
289
                    if( geomManager.isSubtype(Geometry.TYPES.POINT, layer.getShapeType()) ) {
318 290
                        side = point_side;
319
                        break;
320
                    case Geometry.TYPES.CURVE:
321
                    case Geometry.TYPES.MULTICURVE:
291
                        
292
                    } else if( geomManager.isSubtype(Geometry.TYPES.CURVE, layer.getShapeType()) ) {
322 293
                        side = line_side;
323
                        break;
324
                    case Geometry.TYPES.SURFACE:
325
                    case Geometry.TYPES.MULTISURFACE:
294
                        
295
                    } else if( geomManager.isSubtype(Geometry.TYPES.SURFACE, layer.getShapeType()) ) {
326 296
                        side = pol_side;
327
                        break;
328
                    case Geometry.TYPES.MULTIPOINT:
297

  
298
                    } else if( geomManager.isSubtype(Geometry.TYPES.MULTIPOINT, layer.getShapeType()) ) {
329 299
                        side = multi_point_side;
330
                        break;
331
                    default: // UNDEFINED
332
                        // UNSUPPORTED
300
                        
301
                    } else if( geomManager.isSubtype(Geometry.TYPES.MULTICURVE, layer.getShapeType()) ) {
302
                        side = line_side;
303
                        
304
                    } else if( geomManager.isSubtype(Geometry.TYPES.MULTISURFACE, layer.getShapeType()) ) {
305
                        side = pol_side;
306
                    } else {
333 307
                        log.addLine(PluginServices.getText(null,
334 308
                            "Layer_with_unsupported_geometries_type"));
335 309
                        percentage += inc;
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.labeling.app/org.gvsig.labeling.app.mainplugin/src/main/java/org/gvsig/labeling/placements/LinePlacementAtExtremities.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

  
43 26
import java.awt.geom.Point2D;
44 27

  
45 28
import org.apache.batik.ext.awt.geom.PathLength;
46
import org.gvsig.fmap.geom.Geometry;
47 29
import org.gvsig.fmap.geom.Geometry.TYPES;
48 30
import org.gvsig.fmap.geom.GeometryLocator;
49
import org.gvsig.fmap.geom.type.GeometryType;
31
import org.gvsig.fmap.geom.GeometryManager;
50 32
import org.gvsig.fmap.mapcontext.rendering.legend.styling.ILabelClass;
51 33
import org.gvsig.fmap.mapcontext.rendering.legend.styling.IPlacementConstraints;
52 34
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.styling.LabelLocationMetrics;
......
54 36
import org.slf4j.Logger;
55 37
import org.slf4j.LoggerFactory;
56 38

  
57
/**
58
 *
59
 * LinePlacementAtExtremities.java
60
 *
61
 *
62
 * @author jaume dominguez faus - jaume.dominguez@iver.es Dec 17, 2007
63
 *
64
 */
65 39
public class LinePlacementAtExtremities extends AbstractLinePlacement {
66 40

  
67 41
	private static Logger logger =
......
120 94
				true);
121 95
	}
122 96

  
97
    @Override
123 98
	public boolean isSuitableFor(IPlacementConstraints placementConstraints,
124 99
			int shapeType) {
125 100
		
126
		GeometryType gt = null;
127
		
128
		try {
129
			gt = GeometryLocator.getGeometryManager().getGeometryType(
130
					shapeType, Geometry.SUBTYPES.GEOM2D);
131
		} catch (Exception e) {
132
			logger.error("While getting aux geo type.", e);
133
		}
134
		
135
		if (gt.isTypeOf(TYPES.CURVE)
136
				|| shapeType == TYPES.MULTICURVE) {
137
			
101
        GeometryManager geomManager = GeometryLocator.getGeometryManager();
102
        if( geomManager.isSubtype(TYPES.CURVE, shapeType) ||
103
            geomManager.isSubtype(TYPES.MULTICURVE, shapeType) ) {
138 104
			return placementConstraints != null
139 105
					/* && !placementConstraints.isFollowingLine()*/
140 106
					&& (placementConstraints.isAtTheBeginingOfLine()
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.labeling.app/org.gvsig.labeling.app.mainplugin/src/main/java/org/gvsig/labeling/placements/MarkerCenteredAtPoint.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

  
......
59 42
	private static Logger logger =
60 43
			LoggerFactory.getLogger(MarkerCenteredAtPoint.class);
61 44

  
45
    @Override
62 46
	public ArrayList<LabelLocationMetrics> guess(
63 47
			ILabelClass lc, Geometry geom,
64 48
			IPlacementConstraints placementConstraints,
65 49
			double cartographicSymbolSize, Cancellable cancel, ViewPort vp) {
66 50

  
67
		if (cancel.isCanceled()) return CannotPlaceLabel.NO_PLACES;
51
		if (cancel.isCanceled()) {
52
            return CannotPlaceLabel.NO_PLACES;
53
        }
68 54

  
69 55
		Geometry shp = geom.cloneGeometry();
70 56
		shp.transform(vp.getAffineTransform());
......
76 62
		try {
77 63
			cen = shp.centroid();
78 64
		} catch (Exception e) {
79
			logger.error("While gentting centroid.", e);
65
			logger.warn("While gentting centroid.", e);
80 66
		}
81 67
		Point2D p = new Point2D.Double(cen.getX(), cen.getY());
82 68

  
......
87 73
		return guessed;
88 74
	}
89 75

  
76
    @Override
90 77
	public boolean isSuitableFor(IPlacementConstraints placementConstraints,
91 78
			int shapeType) {
92 79
		return false;
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
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
		}
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.labeling.app/org.gvsig.labeling.app.mainplugin/src/main/java/org/gvsig/labeling/placements/PolygonPlacementParallel.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

  
......
50 33
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
51 34
import org.gvsig.fmap.geom.Geometry.TYPES;
52 35
import org.gvsig.fmap.geom.GeometryLocator;
36
import org.gvsig.fmap.geom.GeometryManager;
53 37
import org.gvsig.fmap.geom.primitive.Point;
54
import org.gvsig.fmap.geom.type.GeometryType;
55 38
import org.gvsig.fmap.mapcontext.ViewPort;
56 39
import org.gvsig.fmap.mapcontext.rendering.legend.styling.ILabelClass;
57 40
import org.gvsig.fmap.mapcontext.rendering.legend.styling.IPlacementConstraints;
......
65 48
	private static final Logger logger = LoggerFactory.getLogger(
66 49
			PolygonPlacementParallel.class);
67 50
	
51
    @Override
68 52
	public ArrayList<LabelLocationMetrics> guess(
69 53
			ILabelClass lc, Geometry geom,
70 54
			IPlacementConstraints placementConstraints,
71 55
			double cartographicSymbolSize, Cancellable cancel, ViewPort vp) {
72 56

  
73
		if (cancel.isCanceled()) return CannotPlaceLabel.NO_PLACES;
57
		if (cancel.isCanceled()) {
58
            return CannotPlaceLabel.NO_PLACES;
59
        }
74 60
		
75 61
		double theta = 0;
76 62
		Point start_po = null;
......
82 68
				start_po = geom.centroid();
83 69
			}
84 70
		} catch (Exception exc) {
85
			logger.error("While getting centroid/interior point.", exc);
71
			logger.warn("While getting centroid/interior point.", exc);
86 72
		}
87 73

  
88 74
		Point2D startingPoint = new Point2D.Double(start_po.getX(), start_po.getY());
......
166 152
			auxp = GeometryLocator.getGeometryManager().createPoint(
167 153
					startingPoint.getX(),startingPoint.getY(), SUBTYPES.GEOM2D);
168 154
		} catch (Exception e) {
169
			logger.error("While creating point.", e);
155
			logger.warn("While creating point.", e);
170 156
		}
171 157
		
172 158
		auxp.transform(vp.getAffineTransform());
......
174 160
				new Point2D.Double(auxp.getX(),auxp.getY()), -theta, true));
175 161
		return guessed;
176 162
	}
163
    
164
    @Override
177 165
	public boolean isSuitableFor(IPlacementConstraints placementConstraints,
178 166
			int shapeType) {
179 167
		
180
		GeometryType gt = null;
181
		try {
182
			gt = GeometryLocator.getGeometryManager().getGeometryType(
183
					shapeType, SUBTYPES.GEOM2D);
184
		} catch (Exception e) {
185
			logger.error("While getting geo type.", e);
168
        GeometryManager geomManager = GeometryLocator.getGeometryManager();
169
        if( geomManager.isSubtype(TYPES.SURFACE, shapeType) ||
170
            geomManager.isSubtype(TYPES.MULTISURFACE, shapeType) ) {
171
			return placementConstraints != null && placementConstraints.isParallel();
186 172
		}
187
		
188
		if (gt.isTypeOf(TYPES.SURFACE) || shapeType == TYPES.MULTISURFACE) {
189
			return placementConstraints.isParallel();
190
		}
191 173
		return false;
192 174
	}
193 175

  
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.labeling.app/org.gvsig.labeling.app.mainplugin/src/main/java/org/gvsig/labeling/placements/AbstractLinePlacement.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

  
......
52 35
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.styling.LabelLocationMetrics;
53 36
import org.gvsig.tools.task.Cancellable;
54 37

  
55
/**
56
 *
57
 * AbstractLinePlacement.java
58
 *
59
 *
60
 * @author jaume dominguez faus - jaume.dominguez@iver.es Dec 17, 2007
61
 *
62
 */
63 38
public abstract class AbstractLinePlacement implements ILabelPlacement {
64 39
	public static final double PI = Math.PI;
65 40
	public static final double HALF_PI = PI * 0.5;
66
	private ArrayList<LabelLocationMetrics> guessed =
67
			new ArrayList<LabelLocationMetrics>();
41
	private final ArrayList<LabelLocationMetrics> guessed =
42
			new ArrayList<>();
68 43
	private static final double TOLERANCE = 1E-2;
69 44

  
70 45

  
46
    @Override
71 47
	public ArrayList<LabelLocationMetrics> guess(ILabelClass lc, Geometry geom,
72 48
			IPlacementConstraints pc, double cartographicSymbolSize,
73 49
			Cancellable cancel, ViewPort vp) {
......
81 57

  
82 58
		LabelLocationMetrics initial = initialLocation(lc, pc, pathLen, cancel);
83 59

  
84
		if (cancel.isCanceled()) return CannotPlaceLabel.NO_PLACES;
60
		if (cancel.isCanceled()) {
61
            return CannotPlaceLabel.NO_PLACES;
62
        }
85 63

  
86 64
		double theta = initial.getRotation();
87 65

  
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.labeling.app/org.gvsig.labeling.app.mainplugin/src/main/java/org/gvsig/labeling/placements/MultiShapePlacement.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

  
......
51 34
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.styling.LabelLocationMetrics;
52 35
import org.gvsig.tools.task.Cancellable;
53 36

  
54
/**
55
 *
56
 * MultiShapePlacementConstraints.java
57
 *
58
 *
59
 * @author jaume dominguez faus - jaume.dominguez@iver.es Apr 1, 2008
60
 *
61
 */
62 37
public class MultiShapePlacement implements ILabelPlacement {
63
	private ILabelPlacement pointPlacement;
64
	private ILabelPlacement linePlacement;
65
	private ILabelPlacement polygonPlacement;
38
	private final ILabelPlacement pointPlacement;
39
	private final ILabelPlacement linePlacement;
40
	private final ILabelPlacement polygonPlacement;
66 41

  
67 42

  
68 43
	/**
......
85 60
	}
86 61

  
87 62

  
63
    @Override
88 64
	public ArrayList<LabelLocationMetrics> guess(
89 65
			ILabelClass lc,
90 66
			Geometry geom,
......
116 92
		return CannotPlaceLabel.NO_PLACES;
117 93
	}
118 94

  
95
    @Override
119 96
	public boolean isSuitableFor(
120 97
			IPlacementConstraints placementConstraints,
121 98
			int shapeType) {
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.labeling.app/org.gvsig.labeling.app.mainplugin/src/main/java/org/gvsig/labeling/placements/PolygonPlacementOnCentroid.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

  
......
45 28
import java.util.ArrayList;
46 29

  
47 30
import org.gvsig.fmap.geom.Geometry;
48
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
49 31
import org.gvsig.fmap.geom.Geometry.TYPES;
50 32
import org.gvsig.fmap.geom.GeometryLocator;
33
import org.gvsig.fmap.geom.GeometryManager;
51 34
import org.gvsig.fmap.geom.primitive.Point;
52
import org.gvsig.fmap.geom.type.GeometryType;
53 35
import org.gvsig.fmap.mapcontext.ViewPort;
54 36
import org.gvsig.fmap.mapcontext.rendering.legend.styling.ILabelClass;
55 37
import org.gvsig.fmap.mapcontext.rendering.legend.styling.IPlacementConstraints;
......
58 40
import org.slf4j.Logger;
59 41
import org.slf4j.LoggerFactory;
60 42

  
61
/**
62
 *
63
 * PolygonPlacementOnCentroid.java
64
 *
65
 *
66
 * @author jaume dominguez faus - jaume.dominguez@iver.es Apr 1, 2008
67
 *
68
 */
69
//public class PolygonPlacementOnCentroid extends MarkerCenteredAtPoint implements ILabelPlacement {
70 43
public class PolygonPlacementOnCentroid extends MarkerPlacementOnPoint
71 44
implements ILabelPlacement {
72 45
	
73 46
	private static final Logger logger = LoggerFactory.getLogger(
74 47
			PolygonPlacementOnCentroid.class);
75 48

  
49
    @Override
76 50
	public ArrayList<LabelLocationMetrics> guess(
77 51
			ILabelClass lc, Geometry geom,
78 52
			IPlacementConstraints placementConstraints,
79 53
			double cartographicSymbolSize, Cancellable cancel, ViewPort vp) {
80 54

  
81
		if (cancel.isCanceled()) return CannotPlaceLabel.NO_PLACES;
55
		if (cancel.isCanceled()) {
56
            return CannotPlaceLabel.NO_PLACES;
57
        }
82 58

  
83 59
		Point cen = null;
84 60
		try {
85 61
			cen = geom.centroid();
86 62
		} catch (Exception e) {
87
			logger.error("While getting centroid.", e);
63
			logger.warn("Can't get centroid of geometry.", e);
88 64
		}
89 65
		return super.guess(
90 66
				lc,
......
93 69
				cartographicSymbolSize, cancel,vp);
94 70
	}
95 71

  
72
    @Override
96 73
	public ArrayList<LabelLocationMetrics> guess(
97 74
			ILabelClass lc, Geometry geom,
98 75
			IPlacementConstraints placementConstraints,
99 76
			double cartographicSymbolSize, Cancellable cancel) {
100 77

  
101
		if (cancel.isCanceled()) return CannotPlaceLabel.NO_PLACES;
78
		if (cancel.isCanceled()) {
79
            return CannotPlaceLabel.NO_PLACES;
80
        }
102 81

  
103 82
		ArrayList<LabelLocationMetrics> guessed =
104 83
				new ArrayList<LabelLocationMetrics>();
......
107 86
		try {
108 87
			cen = geom.centroid();
109 88
		} catch (Exception e) {
110
			logger.error("While getting centroid.", e);
89
			logger.warn("While getting centroid.", e);
111 90
		}
112 91
		Point2D p = new Point2D.Double(cen.getX(), cen.getY());
113 92
		Rectangle2D bounds = lc.getBounds();
......
118 97
		return guessed;
119 98
	}
120 99

  
100
    @Override
121 101
	public boolean isSuitableFor(
122 102
			IPlacementConstraints placementConstraints,
123 103
			int shapeType) {
124 104
		
125
		GeometryType gt = null;
126
		try {
127
			gt = GeometryLocator.getGeometryManager().getGeometryType(
128
					shapeType, SUBTYPES.GEOM2D);
129
		} catch (Exception e) {
130
			logger.error("While getting geo type.", e);
131
		}
132
		
133
		if (gt.isTypeOf(TYPES.SURFACE) || shapeType == TYPES.MULTISURFACE) {
134
			return (placementConstraints.isHorizontal()
135
					&&
105
        GeometryManager geomManager = GeometryLocator.getGeometryManager();
106
        if( geomManager.isSubtype(TYPES.SURFACE, shapeType) ||
107
            geomManager.isSubtype(TYPES.MULTISURFACE, shapeType) ) {
108
			return placementConstraints != null && 
109
                    (placementConstraints.isHorizontal() &&
136 110
					!placementConstraints.isFitInsidePolygon());
137 111
		}
138 112
		return false;
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.labeling.app/org.gvsig.labeling.app.mainplugin/src/main/java/org/gvsig/labeling/placements/PolygonPlacementInside.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

  
......
45 28
import java.util.ArrayList;
46 29

  
47 30
import org.gvsig.fmap.geom.Geometry;
48
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
49 31
import org.gvsig.fmap.geom.Geometry.TYPES;
50 32
import org.gvsig.fmap.geom.GeometryLocator;
33
import org.gvsig.fmap.geom.GeometryManager;
51 34
import org.gvsig.fmap.geom.primitive.Point;
52
import org.gvsig.fmap.geom.type.GeometryType;
53 35
import org.gvsig.fmap.mapcontext.ViewPort;
54 36
import org.gvsig.fmap.mapcontext.rendering.legend.styling.ILabelClass;
55 37
import org.gvsig.fmap.mapcontext.rendering.legend.styling.IPlacementConstraints;
......
58 40
import org.slf4j.Logger;
59 41
import org.slf4j.LoggerFactory;
60 42

  
61
/**
62
 *
63
 * PolygonPlacementInside.java
64
 *
65
 *
66
 * @author
67
 *
68
 */
69 43
public class PolygonPlacementInside extends MarkerPlacementOnPoint implements ILabelPlacement {
70 44

  
71 45
	private static final Logger logger =
72 46
			LoggerFactory.getLogger(PolygonPlacementInside.class);
73 47
	
48
    @Override
74 49
	public ArrayList<LabelLocationMetrics> guess(
75 50
			ILabelClass lc, Geometry geom,
76 51
			IPlacementConstraints placementConstraints,
77 52
			double cartographicSymbolSize, Cancellable cancel, ViewPort vp) {
78 53

  
79
		if (cancel.isCanceled()) return CannotPlaceLabel.NO_PLACES;
54
		if (cancel.isCanceled()) {
55
            return CannotPlaceLabel.NO_PLACES;
56
        }
80 57

  
81 58
		Point int_po = null;
82 59
		
......
96 73
				placementConstraints, cartographicSymbolSize, cancel,vp);
97 74
	}
98 75

  
76
    @Override
99 77
	public ArrayList<LabelLocationMetrics> guess(
100 78
			ILabelClass lc, Geometry geom,
101 79
			IPlacementConstraints placementConstraints,
......
119 97
		return guessed;
120 98
	}
121 99

  
100
    @Override
122 101
	public boolean isSuitableFor(IPlacementConstraints placementConstraints,
123 102
			int shapeType) {
124 103
		
125
		GeometryType gt = null;
126
		try {
127
			gt = GeometryLocator.getGeometryManager().getGeometryType(
128
					shapeType, SUBTYPES.GEOM2D);
129
		} catch (Exception e) {
130
			logger.error("While getting geo type.", e);
131
		}
132
		
133
		if (gt.isTypeOf(TYPES.SURFACE) || shapeType == TYPES.MULTISURFACE) {
134
			return (placementConstraints.isFitInsidePolygon() && !placementConstraints.isParallel());
104
        GeometryManager geomManager = GeometryLocator.getGeometryManager();
105
        if( geomManager.isSubtype(TYPES.SURFACE, shapeType) ||
106
            geomManager.isSubtype(TYPES.MULTISURFACE, shapeType) ) {
107
            return placementConstraints != null && 
108
                (placementConstraints.isFitInsidePolygon() && !placementConstraints.isParallel());
135 109
		} else {
136 110
			return false;
137 111
		}
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.labeling.app/org.gvsig.labeling.app.mainplugin/src/main/java/org/gvsig/labeling/placements/CompoundLabelPlacement.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

  
......
49 32
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.styling.LabelLocationMetrics;
50 33
import org.gvsig.tools.task.Cancellable;
51 34

  
52
/**
53
 *
54
 * CompoundLabelPlacement.java
55
 *
56
 *
57
 * @author jaume dominguez faus - jaume.dominguez@iver.es Dec 17, 2007
58
 *
59
 */
60 35
public class CompoundLabelPlacement implements ILabelPlacement {
61
	private ILabelPlacement[] placements;
36
	private final ILabelPlacement[] placements;
62 37

  
63 38
	public CompoundLabelPlacement(ILabelPlacement[] suitablePlacements) {
64 39
		this.placements = suitablePlacements;
65 40
	}
66 41

  
42
    @Override
67 43
	public boolean isSuitableFor(IPlacementConstraints placementConstraints,
68 44
			int shapeType) {
69 45
		return true;
70 46
	}
71 47

  
72 48

  
49
    @Override
73 50
	public ArrayList<LabelLocationMetrics> guess(
74 51
			ILabelClass lc,
75 52
			Geometry geom,
......
78 55
			Cancellable cancel,
79 56
			ViewPort vp) {
80 57
		
81
		ArrayList<LabelLocationMetrics> guessed = new ArrayList<LabelLocationMetrics>();
58
		ArrayList<LabelLocationMetrics> guessed = new ArrayList<>();
82 59
		for (int i = 0; cancel != null && !cancel.isCanceled() && i < placements.length; i++) {
83 60
			guessed.addAll(placements[i].guess(lc, geom, constraints, cartographicSymbolSize, cancel,vp));
84 61
		}
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.labeling.app/org.gvsig.labeling.app.mainplugin/src/main/java/org/gvsig/labeling/placements/ILabelPlacement.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

  
......
50 33
import org.gvsig.tools.task.Cancellable;
51 34

  
52 35

  
53
/**
54
 *
55
 * ILabelPlacement.java
56
 *
57
 *
58
 * @author jaume dominguez faus - jaume.dominguez@iver.es Dec 17, 2007
59
 *
60
 */
61 36
public interface ILabelPlacement {
62 37

  
63 38
	boolean isSuitableFor(IPlacementConstraints placementConstraints, int shapeType);
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.labeling.app/org.gvsig.labeling.app.mainplugin/src/main/java/org/gvsig/labeling/placements/MarkerPlacementOnPoint.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;
......
66 51
			IPlacementConstraints placementConstraints,
67 52
			double cartographicSymbolSize, Cancellable cancel) {
68 53

  
69
		if (cancel.isCanceled()) return CannotPlaceLabel.NO_PLACES;
54
		if (cancel.isCanceled()) {
55
            return CannotPlaceLabel.NO_PLACES;
56
        }
70 57

  
71 58
		ArrayList<LabelLocationMetrics> guessed = new ArrayList<LabelLocationMetrics>();
72 59
		
......
89 76
	}
90 77

  
91 78

  
79
    @Override
92 80
	public ArrayList<LabelLocationMetrics> guess(
93 81
			ILabelClass lc,
94 82
			Geometry geom,
......
121 109
		return guessed;
122 110
	}
123 111

  
112
    @Override
124 113
	public boolean isSuitableFor(
125 114
			IPlacementConstraints placementConstraints,
126 115
			int shapeType) {
127
		
128
		
129
		if (shapeType == TYPES.POINT) {
130
			return placementConstraints.isOnTopOfThePoint();
116
        GeometryManager geomManager = GeometryLocator.getGeometryManager();
117
        if( geomManager.isSubtype(TYPES.POINT, shapeType) ) {
118
			return placementConstraints != null && placementConstraints.isOnTopOfThePoint();
131 119
		} else{
132 120
			return false;
133 121
		}
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.labeling.app/org.gvsig.labeling.app.mainplugin/src/main/java/org/gvsig/labeling/placements/LinePlacementAtBest.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

  
......
45 28
import org.gvsig.fmap.geom.Geometry;
46 29
import org.gvsig.fmap.geom.Geometry.TYPES;
47 30
import org.gvsig.fmap.geom.GeometryLocator;
48
import org.gvsig.fmap.geom.type.GeometryType;
31
import org.gvsig.fmap.geom.GeometryManager;
49 32
import org.gvsig.fmap.mapcontext.ViewPort;
50 33
import org.gvsig.fmap.mapcontext.rendering.legend.styling.ILabelClass;
51 34
import org.gvsig.fmap.mapcontext.rendering.legend.styling.IPlacementConstraints;
......
54 37
import org.slf4j.Logger;
55 38
import org.slf4j.LoggerFactory;
56 39

  
57
/**
58
 *
59
 * LinePlacementAtBest.java
60
 *
61
 *
62
 * @author jaume dominguez faus - jaume.dominguez@iver.es Dec 17, 2007
63
 *
64
 */
65 40
public class LinePlacementAtBest extends CompoundLabelPlacement {
66 41
	
67 42
	private static Logger logger = LoggerFactory.getLogger(LinePlacementAtBest.class);
......
80 55
			Geometry geom, IPlacementConstraints constraints,
81 56
			double cartographicSymbolSize, Cancellable cancel, ViewPort vp) {
82 57
		
83
		if (cancel.isCanceled()) return CannotPlaceLabel.NO_PLACES;
58
		if (cancel.isCanceled()) {
59
            return CannotPlaceLabel.NO_PLACES;
60
        }
84 61

  
85 62
		ArrayList<LabelLocationMetrics> llc = super.guess(lc, geom, constraints, cartographicSymbolSize, cancel,vp);
86 63
		if (constraints instanceof AbstractPlacementConstraints) {
......
98 75
		}
99 76
		return llc;
100 77
	}
78
    @Override
101 79
	public boolean isSuitableFor(
102 80
			IPlacementConstraints placementConstraints,
103 81
			int shapeType) {
104 82
		
105
		GeometryType gt = null;
106
		
107
		try {
108
			gt = GeometryLocator.getGeometryManager().getGeometryType(
109
					shapeType, Geometry.SUBTYPES.GEOM2D);
110
		} catch (Exception e) {
111
			logger.error("While getting aux geo type.", e);
112
		}
113
		
114
		if (gt.isTypeOf(TYPES.CURVE)
115
				|| shapeType == TYPES.MULTICURVE) {
83
        GeometryManager geomManager = GeometryLocator.getGeometryManager();
84
        if( geomManager.isSubtype(TYPES.CURVE, shapeType) ||
85
            geomManager.isSubtype(TYPES.MULTICURVE, shapeType) ) {
116 86
			return placementConstraints != null && placementConstraints.isAtBestOfLine();
117 87
		} else {
118 88
			return false;
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.labeling.app/org.gvsig.labeling.app.mainplugin/src/main/java/org/gvsig/labeling/placements/AbstractPlacementConstraints.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
1 24
package org.gvsig.labeling.placements;
2 25

  
3 26
import org.gvsig.fmap.mapcontext.rendering.legend.styling.IPlacementConstraints;
......
8 31
import org.gvsig.tools.persistence.exception.PersistenceException;
9 32

  
10 33

  
11
/**
12
 * @author  jaume dominguez faus - jaume.dominguez@iver.es
13
 */
14 34
public abstract class AbstractPlacementConstraints implements
15 35
Cloneable, IPlacementConstraints {
16 36
	
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.labeling.app/org.gvsig.labeling.app.mainplugin/src/main/java/org/gvsig/labeling/placements/LinePlacementInTheMiddle.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
 *
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff