Statistics
| Revision:

svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libFMap_geometries / src / org / gvsig / fmap / geom / GeometryLibrary.java @ 26866

History | View | Annotate | Download (5.35 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;
29

    
30
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
31
import org.gvsig.fmap.geom.Geometry.TYPES;
32
import org.gvsig.fmap.geom.aggregate.BaseMultiPrimitive2D;
33
import org.gvsig.fmap.geom.aggregate.MultiCurve2D;
34
import org.gvsig.fmap.geom.aggregate.MultiPoint2D;
35
import org.gvsig.fmap.geom.aggregate.MultiPoint2DZ;
36
import org.gvsig.fmap.geom.aggregate.MultiSurface2D;
37
import org.gvsig.fmap.geom.primitive.Arc2D;
38
import org.gvsig.fmap.geom.primitive.Arc2DZ;
39
import org.gvsig.fmap.geom.primitive.Circle2D;
40
import org.gvsig.fmap.geom.primitive.Circle2DZ;
41
import org.gvsig.fmap.geom.primitive.Curve2D;
42
import org.gvsig.fmap.geom.primitive.Curve2DZ;
43
import org.gvsig.fmap.geom.primitive.Ellipse2D;
44
import org.gvsig.fmap.geom.primitive.Ellipse2DZ;
45
import org.gvsig.fmap.geom.primitive.EllipticArc2D;
46
import org.gvsig.fmap.geom.primitive.EllipticArc2DZ;
47
import org.gvsig.fmap.geom.primitive.Point2D;
48
import org.gvsig.fmap.geom.primitive.Point2DZ;
49
import org.gvsig.fmap.geom.primitive.Solid;
50
import org.gvsig.fmap.geom.primitive.Solid2DZ;
51
import org.gvsig.fmap.geom.primitive.Spline2D;
52
import org.gvsig.fmap.geom.primitive.Spline2DZ;
53
import org.gvsig.fmap.geom.primitive.Surface2D;
54
import org.gvsig.fmap.geom.primitive.Surface2DZ;
55
import org.gvsig.tools.locator.BaseLibrary;
56
import org.gvsig.tools.locator.ReferenceNotRegisteredException;
57

    
58
/**
59
 * Registers the default implementation for {@link GeometryManager}
60
 * 
61
 * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
62
 */
63
public class GeometryLibrary extends BaseLibrary  {
64
        
65
        /*
66
         * (non-Javadoc)
67
         * @see org.gvsig.tools.locator.BaseLibrary#initialize()
68
         */
69
        public void initialize() throws ReferenceNotRegisteredException {
70
        super.initialize();
71
                
72
        //Register the default GeometryManager
73
        GeometryLocator.registerGeometryManager(DefaultGeometryManager.class);
74
    }
75

    
76
        /*
77
         * (non-Javadoc)
78
         * @see org.gvsig.tools.locator.BaseLibrary#postInitialize()
79
         */
80
        public void postInitialize() {
81
                super.postInitialize();
82

    
83
                // Validate there is any implementation registered.
84
                GeometryManager geometryManager = GeometryLocator.getGeometryManager();
85
                if (geometryManager == null) {
86
                        throw new ReferenceNotRegisteredException(
87
                                        GeometryLocator.GEOMETRY_MANAGER_NAME, GeometryLocator.getInstance());
88
                }        
89
                //Register the geometries in 2D
90
                geometryManager.registerGeometryType(Arc2D.class, TYPES.ARC, SUBTYPES.GEOM2D);
91
        geometryManager.registerGeometryType(Circle2D.class, TYPES.CIRCLE, SUBTYPES.GEOM2D);
92
        geometryManager.registerGeometryType(Curve2D.class, TYPES.CURVE, SUBTYPES.GEOM2D);
93
        geometryManager.registerGeometryType(Ellipse2D.class, TYPES.ELLIPSE, SUBTYPES.GEOM2D);
94
        geometryManager.registerGeometryType(EllipticArc2D.class, TYPES.ELLIPTICARC, SUBTYPES.GEOM2D);
95
        geometryManager.registerGeometryType(Point2D.class, TYPES.POINT, SUBTYPES.GEOM2D);
96
        geometryManager.registerGeometryType(Spline2D.class, TYPES.SPLINE, SUBTYPES.GEOM2D);
97
        geometryManager.registerGeometryType(Surface2D.class, TYPES.SURFACE, SUBTYPES.GEOM2D);
98
        geometryManager.registerGeometryType(BaseMultiPrimitive2D.class, TYPES.AGGREGATE, SUBTYPES.GEOM2D);
99
        geometryManager.registerGeometryType(MultiCurve2D.class, TYPES.MULTICURVE, SUBTYPES.GEOM2D);
100
        geometryManager.registerGeometryType(MultiPoint2D.class, TYPES.MULTIPOINT, SUBTYPES.GEOM2D);
101
        geometryManager.registerGeometryType(MultiSurface2D.class, TYPES.MULTISURFACE, SUBTYPES.GEOM2D);
102
        
103
      //Register the geometries in 2DZ    
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
}
116