svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libFMap_geometries / src / org / gvsig / fmap / geom / aggregate / BaseMultiPrimitive2D.java @ 26866
History | View | Annotate | Download (2.7 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.aggregate; |
29 |
|
30 |
import org.cresques.cts.IProjection; |
31 |
import org.gvsig.fmap.geom.Geometry; |
32 |
import org.gvsig.fmap.geom.GeometryLocator; |
33 |
import org.gvsig.fmap.geom.Geometry.SUBTYPES; |
34 |
import org.gvsig.fmap.geom.Geometry.TYPES; |
35 |
import org.gvsig.fmap.geom.primitive.Primitive; |
36 |
import org.gvsig.fmap.geom.type.GeometryType; |
37 |
|
38 |
/**
|
39 |
* @author <a href="mailto:jpiera@gvsig.org">Jorge Piera</a>
|
40 |
*/
|
41 |
public class BaseMultiPrimitive2D extends BaseMultiPrimitive implements |
42 |
MultiPrimitive { |
43 |
|
44 |
// Registramos este tipo de geometrĂa
|
45 |
private static GeometryType geomType = GeometryLocator.getGeometryManager() |
46 |
.registerGeometryType(BaseMultiPrimitive2D.class, null, TYPES.AGGREGATE, SUBTYPES.GEOM2D);
|
47 |
|
48 |
/**
|
49 |
* Constructor without arguments. It is necessary to create
|
50 |
* geometries using the {@link GeometryType}{@link #create()}
|
51 |
* method
|
52 |
*/
|
53 |
public BaseMultiPrimitive2D() {
|
54 |
super();
|
55 |
} |
56 |
|
57 |
/**
|
58 |
* @param id
|
59 |
* @param projection
|
60 |
* @param geometries
|
61 |
*/
|
62 |
public BaseMultiPrimitive2D(String id, IProjection projection, |
63 |
Geometry[] geometries) {
|
64 |
super(id, projection, geometries);
|
65 |
} |
66 |
|
67 |
/**
|
68 |
* @param geometries
|
69 |
*/
|
70 |
public BaseMultiPrimitive2D(Geometry[] geometries) { |
71 |
super(geometries);
|
72 |
} |
73 |
|
74 |
/*
|
75 |
* (non-Javadoc)
|
76 |
*
|
77 |
* @see com.iver.cit.gvsig.fmap.core.IGeometry#cloneGeometry()
|
78 |
*/
|
79 |
public Geometry cloneGeometry() {
|
80 |
Primitive[] aux = new Primitive[getPrimitivesNumber()]; |
81 |
for (int i = 0; i < getPrimitivesNumber(); i++) { |
82 |
aux[i] = (Primitive)((Geometry)geometries.get(i)).cloneGeometry() |
83 |
.getInternalShape(); |
84 |
} |
85 |
return new BaseMultiPrimitive2D(id, projection, aux); |
86 |
} |
87 |
|
88 |
/*
|
89 |
* (non-Javadoc)
|
90 |
* @see org.gvsig.fmap.geom.primitive.AbstractPrimitive#getGeometryType()
|
91 |
*/
|
92 |
public GeometryType getGeometryType() {
|
93 |
return geomType;
|
94 |
} |
95 |
} |
96 |
|