Revision 21839

View differences:

branches/Mobile_Compatible_Hito_1/libFMap/src-file/org/gvsig/data/datastores/vectorial/file/shp/utils/SHPFileWrite.java
44 44
import java.io.IOException;
45 45
import java.nio.ByteOrder;
46 46

  
47
import org.gvsig.data.exception.InitializeWriterException;
48
import org.gvsig.data.exception.WriteException;
47
import org.gvsig.data.WriteException;
48
import org.gvsig.data.datastores.vectorial.InitializeWriterException;
49 49
import org.gvsig.datasources.common.IByteBuffer;
50 50
import org.gvsig.datasources.common.IRandomFileChannel;
51 51
import org.gvsig.datasources.impljme.Impl;
52
import org.gvsig.fmap.geom.Geometry;
53
import org.gvsig.fmap.geom.primitive.FShape;
52 54

  
53
import es.prodevelop.gvsig.mobile.fmap.core.FShape;
54
import es.prodevelop.gvsig.mobile.fmap.core.IGeometry;
55
import es.prodevelop.gvsig.mobile.fmap.symbol.FConstant;
56

  
57 55
// import com.iver.cit.gvsig.fmap.core.FShape;
58
// import com.iver.cit.gvsig.fmap.core.IGeometry;
56
// import com.iver.cit.gvsig.fmap.core.Geometry;
59 57
// import com.iver.cit.gvsig.fmap.core.v02.FConstant;
60 58
// import com.iver.cit.gvsig.fmap.drivers.shp.write.ShapefileException;
61 59

  
......
192 190
	 * @throws ShapefileException
193 191
	 *             DOCUMENT ME!
194 192
	 */
195
	public void write(IGeometry[] geometries, int type)
193
	public void write(Geometry[] geometries, int type)
196 194
			throws InitializeWriterException {
197 195
		m_shape = SHP.create(type);
198 196
		// m_shape.setFlatness(flatness);
......
219 217
	 * @throws IOException
220 218
	 *             DOCUMENT ME!
221 219
	 */
222
	private void writeHeaders(IGeometry[] geometries, int type)
220
	private void writeHeaders(Geometry[] geometries, int type)
223 221
			throws InitializeWriterException {
224 222
		int fileLength = 100;
225 223
		Rectangle2D extent = null;
226 224

  
227 225
		for (int i = geometries.length - 1; i >= 0; i--) {
228
			IGeometry fgeometry = geometries[i];
226
			Geometry fgeometry = geometries[i];
229 227
			m_shape.obtainsPoints(fgeometry);
230 228
			int size = m_shape.getLength(fgeometry) + 8;
231 229
			fileLength += size;
......
297 295
		drain();
298 296
	}
299 297

  
300
	public int writeIGeometry(IGeometry g) throws InitializeWriterException {
301
		int shapeType = getShapeType(g.getGeometryType());
298
	public int writeIGeometry(Geometry g) throws InitializeWriterException {
299
		int shapeType = getShapeType(g.getType());
302 300
		m_shape = SHP.create(shapeType);
303 301
		// m_shape.setFlatness(flatness);
304 302
		return writeGeometry(g);
......
313 311
	 * @throws WriteException
314 312
	 * @throws IOException
315 313
	 */
316
	public synchronized int writeGeometry(IGeometry g)
314
	public synchronized int writeGeometry(Geometry g)
317 315
			throws InitializeWriterException {
318 316
		if (m_bb == null) {
319 317
			allocateBuffers();
......
360 358

  
361 359
	/**
362 360
	 * Returns a shapeType compatible with shapeFile constants from a gvSIG's
363
	 * IGeometry type
361
	 * Geometry type
364 362
	 * 
365 363
	 * @param geometryType
366 364
	 * @return a shapeType compatible with shapeFile constants from a gvSIG's
367
	 *         IGeometry type
365
	 *         Geometry type
368 366
	 */
369 367
	public int getShapeType(int geometryType) {
370
		if (geometryType >= FShape.Z) {
371
			switch (geometryType - FShape.Z) {
372
			case (FShape.POINT):
373
				return FConstant.SHAPE_TYPE_POINTZ;
374 368

  
375
			case (FShape.LINE):
376
				return FConstant.SHAPE_TYPE_POLYLINEZ;
369
		if (geometryType>=Geometry.TYPES.Z){
370
			switch (geometryType - Geometry.TYPES.Z) {
371
			case Geometry.TYPES.POINT:
372
				return SHP.POINT3D;
377 373

  
378
			case FShape.POLYGON:
379
				return FConstant.SHAPE_TYPE_POLYGONZ;
374
			case Geometry.TYPES.CURVE:
375
			case Geometry.TYPES.ELLIPSE:
376
			case Geometry.TYPES.CIRCLE:
377
			case Geometry.TYPES.ARC:
378
				return SHP.POLYLINE3D;
380 379

  
381
			case FShape.MULTIPOINT:
382
				return FConstant.SHAPE_TYPE_MULTIPOINTZ; // TODO falta
383
															// aclarar cosas
384
															// aqu?.
385
			}
380
			case Geometry.TYPES.SURFACE:
381
				return SHP.POLYGON3D;
386 382

  
387
		} else {
383
			case Geometry.TYPES.MULTIPOINT:
384
				return SHP.MULTIPOINT3D; //TODO falta aclarar cosas aqu?.
385
		}
386

  
387
		}else{
388 388
			switch (geometryType) {
389
			case FShape.POINT:
390
				return FConstant.SHAPE_TYPE_POINT;
389
				case Geometry.TYPES.POINT:
390
					return SHP.POINT2D;
391 391

  
392
			case FShape.LINE:
393
			case FShape.ELLIPSE:
394
			case FShape.CIRCLE:
395
			case FShape.ARC:
396
				return FConstant.SHAPE_TYPE_POLYLINE;
392
				case Geometry.TYPES.CURVE:
393
				case Geometry.TYPES.ELLIPSE:
394
				case Geometry.TYPES.CIRCLE:
395
				case Geometry.TYPES.ARC:
396
					return SHP.POLYLINE2D;
397 397

  
398
			case FShape.POLYGON:
399
				return FConstant.SHAPE_TYPE_POLYGON;
398
				case Geometry.TYPES.SURFACE:
399
					return SHP.POLYGON2D;
400 400

  
401
			case FShape.MULTIPOINT:
402
				return FConstant.SHAPE_TYPE_MULTIPOINT; // TODO falta aclarar
403
														// cosas aqu?.
401
				case Geometry.TYPES.MULTIPOINT:
402
					return SHP.MULTIPOINT2D; //TODO falta aclarar cosas aqu?.
404 403
			}
405 404
		}
406
		return FConstant.SHAPE_TYPE_NULL;
407
	}
405
			return SHP.NULL;
406
		}
408 407

  
408

  
409 409
	// public void setFlatness(double flatness) {
410 410
	// this.flatness=flatness;
411 411
	// }
branches/Mobile_Compatible_Hito_1/libFMap/src-file/org/gvsig/data/datastores/vectorial/file/shp/utils/SHP.java
66 66
	public static final int POLYGON3D = 15;
67 67

  
68 68
	public static final int MULTIPOINT3D = 18;
69
	
70
	public final static int POINTM = 21;
71
	
72
	public final static int POLYLINEM = 23;
73
	public final static int POLYGONM = 25;
74
	public final static int MULTIPOINTM = 28;
69 75

  
70 76
	/**
71 77
	 * Crea a partir del tipo de geometr?a un shape del tipo m?s adecuado.

Also available in: Unified diff