Statistics
| Revision:

root / branches / v2_0_0_prep / libraries / libFMap_geometries / src / org / gvsig / fmap / geom / impl / DefaultGeometryLibrary.java @ 31221

History | View | Annotate | Download (6.13 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
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 2
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
*/
22

    
23
/*
24
* AUTHORS (In addition to CIT):
25
* 2009 {Iver T.I.}   {Task}
26
*/
27

    
28
package org.gvsig.fmap.geom.impl;
29

    
30
import org.gvsig.fmap.geom.GeometryLocator;
31
import org.gvsig.fmap.geom.GeometryManager;
32
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
33
import org.gvsig.fmap.geom.Geometry.TYPES;
34
import org.gvsig.fmap.geom.aggregate.impl.BaseMultiPrimitive2D;
35
import org.gvsig.fmap.geom.aggregate.impl.MultiCurve2D;
36
import org.gvsig.fmap.geom.aggregate.impl.MultiCurve2DZ;
37
import org.gvsig.fmap.geom.aggregate.impl.MultiPoint2D;
38
import org.gvsig.fmap.geom.aggregate.impl.MultiPoint2DZ;
39
import org.gvsig.fmap.geom.aggregate.impl.MultiSurface2D;
40
import org.gvsig.fmap.geom.operation.GeometryOperation;
41
import org.gvsig.fmap.geom.primitive.impl.Arc2D;
42
import org.gvsig.fmap.geom.primitive.impl.Arc2DZ;
43
import org.gvsig.fmap.geom.primitive.impl.Circle2D;
44
import org.gvsig.fmap.geom.primitive.impl.Circle2DZ;
45
import org.gvsig.fmap.geom.primitive.impl.Curve2D;
46
import org.gvsig.fmap.geom.primitive.impl.Curve2DZ;
47
import org.gvsig.fmap.geom.primitive.impl.DefaultNullGeometry;
48
import org.gvsig.fmap.geom.primitive.impl.Ellipse2D;
49
import org.gvsig.fmap.geom.primitive.impl.Ellipse2DZ;
50
import org.gvsig.fmap.geom.primitive.impl.EllipticArc2D;
51
import org.gvsig.fmap.geom.primitive.impl.EllipticArc2DZ;
52
import org.gvsig.fmap.geom.primitive.impl.Point2D;
53
import org.gvsig.fmap.geom.primitive.impl.Point2DZ;
54
import org.gvsig.fmap.geom.primitive.impl.Solid2DZ;
55
import org.gvsig.fmap.geom.primitive.impl.Spline2D;
56
import org.gvsig.fmap.geom.primitive.impl.Spline2DZ;
57
import org.gvsig.fmap.geom.primitive.impl.Surface2D;
58
import org.gvsig.fmap.geom.primitive.impl.Surface2DZ;
59
import org.gvsig.tools.library.AbstractLibrary;
60
import org.gvsig.tools.library.LibraryException;
61

    
62
/**
63
 * Registers the default implementation for {@link GeometryManager}
64
 *
65
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
66
 */
67
public class DefaultGeometryLibrary extends AbstractLibrary  {
68

    
69
        protected void doInitialize() throws LibraryException {
70
        //Register the default GeometryManager
71
        GeometryLocator.registerGeometryManager(DefaultGeometryManager.class);
72
        }
73

    
74
        protected void doPostInitialize() throws LibraryException {
75
                GeometryManager geometryManager = GeometryLocator.getGeometryManager();
76
                
77
                GeometryOperation.OPERATION_INTERSECTS_CODE =
78
                        GeometryLocator.getGeometryManager().getGeometryOperationCode(
79
                                        GeometryOperation.OPERATION_INTERSECTS_NAME);;
80
                                        
81
                GeometryOperation.OPERATION_CONTAINS_CODE =
82
                        GeometryLocator.getGeometryManager().getGeometryOperationCode(
83
                                        GeometryOperation.OPERATION_CONTAINS_NAME);;
84

    
85
                //Register the geometries in 2D
86
                geometryManager.registerGeometryType(DefaultNullGeometry.class, "Null", TYPES.NULL, SUBTYPES.GEOM2D);
87
                geometryManager.registerGeometryType(Geometry2D.class, "Goemtry2D", TYPES.GEOMETRY, SUBTYPES.GEOM2D);
88
                geometryManager.registerGeometryType(Arc2D.class, "Arc2D", TYPES.ARC, SUBTYPES.GEOM2D);
89
        geometryManager.registerGeometryType(Circle2D.class, "Circle2D", TYPES.CIRCLE, SUBTYPES.GEOM2D);
90
        geometryManager.registerGeometryType(Curve2D.class, "Curve2D", TYPES.CURVE, SUBTYPES.GEOM2D);
91
        geometryManager.registerGeometryType(Ellipse2D.class, "Ellipse2D", TYPES.ELLIPSE, SUBTYPES.GEOM2D);
92
        geometryManager.registerGeometryType(EllipticArc2D.class, "EllipticArc2D", TYPES.ELLIPTICARC, SUBTYPES.GEOM2D);
93
        geometryManager.registerGeometryType(Point2D.class, "Point2D", TYPES.POINT, SUBTYPES.GEOM2D);
94
        geometryManager.registerGeometryType(Spline2D.class, "Spline2D", TYPES.SPLINE, SUBTYPES.GEOM2D);
95
        geometryManager.registerGeometryType(Surface2D.class, "Surface2D", TYPES.SURFACE, SUBTYPES.GEOM2D);
96
        geometryManager.registerGeometryType(BaseMultiPrimitive2D.class, "MultiPrimitive2D", TYPES.AGGREGATE, SUBTYPES.GEOM2D);
97
        geometryManager.registerGeometryType(MultiCurve2D.class, "MultiCurve2D", TYPES.MULTICURVE, SUBTYPES.GEOM2D);
98
        geometryManager.registerGeometryType(MultiCurve2DZ.class, "MultiCurve2DZ", TYPES.MULTICURVE, SUBTYPES.GEOM2DZ);
99
        geometryManager.registerGeometryType(MultiPoint2D.class, "MultiPoint2D", TYPES.MULTIPOINT, SUBTYPES.GEOM2D);
100
        geometryManager.registerGeometryType(MultiSurface2D.class, "MultiSurface", TYPES.MULTISURFACE, SUBTYPES.GEOM2D);
101

    
102
      //Register the geometries in 2DZ
103
                geometryManager.registerGeometryType(DefaultNullGeometry.class, TYPES.NULL, SUBTYPES.GEOM2DZ);
104
        geometryManager.registerGeometryType(Arc2DZ.class, TYPES.ARC, SUBTYPES.GEOM2DZ);
105
        geometryManager.registerGeometryType(Circle2DZ.class, TYPES.CIRCLE, SUBTYPES.GEOM2DZ);
106
        geometryManager.registerGeometryType(Curve2DZ.class, TYPES.CURVE, SUBTYPES.GEOM2DZ);
107
        geometryManager.registerGeometryType(Ellipse2DZ.class, TYPES.ELLIPSE, SUBTYPES.GEOM2DZ);
108
        geometryManager.registerGeometryType(EllipticArc2DZ.class, TYPES.ELLIPTICARC, SUBTYPES.GEOM2DZ);
109
        geometryManager.registerGeometryType(Point2DZ.class, TYPES.POINT, SUBTYPES.GEOM2DZ);
110
        geometryManager.registerGeometryType(Spline2DZ.class, TYPES.SPLINE, SUBTYPES.GEOM2DZ);
111
        geometryManager.registerGeometryType(Surface2DZ.class, TYPES.SURFACE, SUBTYPES.GEOM2DZ);
112
        geometryManager.registerGeometryType(MultiPoint2DZ.class, TYPES.MULTIPOINT, SUBTYPES.GEOM2DZ);
113
        geometryManager.registerGeometryType(Solid2DZ.class, TYPES.SOLID, SUBTYPES.GEOM2DZ);
114
        }
115
}