svn-gvsig-desktop / branches / v10 / extensions / extGPE-gvSIG / src / org / gvsig / fmap / drivers / gpe / model / GPEGeometry.java @ 18292
History | View | Annotate | Download (3.28 KB)
1 |
package org.gvsig.fmap.drivers.gpe.model; |
---|---|
2 |
|
3 |
import java.awt.geom.Rectangle2D; |
4 |
import java.util.ArrayList; |
5 |
|
6 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
7 |
|
8 |
|
9 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
10 |
*
|
11 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
12 |
*
|
13 |
* This program is free software; you can redistribute it and/or
|
14 |
* modify it under the terms of the GNU General Public License
|
15 |
* as published by the Free Software Foundation; either version 2
|
16 |
* of the License, or (at your option) any later version.
|
17 |
*
|
18 |
* This program is distributed in the hope that it will be useful,
|
19 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
* GNU General Public License for more details.
|
22 |
*
|
23 |
* You should have received a copy of the GNU General Public License
|
24 |
* along with this program; if not, write to the Free Software
|
25 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
26 |
*
|
27 |
* For more information, contact:
|
28 |
*
|
29 |
* Generalitat Valenciana
|
30 |
* Conselleria d'Infraestructures i Transport
|
31 |
* Av. Blasco Ib??ez, 50
|
32 |
* 46010 VALENCIA
|
33 |
* SPAIN
|
34 |
*
|
35 |
* +34 963862235
|
36 |
* gvsig@gva.es
|
37 |
* www.gvsig.gva.es
|
38 |
*
|
39 |
* or
|
40 |
*
|
41 |
* IVER T.I. S.A
|
42 |
* Salamanca 50
|
43 |
* 46005 Valencia
|
44 |
* Spain
|
45 |
*
|
46 |
* +34 963163400
|
47 |
* dac@iver.es
|
48 |
*/
|
49 |
/* CVS MESSAGES:
|
50 |
*
|
51 |
* $Id$
|
52 |
* $Log$
|
53 |
*
|
54 |
*/
|
55 |
/**
|
56 |
* @author Jorge Piera LLodr? (jorge.piera@iver.es)
|
57 |
*/
|
58 |
public class GPEGeometry { |
59 |
protected IGeometry geometry = null; |
60 |
protected String srs = null; |
61 |
protected String id = null; |
62 |
//This geometri is reprojected from the original
|
63 |
//CRS to the layer CRS.
|
64 |
private IGeometry reprojectedGeometry = null; |
65 |
protected ArrayList geometries = null; |
66 |
protected Rectangle2D bounds = null; |
67 |
|
68 |
public GPEGeometry(String id, IGeometry geometry, String srs) { |
69 |
super();
|
70 |
this.geometry = geometry;
|
71 |
this.srs = srs;
|
72 |
this.id = id;
|
73 |
this.geometries = new ArrayList(); |
74 |
} |
75 |
|
76 |
/**
|
77 |
* @return the geometry
|
78 |
*/
|
79 |
public IGeometry getIGeometry() {
|
80 |
return geometry;
|
81 |
} |
82 |
|
83 |
/**
|
84 |
* @return the srs
|
85 |
*/
|
86 |
public String getSrs() { |
87 |
return srs;
|
88 |
} |
89 |
|
90 |
/**
|
91 |
* @return the id
|
92 |
*/
|
93 |
public String getId() { |
94 |
return id;
|
95 |
} |
96 |
|
97 |
/**
|
98 |
* @return the reprojectedGeometry
|
99 |
*/
|
100 |
public IGeometry getReprojectedGeometry() {
|
101 |
return reprojectedGeometry;
|
102 |
} |
103 |
|
104 |
/**
|
105 |
* @param reprojectedGeometry the reprojectedGeometry to set
|
106 |
*/
|
107 |
public void setReprojectedGeometry(IGeometry reprojectedGeometry) { |
108 |
this.reprojectedGeometry = reprojectedGeometry;
|
109 |
} |
110 |
|
111 |
/**
|
112 |
* @return the bounding box
|
113 |
*/
|
114 |
public Rectangle2D getShapeBounds() { |
115 |
bounds = geometry.getBounds2D(); |
116 |
return bounds;
|
117 |
} |
118 |
|
119 |
/**
|
120 |
* Gets one geometry
|
121 |
* @param i
|
122 |
* Geometry position
|
123 |
* @return
|
124 |
* A Geometry
|
125 |
*/
|
126 |
public GPEGeometry getGeometryAt(int i){ |
127 |
return (GPEGeometry) geometries.get(i);
|
128 |
} |
129 |
|
130 |
/**
|
131 |
* @return the number of geometries
|
132 |
*/
|
133 |
public int getGeometriesSize(){ |
134 |
return geometries.size();
|
135 |
} |
136 |
|
137 |
/**
|
138 |
* Adds a new geometry
|
139 |
* @param geometry
|
140 |
* The geometry to add
|
141 |
*/
|
142 |
public void addGeometry(GPEGeometry geometry){ |
143 |
if (bounds == null){ |
144 |
bounds = geometry.getShapeBounds(); |
145 |
}else{
|
146 |
bounds.add(geometry.getShapeBounds()); |
147 |
} |
148 |
geometries.add(geometry); |
149 |
} |
150 |
|
151 |
|
152 |
public boolean isMultiGeometry(){ |
153 |
if (geometries.size()==0) |
154 |
return false; |
155 |
return true; |
156 |
} |
157 |
|
158 |
} |