Revision 23192 branches/v10/extensions/extLidar/src/com/dielmo/gvsig/lidar/drivers/LiDARDriver.java
LiDARDriver.java | ||
---|---|---|
33 | 33 |
import com.dielmo.gvsig.lidar.InicializeLidar; |
34 | 34 |
import com.dielmo.gvsig.lidar.LidarHeader; |
35 | 35 |
import com.dielmo.gvsig.lidar.LidarPoint; |
36 |
import com.dielmo.gvsig.lidar.UnexpectedPointException; |
|
36 | 37 |
import com.hardcode.gdbms.driver.DriverUtilities; |
37 | 38 |
import com.hardcode.gdbms.engine.data.DataSourceFactory; |
38 | 39 |
import com.hardcode.gdbms.engine.data.driver.DriverException; |
... | ... | |
211 | 212 |
*/ |
212 | 213 |
public IGeometry getShape(int index) { |
213 | 214 |
|
214 |
Point2D.Double p = lp.readPoint2D(bb, hdr, index); |
|
215 |
Point2D.Double p = null; |
|
216 |
try { |
|
217 |
p = lp.readPoint2D(bb, hdr, index); |
|
218 |
|
|
219 |
} catch (UnexpectedPointException e) { |
|
220 |
// TODO Auto-generated catch block |
|
221 |
e.printStackTrace(); |
|
222 |
} |
|
215 | 223 |
return ShapeFactory.createPoint2D(p.getX(), p.getY()); |
216 | 224 |
} |
217 | 225 |
|
... | ... | |
303 | 311 |
} |
304 | 312 |
|
305 | 313 |
public Value getFieldValue(long rowIndex, int fieldId) throws DriverException { |
306 |
return lp.getField(bb, fields[fieldId].getFieldName(), hdr, rowIndex); |
|
314 |
try { |
|
315 |
return lp.getField(bb, fields[fieldId].getFieldName(), hdr, rowIndex); |
|
316 |
} catch (UnexpectedPointException e) { |
|
317 |
// TODO Auto-generated catch block |
|
318 |
e.printStackTrace(); |
|
319 |
} |
|
320 |
return null; |
|
307 | 321 |
} |
308 | 322 |
|
309 | 323 |
public int getFieldWidth(int i) throws DriverException { |
... | ... | |
360 | 374 |
int aux = (int)(Math.random() * 1000); |
361 | 375 |
fTemp = new File(tempDirectoryPath + "/tmpLidar" + aux + ".las"); |
362 | 376 |
lidarWriter.setFile(fTemp); |
363 |
lidarWriter.setHeader(hdr, lp); |
|
377 |
lidarWriter.setHeaderAndPoint(hdr, lp);
|
|
364 | 378 |
lidarWriter.initialize(tableDefinition); |
365 | 379 |
} |
366 | 380 |
|
... | ... | |
381 | 395 |
|
382 | 396 |
try { |
383 | 397 |
|
384 |
// close(); |
|
385 |
// FileChannel fcinLidar = new FileInputStream(fTemp).getChannel();
|
|
386 |
// FileChannel fcoutLidar = new FileOutputStream(m_Fich).getChannel();
|
|
387 |
// DriverUtilities.copy(fcinLidar, fcoutLidar);
|
|
398 |
// close();
|
|
399 |
FileChannel fcinLidar = new FileInputStream(fTemp).getChannel(); |
|
400 |
FileChannel fcoutLidar = new FileOutputStream(m_Fich).getChannel(); |
|
401 |
DriverUtilities.copy(fcinLidar, fcoutLidar); |
|
388 | 402 |
|
389 | 403 |
// Borramos los temporales |
390 |
// fTemp.delete(); |
|
391 |
lidarWriter.close(); |
|
392 |
reload(); |
|
404 |
fTemp.delete(); |
|
405 |
//reload(); |
|
393 | 406 |
|
394 | 407 |
} catch (FileNotFoundException e) { |
395 | 408 |
throw new EditionException(e); |
396 | 409 |
} catch (IOException e) { |
397 | 410 |
throw new EditionException(e); |
398 |
} catch (DriverException e) { |
|
399 |
// TODO Auto-generated catch block |
|
400 |
e.printStackTrace(); |
|
401 |
} |
|
411 |
} |
|
402 | 412 |
} |
403 | 413 |
} |
Also available in: Unified diff