svn-gvsig-desktop / tags / v2_0_0_Build_2052 / libraries / libFMap_geometries / src / org / gvsig / fmap / geom / operation / impl / DefaultGeometryOperationLibrary.java @ 38839
History | View | Annotate | Download (6.64 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.operation.impl; |
29 |
|
30 |
import org.gvsig.fmap.geom.Geometry.TYPES; |
31 |
import org.gvsig.fmap.geom.GeometryLibrary; |
32 |
import org.gvsig.fmap.geom.GeometryLocator; |
33 |
import org.gvsig.fmap.geom.GeometryManager; |
34 |
import org.gvsig.fmap.geom.operation.area.Area; |
35 |
import org.gvsig.fmap.geom.operation.distance.PointDistance; |
36 |
import org.gvsig.fmap.geom.operation.ensureOrientation.EnsureOrientation; |
37 |
import org.gvsig.fmap.geom.operation.flip.Flip; |
38 |
import org.gvsig.fmap.geom.operation.fromjts.FromJTS; |
39 |
import org.gvsig.fmap.geom.operation.fromwkb.FromWKB; |
40 |
import org.gvsig.fmap.geom.operation.fromwkt.FromWKT; |
41 |
import org.gvsig.fmap.geom.operation.isCCW.IsCCW; |
42 |
import org.gvsig.fmap.geom.operation.perimeter.Perimeter; |
43 |
import org.gvsig.fmap.geom.operation.perpendicular.Perpendicular; |
44 |
import org.gvsig.fmap.geom.operation.perpendicular.PerpendicularPoint; |
45 |
import org.gvsig.fmap.geom.operation.perpendicular.UnitVector; |
46 |
import org.gvsig.fmap.geom.operation.relationship.Contains; |
47 |
import org.gvsig.fmap.geom.operation.relationship.Crosses; |
48 |
import org.gvsig.fmap.geom.operation.relationship.Disjoint; |
49 |
import org.gvsig.fmap.geom.operation.relationship.Equals; |
50 |
import org.gvsig.fmap.geom.operation.relationship.Intersects; |
51 |
import org.gvsig.fmap.geom.operation.relationship.Out; |
52 |
import org.gvsig.fmap.geom.operation.relationship.Overlaps; |
53 |
import org.gvsig.fmap.geom.operation.relationship.Touches; |
54 |
import org.gvsig.fmap.geom.operation.relationship.Within; |
55 |
import org.gvsig.fmap.geom.operation.tojts.Curve2DToJTS; |
56 |
import org.gvsig.fmap.geom.operation.tojts.MultiCurveToJTS; |
57 |
import org.gvsig.fmap.geom.operation.tojts.MultiPointToJTS; |
58 |
import org.gvsig.fmap.geom.operation.tojts.MultiSurfaceToJTS; |
59 |
import org.gvsig.fmap.geom.operation.tojts.Point2DToJTS; |
60 |
import org.gvsig.fmap.geom.operation.tojts.Surface2DToJTS; |
61 |
import org.gvsig.fmap.geom.operation.tojts.Surface2DToJTSLineString; |
62 |
import org.gvsig.fmap.geom.operation.tojts.ToJTS; |
63 |
import org.gvsig.fmap.geom.operation.towkb.ToWKB; |
64 |
import org.gvsig.fmap.geom.operation.towkb.ToWKBNative; |
65 |
import org.gvsig.fmap.geom.operation.towkt.ToWKT; |
66 |
import org.gvsig.fmap.geom.operation.utils.PointGetAngle; |
67 |
import org.gvsig.tools.library.AbstractLibrary; |
68 |
import org.gvsig.tools.library.LibraryException; |
69 |
|
70 |
/**
|
71 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
|
72 |
*/
|
73 |
public class DefaultGeometryOperationLibrary extends AbstractLibrary { |
74 |
|
75 |
public void doRegistration() { |
76 |
registerAsServiceOf(GeometryLibrary.class); |
77 |
} |
78 |
|
79 |
protected void doInitialize() throws LibraryException { |
80 |
} |
81 |
|
82 |
protected void doPostInitialize() throws LibraryException { |
83 |
|
84 |
// Validate there is any implementation registered.
|
85 |
GeometryManager geometryManager = GeometryLocator.getGeometryManager(); |
86 |
|
87 |
geometryManager.registerGeometryOperation(Contains.NAME, new Contains());
|
88 |
geometryManager.registerGeometryOperation(Crosses.NAME, new Crosses());
|
89 |
geometryManager.registerGeometryOperation(Disjoint.NAME, new Disjoint());
|
90 |
geometryManager.registerGeometryOperation(Equals.NAME, new Equals());
|
91 |
geometryManager.registerGeometryOperation(Intersects.NAME, new Intersects());
|
92 |
geometryManager.registerGeometryOperation(Overlaps.NAME, new Overlaps());
|
93 |
geometryManager.registerGeometryOperation(Touches.NAME, new Touches());
|
94 |
geometryManager.registerGeometryOperation(Within.NAME, new Within());
|
95 |
geometryManager.registerGeometryOperation(IsCCW.NAME, new IsCCW());
|
96 |
geometryManager.registerGeometryOperation(FromWKT.NAME, new FromWKT());
|
97 |
geometryManager.registerGeometryOperation(FromWKB.NAME, new FromWKB());
|
98 |
geometryManager.registerGeometryOperation(Flip.NAME, new Flip());
|
99 |
geometryManager.registerGeometryOperation(EnsureOrientation.NAME, new EnsureOrientation());
|
100 |
geometryManager.registerGeometryOperation(ToWKB.NAME, new ToWKB());
|
101 |
geometryManager.registerGeometryOperation(ToWKBNative.NAME, new ToWKBNative());
|
102 |
geometryManager.registerGeometryOperation(ToWKT.NAME, new ToWKT());
|
103 |
geometryManager.registerGeometryOperation(PointDistance.NAME, new PointDistance(), TYPES.POINT);
|
104 |
geometryManager.registerGeometryOperation(FromJTS.NAME, new FromJTS());
|
105 |
geometryManager.registerGeometryOperation(PointGetAngle.NAME, new PointGetAngle());
|
106 |
geometryManager.registerGeometryOperation(Out.NAME, new Out());
|
107 |
geometryManager.registerGeometryOperation(Area.NAME, new Area()); |
108 |
geometryManager.registerGeometryOperation(Perimeter.NAME, new Perimeter());
|
109 |
geometryManager.registerGeometryOperation(Perpendicular.NAME, new Perpendicular(), TYPES.POINT);
|
110 |
geometryManager.registerGeometryOperation(PerpendicularPoint.NAME, new PerpendicularPoint(), TYPES.POINT);
|
111 |
geometryManager.registerGeometryOperation(UnitVector.NAME, new UnitVector(), TYPES.POINT);
|
112 |
|
113 |
|
114 |
//To JTS
|
115 |
geometryManager.registerGeometryOperation(ToJTS.NAME, new Point2DToJTS(), TYPES.POINT);
|
116 |
geometryManager.registerGeometryOperationBySuperType(ToJTS.NAME, new Curve2DToJTS(), TYPES.CURVE);
|
117 |
geometryManager.registerGeometryOperationBySuperType(ToJTS.NAME, new Surface2DToJTS(), TYPES.SURFACE);
|
118 |
geometryManager.registerGeometryOperation(ToJTS.NAME, new MultiPointToJTS(), TYPES.MULTIPOINT);
|
119 |
geometryManager.registerGeometryOperation(ToJTS.NAME, new MultiCurveToJTS(), TYPES.MULTICURVE);
|
120 |
geometryManager.registerGeometryOperation(ToJTS.NAME, new MultiSurfaceToJTS(), TYPES.MULTISURFACE);
|
121 |
geometryManager.registerGeometryOperation(Surface2DToJTSLineString.NAME, new Surface2DToJTSLineString(), TYPES.SURFACE);
|
122 |
geometryManager.registerGeometryOperation(Surface2DToJTSLineString.NAME, new Surface2DToJTSLineString(), TYPES.MULTISURFACE);
|
123 |
} |
124 |
} |