Revision 44241

View differences:

trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.api/src/main/java/org/gvsig/fmap/geom/GeometryUtils.java
25 25

  
26 26
import java.util.logging.Level;
27 27
import java.util.logging.Logger;
28
import org.apache.commons.lang3.StringUtils;
28 29
import org.cresques.cts.IProjection;
29 30
import org.gvsig.fmap.geom.aggregate.MultiLine;
30 31
import org.gvsig.fmap.geom.aggregate.MultiPolygon;
......
216 217
        }
217 218
    }
218 219

  
219
    
220
    public static int getGeometryType(String typeName) {
221
        if( StringUtils.isBlank(typeName) ) {
222
            return Geometry.TYPES.UNKNOWN;
223
        }
224
        switch(typeName.toLowerCase()) {
225
            case "geometry":
226
                return Geometry.TYPES.GEOMETRY;
227
            case "point":
228
                    return Geometry.TYPES.POINT;
229
            case "curve":
230
                    return Geometry.TYPES.CURVE;
231
            case "surface":
232
                    return Geometry.TYPES.SURFACE;
233
            case "solid":
234
                    return Geometry.TYPES.SOLID;
235
            case "aggregate":
236
                    return Geometry.TYPES.AGGREGATE;
237
            case "multipoint":
238
                    return Geometry.TYPES.MULTIPOINT;
239
            case "multicurve":
240
                    return Geometry.TYPES.MULTICURVE;
241
            case "multisurface":
242
                    return Geometry.TYPES.MULTISURFACE;
243
            case "multisolid":
244
                    return Geometry.TYPES.MULTISOLID;
245
            case "circle":
246
                    return Geometry.TYPES.CIRCLE;
247
            case "arc":
248
                    return Geometry.TYPES.ARC;
249
            case "ellipse":
250
                    return Geometry.TYPES.ELLIPSE;
251
            case "spline":
252
                    return Geometry.TYPES.SPLINE;
253
            case "ellipticarc":
254
                    return Geometry.TYPES.ELLIPTICARC;
255
            case "complex":
256
                    return Geometry.TYPES.COMPLEX;
257
            case "line":
258
                    return Geometry.TYPES.LINE;
259
            case "polygon":
260
                    return Geometry.TYPES.POLYGON;
261
            case "ring":
262
                    return Geometry.TYPES.RING;
263
            case "multiline":
264
                    return Geometry.TYPES.MULTILINE;
265
            case "multipolygon":
266
                    return Geometry.TYPES.MULTIPOLYGON;
267
            case "circumference":
268
                    return Geometry.TYPES.CIRCUMFERENCE;
269
            case "periellipse":
270
                    return Geometry.TYPES.PERIELLIPSE;
271
            case "filledspline":
272
                    return Geometry.TYPES.FILLEDSPLINE;
273
            default:
274
                return Geometry.TYPES.UNKNOWN;
275
        }
276
    }
277

  
278
    public static int getGeometrySubtype(String subtype) {
279
        if( StringUtils.isBlank(subtype) ) {
280
            return Geometry.SUBTYPES.UNKNOWN;
281
        }
282
        switch(subtype.toUpperCase()) {
283
            case "GEOM2D":
284
            case "2D":
285
                    return Geometry.SUBTYPES.GEOM2D;
286
            case "GEOM3D":
287
            case "3D":
288
                    return Geometry.SUBTYPES.GEOM3D;
289
            case "GEOM2DM":
290
            case "2DM":
291
                    return Geometry.SUBTYPES.GEOM2DM;
292
            case "GEOM3DM":
293
            case "3DM":
294
                    return Geometry.SUBTYPES.GEOM3DM;
295
            default:
296
                return Geometry.SUBTYPES.UNKNOWN;
297
        }
298
    }    
220 299
}

Also available in: Unified diff