root / branches / v2_0_0_prep / libraries / libFMap_geometries / src / org / gvsig / fmap / geom / impl / DefaultGeometryLibrary.java @ 28085
History | View | Annotate | Download (5.86 KB)
1 | 26328 | jpiera | /* 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 | 27042 | jpiera | package org.gvsig.fmap.geom.impl; |
29 | 26328 | jpiera | |
30 | 27042 | jpiera | import org.gvsig.fmap.geom.GeometryLocator; |
31 | import org.gvsig.fmap.geom.GeometryManager; |
||
32 | 26866 | jpiera | import org.gvsig.fmap.geom.Geometry.SUBTYPES; |
33 | import org.gvsig.fmap.geom.Geometry.TYPES; |
||
34 | 27029 | jpiera | 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.MultiPoint2D; |
||
37 | import org.gvsig.fmap.geom.aggregate.impl.MultiPoint2DZ; |
||
38 | import org.gvsig.fmap.geom.aggregate.impl.MultiSurface2D; |
||
39 | import org.gvsig.fmap.geom.primitive.impl.Arc2D; |
||
40 | import org.gvsig.fmap.geom.primitive.impl.Arc2DZ; |
||
41 | import org.gvsig.fmap.geom.primitive.impl.Circle2D; |
||
42 | import org.gvsig.fmap.geom.primitive.impl.Circle2DZ; |
||
43 | import org.gvsig.fmap.geom.primitive.impl.Curve2D; |
||
44 | import org.gvsig.fmap.geom.primitive.impl.Curve2DZ; |
||
45 | 27037 | jpiera | import org.gvsig.fmap.geom.primitive.impl.DefaultNullGeometry; |
46 | 27029 | jpiera | import org.gvsig.fmap.geom.primitive.impl.Ellipse2D; |
47 | import org.gvsig.fmap.geom.primitive.impl.Ellipse2DZ; |
||
48 | import org.gvsig.fmap.geom.primitive.impl.EllipticArc2D; |
||
49 | import org.gvsig.fmap.geom.primitive.impl.EllipticArc2DZ; |
||
50 | import org.gvsig.fmap.geom.primitive.impl.Point2D; |
||
51 | import org.gvsig.fmap.geom.primitive.impl.Point2DZ; |
||
52 | import org.gvsig.fmap.geom.primitive.impl.Solid2DZ; |
||
53 | import org.gvsig.fmap.geom.primitive.impl.Spline2D; |
||
54 | import org.gvsig.fmap.geom.primitive.impl.Spline2DZ; |
||
55 | import org.gvsig.fmap.geom.primitive.impl.Surface2D; |
||
56 | import org.gvsig.fmap.geom.primitive.impl.Surface2DZ; |
||
57 | 26328 | jpiera | import org.gvsig.tools.locator.BaseLibrary; |
58 | import org.gvsig.tools.locator.ReferenceNotRegisteredException; |
||
59 | |||
60 | /**
|
||
61 | * Registers the default implementation for {@link GeometryManager}
|
||
62 | *
|
||
63 | * @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
|
||
64 | */
|
||
65 | 27042 | jpiera | public class DefaultGeometryLibrary extends BaseLibrary { |
66 | 26328 | jpiera | |
67 | /*
|
||
68 | * (non-Javadoc)
|
||
69 | * @see org.gvsig.tools.locator.BaseLibrary#initialize()
|
||
70 | */
|
||
71 | public void initialize() throws ReferenceNotRegisteredException { |
||
72 | super.initialize();
|
||
73 | |||
74 | //Register the default GeometryManager
|
||
75 | 26866 | jpiera | GeometryLocator.registerGeometryManager(DefaultGeometryManager.class); |
76 | } |
||
77 | 26328 | jpiera | |
78 | /*
|
||
79 | * (non-Javadoc)
|
||
80 | * @see org.gvsig.tools.locator.BaseLibrary#postInitialize()
|
||
81 | */
|
||
82 | public void postInitialize() { |
||
83 | super.postInitialize();
|
||
84 | |||
85 | // Validate there is any implementation registered.
|
||
86 | GeometryManager geometryManager = GeometryLocator.getGeometryManager(); |
||
87 | if (geometryManager == null) { |
||
88 | throw new ReferenceNotRegisteredException( |
||
89 | GeometryLocator.GEOMETRY_MANAGER_NAME, GeometryLocator.getInstance()); |
||
90 | 26866 | jpiera | } |
91 | //Register the geometries in 2D
|
||
92 | 27037 | jpiera | geometryManager.registerGeometryType(DefaultNullGeometry.class, TYPES.NULL, SUBTYPES.GEOM2D); |
93 | 28085 | jpiera | geometryManager.registerGeometryType(Geometry2D.class, TYPES.GEOMETRY, SUBTYPES.GEOM2D); |
94 | 26866 | jpiera | geometryManager.registerGeometryType(Arc2D.class, TYPES.ARC, SUBTYPES.GEOM2D);
|
95 | geometryManager.registerGeometryType(Circle2D.class, TYPES.CIRCLE, SUBTYPES.GEOM2D); |
||
96 | geometryManager.registerGeometryType(Curve2D.class, TYPES.CURVE, SUBTYPES.GEOM2D); |
||
97 | geometryManager.registerGeometryType(Ellipse2D.class, TYPES.ELLIPSE, SUBTYPES.GEOM2D);
|
||
98 | geometryManager.registerGeometryType(EllipticArc2D.class, TYPES.ELLIPTICARC, SUBTYPES.GEOM2D); |
||
99 | geometryManager.registerGeometryType(Point2D.class, TYPES.POINT, SUBTYPES.GEOM2D);
|
||
100 | geometryManager.registerGeometryType(Spline2D.class, TYPES.SPLINE, SUBTYPES.GEOM2D); |
||
101 | geometryManager.registerGeometryType(Surface2D.class, TYPES.SURFACE, SUBTYPES.GEOM2D); |
||
102 | geometryManager.registerGeometryType(BaseMultiPrimitive2D.class, TYPES.AGGREGATE, SUBTYPES.GEOM2D); |
||
103 | geometryManager.registerGeometryType(MultiCurve2D.class, TYPES.MULTICURVE, SUBTYPES.GEOM2D); |
||
104 | geometryManager.registerGeometryType(MultiPoint2D.class, TYPES.MULTIPOINT, SUBTYPES.GEOM2D); |
||
105 | geometryManager.registerGeometryType(MultiSurface2D.class, TYPES.MULTISURFACE, SUBTYPES.GEOM2D); |
||
106 | 27019 | jpiera | |
107 | 26866 | jpiera | //Register the geometries in 2DZ
|
108 | 27037 | jpiera | geometryManager.registerGeometryType(DefaultNullGeometry.class, TYPES.NULL, SUBTYPES.GEOM2DZ); |
109 | 26866 | jpiera | geometryManager.registerGeometryType(Arc2DZ.class, TYPES.ARC, SUBTYPES.GEOM2DZ); |
110 | geometryManager.registerGeometryType(Circle2DZ.class, TYPES.CIRCLE, SUBTYPES.GEOM2DZ); |
||
111 | geometryManager.registerGeometryType(Curve2DZ.class, TYPES.CURVE, SUBTYPES.GEOM2DZ); |
||
112 | geometryManager.registerGeometryType(Ellipse2DZ.class, TYPES.ELLIPSE, SUBTYPES.GEOM2DZ); |
||
113 | geometryManager.registerGeometryType(EllipticArc2DZ.class, TYPES.ELLIPTICARC, SUBTYPES.GEOM2DZ); |
||
114 | geometryManager.registerGeometryType(Point2DZ.class, TYPES.POINT, SUBTYPES.GEOM2DZ); |
||
115 | geometryManager.registerGeometryType(Spline2DZ.class, TYPES.SPLINE, SUBTYPES.GEOM2DZ); |
||
116 | geometryManager.registerGeometryType(Surface2DZ.class, TYPES.SURFACE, SUBTYPES.GEOM2DZ); |
||
117 | geometryManager.registerGeometryType(MultiPoint2DZ.class, TYPES.MULTIPOINT, SUBTYPES.GEOM2DZ); |
||
118 | geometryManager.registerGeometryType(Solid2DZ.class, TYPES.SOLID, SUBTYPES.GEOM2DZ); |
||
119 | 27019 | jpiera | |
120 | 26866 | jpiera | } |
121 | 26328 | jpiera | } |