Revision 40421
branches/v2_0_0_prep/libraries/libFMap_dalfile/src/org/gvsig/fmap/dal/store/shp/utils/SHPPolygon.java | ||
---|---|---|
55 | 55 |
import org.slf4j.LoggerFactory; |
56 | 56 |
|
57 | 57 |
/** |
58 |
* Elemento shape de tipo Pol�gono.
|
|
58 |
* Elemento shape de tipo Pol?gono.
|
|
59 | 59 |
* |
60 | 60 |
* @author Vicente Caballero Navarro |
61 | 61 |
*/ |
... | ... | |
181 | 181 |
* @see com.iver.cit.gvsig.fmap.shp.SHPShape#write(ByteBuffer, IGeometry) |
182 | 182 |
*/ |
183 | 183 |
public synchronized void write(ByteBuffer buffer, Geometry geometry) { |
184 |
//FPolygon2D polyLine; |
|
185 |
//polyLine = (FPolygon2D) geometry.getShape(); |
|
186 | 184 |
Envelope env = geometry.getEnvelope(); |
187 | 185 |
|
188 | 186 |
buffer.putDouble(env.getMinimum(0)); |
189 | 187 |
buffer.putDouble(env.getMinimum(1)); |
190 | 188 |
buffer.putDouble(env.getMaximum(0)); |
191 | 189 |
buffer.putDouble(env.getMaximum(1)); |
192 |
////// |
|
193 |
///obtainsPoints(geometry.getGeneralPathXIterator()); |
|
194 |
|
|
195 |
//int[] parts=polyLine.getParts(); |
|
196 |
//FPoint2D[] points=polyLine.getPoints(); |
|
190 |
|
|
197 | 191 |
int nparts = parts.length; |
198 | 192 |
int npoints = points.length; |
199 | 193 |
|
200 |
////// |
|
201 |
///int npoints = polyLine.getNumPoints(); |
|
202 |
///int nparts = polyLine.getNumParts(); |
|
203 | 194 |
buffer.putInt(nparts); |
204 | 195 |
buffer.putInt(npoints); |
205 | 196 |
|
206 |
// int count = 0; |
|
207 |
|
|
208 | 197 |
for (int t = 0; t < nparts; t++) { |
209 |
///buffer.putInt(polyLine.getPart(t)); |
|
210 | 198 |
buffer.putInt(parts[t]); |
211 | 199 |
} |
212 | 200 |
|
213 |
///FPoint[] points = polyLine.getPoints(); |
|
214 | 201 |
for (int t = 0; t < points.length; t++) { |
215 |
///buffer.putDouble(points[t].x); |
|
216 |
///buffer.putDouble(points[t].y); |
|
217 | 202 |
buffer.putDouble(points[t].getX()); |
218 | 203 |
buffer.putDouble(points[t].getY()); |
219 | 204 |
} |
... | ... | |
237 | 222 |
} |
238 | 223 |
} |
239 | 224 |
|
240 |
if ((m_type == SHP.POLYGONM) || |
|
241 |
(m_type == SHP.POLYGON3D)) { |
|
225 |
if ((m_type == SHP.POLYGONM)) { |
|
242 | 226 |
buffer.putDouble(-10E40); |
243 | 227 |
buffer.putDouble(-10E40); |
244 | 228 |
|
... | ... | |
252 | 236 |
* @see com.iver.cit.gvsig.fmap.shp.SHPShape#getLength(com.iver.cit.gvsig.core.BasicShape.FGeometry) |
253 | 237 |
*/ |
254 | 238 |
public synchronized int getLength(Geometry fgeometry) { |
255 |
// FPolygon2D multi; |
|
256 |
//multi = (FPolygon2D) fgeometry.getShape(); |
|
257 |
///int nrings = 0; |
|
258 |
///obtainsPoints(fgeometry.getGeneralPathXIterator()); |
|
259 |
|
|
260 |
//int[] parts=multi.getParts(); |
|
261 |
//FPoint2D[] points; |
|
262 |
///////// |
|
263 |
//points = multi.getPoints(); |
|
264 | 239 |
int npoints = points.length; |
265 | 240 |
|
266 |
/////////// |
|
267 |
///nrings = multi.getNumParts(); |
|
268 |
///int npoints = multi.getNumPoints(); |
|
269 | 241 |
int length; |
270 | 242 |
|
271 |
if (m_type == SHP.POLYGON3D) { |
|
272 |
length = 44 + (4 * parts.length) + (16 * npoints) + (8 * npoints) + |
|
273 |
16; |
|
274 |
} else if (m_type == SHP.POLYGONM) { |
|
275 |
length = 44 + (4 * parts.length) + (16 * npoints) + (8 * npoints) + |
|
276 |
16; |
|
243 |
if (m_type == SHP.POLYGON3D || m_type == SHP.POLYGONM) { |
|
244 |
length = 44 + (4 * parts.length) + (16 * npoints) + (8 * npoints) + 16; |
|
277 | 245 |
} else if (m_type == SHP.POLYGON2D) { |
278 | 246 |
length = 44 + (4 * parts.length) + (16 * npoints); |
279 | 247 |
} else { |
280 |
throw new IllegalStateException( |
|
281 |
"Expected ShapeType of Polygon, got " + m_type); |
|
248 |
throw new IllegalStateException("Expected ShapeType of Polygon, got " + m_type); |
|
282 | 249 |
} |
283 | 250 |
|
284 | 251 |
return length; |
Also available in: Unified diff