Revision 21723 branches/v2_0_0_prep/libraries/libFMap_dataFile/src/org/gvsig/data/datastores/vectorial/file/shp/ShpFeaturesWriter.java

View differences:

ShpFeaturesWriter.java
65 65
		fullExtent = null;
66 66
	}
67 67

  
68
	public void insertFeature(Feature feature) throws WriteException, UnsupportedEncodingException {
68
	public void insertFeature_old(Feature feature) throws WriteException, UnsupportedEncodingException {
69 69
		/* System.out.println("Intento escribir el registro " +
70 70
		 numRows + " de la capa " + lyrVect.getName()); */
71 71

  
......
96 96
		}
97 97
	}
98 98

  
99
	
100
	public void insertFeature(Feature feature) throws WriteException, UnsupportedEncodingException {
101

  
102
		Geometry theGeom = (Geometry)feature.getDefaultGeometry();
103
		if (theGeom==null){
104
			FeatureType type = feature.getType();
105
			theGeom=(Geometry) type.get(type.getDefaultGeometry()).getDefaultValue();
106
			if (theGeom == null){
107
				theGeom = new NullGeometry();
108
			}
109
		} 
110
		if (!canWriteGeometry(theGeom.getType())){
111
			throw new WriteException("UnsupportedGeometryType: "+ theGeom.getGeometryType().getName(),SHPStore.DATASTORE_NAME);
112
		}
113
		super.insertFeature(feature);
114
		fileSize = shpWrite.writeIGeometry(theGeom);
115
		Rectangle2D boundsShp = theGeom.getBounds2D();
116
		if (boundsShp!=null){
117
			if (fullExtent == null) {
118
				fullExtent = boundsShp;
119
			} else {
120
				fullExtent.add(boundsShp);
121
			}
122
		}
123

  
124
	}
125

  
99 126
	public void updateFeatureType(FeatureType featureType) {
100 127
		super.updateFeatureType(featureType);
101 128
		int type=featureType.getGeometryTypes()[0];

Also available in: Unified diff