Revision 5389 trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/drivers/shp/write/SHPFileWrite.java
SHPFileWrite.java | ||
---|---|---|
70 | 70 |
private int m_cnt; |
71 | 71 |
private FileChannel shpChannel; |
72 | 72 |
private FileChannel shxChannel; |
73 |
private double flatness; |
|
73 | 74 |
|
74 | 75 |
/** |
75 | 76 |
* Crea un nuevo SHPFileWrite. |
... | ... | |
160 | 161 |
public void write(IGeometry[] geometries, int type) |
161 | 162 |
throws IOException, ShapefileException { |
162 | 163 |
m_shape = SHP.create(type); |
163 |
|
|
164 |
m_shape.setFlatness(flatness); |
|
164 | 165 |
writeHeaders(geometries, type); |
165 | 166 |
|
166 | 167 |
m_pos = m_bb.position(); |
... | ... | |
228 | 229 |
// Posicionamos al principio. |
229 | 230 |
m_bb.position(0); |
230 | 231 |
m_indexBuffer.position(0); |
231 |
|
|
232 |
|
|
232 | 233 |
ShapeFileHeader header = new ShapeFileHeader(); |
233 | 234 |
|
234 | 235 |
header.write(m_bb, type, numberOfGeometries, fileLength / 2, |
... | ... | |
247 | 248 |
shxChannel.position(0); |
248 | 249 |
drain(); |
249 | 250 |
} |
250 |
public int writeIGeometry(IGeometry g) throws IOException, ShapefileException
|
|
251 |
public int writeIGeometry(IGeometry g) throws IOException, ShapefileException |
|
251 | 252 |
{ |
252 | 253 |
int shapeType = getShapeType(g.getGeometryType()); |
253 | 254 |
m_shape = SHP.create(shapeType); |
255 |
m_shape.setFlatness(flatness); |
|
254 | 256 |
return writeGeometry(g); |
255 | 257 |
} |
256 |
|
|
257 |
|
|
258 |
|
|
258 |
|
|
259 |
|
|
260 |
|
|
259 | 261 |
/** |
260 |
* Writes a single Geometry.
|
|
261 |
*
|
|
262 |
* Writes a single Geometry. |
|
263 |
* |
|
262 | 264 |
* @param g |
263 | 265 |
* @return the position of buffer (after the last geometry, it will allow you to |
264 | 266 |
* write the file size in the header. |
... | ... | |
300 | 302 |
m_indexBuffer.putInt(length); |
301 | 303 |
m_offset += (length + 4); |
302 | 304 |
drain(); |
303 |
|
|
305 |
|
|
304 | 306 |
///assert(m_bb.position() == 0); |
305 | 307 |
return m_pos; // Devolvemos hasta donde hemos escrito |
306 | 308 |
} |
307 |
|
|
309 |
|
|
308 | 310 |
/** |
309 | 311 |
* Returns a shapeType compatible with shapeFile constants from a gvSIG's IGeometry type |
310 | 312 |
* @param geometryType |
... | ... | |
346 | 348 |
} |
347 | 349 |
return FConstant.SHAPE_TYPE_NULL; |
348 | 350 |
} |
349 |
|
|
351 |
|
|
352 |
public void setFlatness(double flatness) { |
|
353 |
this.flatness=flatness; |
|
354 |
} |
|
355 |
|
|
350 | 356 |
} |
Also available in: Unified diff