svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libDielmoOpenLiDAR / src / org / gvsig / fmap / dal / store / lidar / LiDARStoreProvider.java @ 28676
History | View | Annotate | Download (16.2 KB)
1 |
/**
|
---|---|
2 |
*
|
3 |
*/
|
4 |
package org.gvsig.fmap.dal.store.lidar; |
5 |
|
6 |
import java.awt.geom.Point2D; |
7 |
import java.io.File; |
8 |
import java.io.FileInputStream; |
9 |
import java.io.IOException; |
10 |
import java.nio.ByteOrder; |
11 |
import java.nio.channels.FileChannel; |
12 |
import java.util.ArrayList; |
13 |
import java.util.Iterator; |
14 |
import java.util.List; |
15 |
|
16 |
import org.gvsig.fmap.dal.DataParameters; |
17 |
import org.gvsig.fmap.dal.DataServerExplorer; |
18 |
import org.gvsig.fmap.dal.DataStoreNotification; |
19 |
import org.gvsig.fmap.dal.DataTypes; |
20 |
import org.gvsig.fmap.dal.exception.CloseException; |
21 |
import org.gvsig.fmap.dal.exception.DataException; |
22 |
import org.gvsig.fmap.dal.exception.InitializeException; |
23 |
import org.gvsig.fmap.dal.exception.OpenException; |
24 |
import org.gvsig.fmap.dal.exception.ReadException; |
25 |
import org.gvsig.fmap.dal.feature.EditableFeatureAttributeDescriptor; |
26 |
import org.gvsig.fmap.dal.feature.EditableFeatureType; |
27 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
28 |
import org.gvsig.fmap.dal.feature.FeatureQuery; |
29 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
30 |
import org.gvsig.fmap.dal.feature.FeatureType; |
31 |
import org.gvsig.fmap.dal.feature.exception.PerformEditingException; |
32 |
import org.gvsig.fmap.dal.feature.spi.AbstractFeatureStoreProvider; |
33 |
import org.gvsig.fmap.dal.feature.spi.FeatureData; |
34 |
import org.gvsig.fmap.dal.feature.spi.FeatureReferenceProviderServices; |
35 |
import org.gvsig.fmap.dal.feature.spi.FeatureSetProvider; |
36 |
import org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider; |
37 |
import org.gvsig.fmap.dal.feature.spi.FeatureStoreProviderServices; |
38 |
import org.gvsig.fmap.dal.resource.exception.ResourceBeginException; |
39 |
import org.gvsig.fmap.dal.resource.exception.ResourceNotifyOpenException; |
40 |
import org.gvsig.fmap.dal.resource.file.FileResource; |
41 |
import org.gvsig.fmap.dal.resource.spi.ResourceConsumer; |
42 |
import org.gvsig.fmap.dal.resource.spi.ResourceProvider; |
43 |
import org.gvsig.fmap.geom.Geometry; |
44 |
import org.gvsig.fmap.geom.GeometryLocator; |
45 |
import org.gvsig.fmap.geom.GeometryManager; |
46 |
import org.gvsig.fmap.geom.Geometry.SUBTYPES; |
47 |
import org.gvsig.fmap.geom.exception.CreateEnvelopeException; |
48 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
49 |
import org.gvsig.fmap.geom.primitive.Envelope; |
50 |
import org.gvsig.tools.ToolsLocator; |
51 |
import org.gvsig.tools.dynobject.DelegatedDynObject; |
52 |
import org.gvsig.tools.dynobject.DynClass; |
53 |
import org.gvsig.tools.dynobject.DynField; |
54 |
import org.gvsig.tools.dynobject.DynObjectManager; |
55 |
import org.gvsig.tools.persistence.PersistenceException; |
56 |
import org.gvsig.tools.persistence.PersistentState; |
57 |
import org.slf4j.Logger; |
58 |
import org.slf4j.LoggerFactory; |
59 |
|
60 |
import com.dielmo.lidar.BigByteBuffer2; |
61 |
import com.dielmo.lidar.InicializeLidar; |
62 |
import com.dielmo.lidar.LidarHeader; |
63 |
import com.dielmo.lidar.LidarPoint; |
64 |
import com.dielmo.lidar.UnexpectedLidarHeaderException; |
65 |
import com.dielmo.lidar.fieldsDescription.fieldsDescription.ColumnDescription; |
66 |
import com.dielmo.lidar.fieldsDescription.fieldsDescription.ContainerColumnDescription; |
67 |
|
68 |
/**
|
69 |
* @author jmvivo
|
70 |
*
|
71 |
*/
|
72 |
public class LiDARStoreProvider extends AbstractFeatureStoreProvider implements |
73 |
ResourceConsumer { |
74 |
private static final GeometryManager geomManager = GeometryLocator.getGeometryManager(); |
75 |
private static final Logger logger = LoggerFactory.getLogger(LiDARStoreProvider.class); |
76 |
|
77 |
public static String NAME = "LiDARStore"; |
78 |
public static String DESCRIPTION = "LiDAR file"; |
79 |
|
80 |
/**
|
81 |
* LiDAR file.
|
82 |
*/
|
83 |
private File m_Fich; |
84 |
|
85 |
/**
|
86 |
* Temporal LiDAR file for writer. This is used in edition time.
|
87 |
*/
|
88 |
private File fTemp; |
89 |
|
90 |
/**
|
91 |
* 8 Kbytes buffer
|
92 |
*/
|
93 |
private BigByteBuffer2 bb;
|
94 |
|
95 |
/**
|
96 |
* Channel to read, write and manipulate the LiDAR file
|
97 |
*/
|
98 |
private FileChannel channel; |
99 |
|
100 |
/**
|
101 |
* management of input read data from LiDAR file.
|
102 |
*/
|
103 |
private FileInputStream fin; |
104 |
|
105 |
// informacion del LiDAR
|
106 |
|
107 |
/**
|
108 |
* Definition of one type of LiDAR point.
|
109 |
*/
|
110 |
private LidarPoint lp;
|
111 |
|
112 |
/**
|
113 |
* Definition of one type of LiDAR header.
|
114 |
*/
|
115 |
private LidarHeader hdr;
|
116 |
|
117 |
// Writer
|
118 |
/**
|
119 |
* Writer assigned to LiDAR
|
120 |
*/
|
121 |
// private LiDARWriter lidarWriter = new LiDARWriter();
|
122 |
|
123 |
/**
|
124 |
* Temporal folder to work in edition mode.
|
125 |
*/
|
126 |
private static String tempDirectoryPath = System |
127 |
.getProperty("java.io.tmpdir");
|
128 |
|
129 |
|
130 |
|
131 |
|
132 |
private static final String DYNCLASS_NAME = "LiDARStore"; |
133 |
protected static DynClass DYNCLASS = null; |
134 |
private ResourceProvider liDARResource;
|
135 |
private LiDARStoreParameters liDARParams;
|
136 |
|
137 |
private long counterNewsOIDs = -1; |
138 |
private boolean isOpen = false; |
139 |
|
140 |
|
141 |
|
142 |
public LiDARStoreProvider() throws InitializeException { |
143 |
super();
|
144 |
} |
145 |
|
146 |
public LiDARStoreProvider(DataParameters params)
|
147 |
throws InitializeException {
|
148 |
super();
|
149 |
this.liDARParams = (LiDARStoreParameters) params;
|
150 |
this.dynObject = (DelegatedDynObject) ToolsLocator
|
151 |
.getDynObjectManager().createDynObject(DYNCLASS); |
152 |
|
153 |
this.dynObject.setDynValue("DefaultSRS", null); |
154 |
this.dynObject.setDynValue("Envelope", null); |
155 |
|
156 |
m_Fich = getLiDARParameters().getFile(); |
157 |
liDARResource = this.createResource(FileResource.NAME,
|
158 |
new Object[] { m_Fich.getAbsolutePath() }); |
159 |
liDARResource.addConsumer(this);
|
160 |
|
161 |
} |
162 |
|
163 |
|
164 |
protected static void registerDynClass() { |
165 |
DynObjectManager dynman = ToolsLocator.getDynObjectManager(); |
166 |
DynClass dynClass; |
167 |
DynField field; |
168 |
if (DYNCLASS == null) { |
169 |
|
170 |
dynClass = dynman.add(DYNCLASS_NAME); |
171 |
|
172 |
// The SHP store parameters extend the DBF store parameters
|
173 |
dynClass.extend(dynman.get(FeatureStore.DYNCLASS_NAME)); |
174 |
|
175 |
DYNCLASS = dynClass; |
176 |
} |
177 |
|
178 |
} |
179 |
private LiDARStoreParameters getLiDARParameters() {
|
180 |
return this.liDARParams; |
181 |
} |
182 |
|
183 |
public FeatureStoreProvider initialize(FeatureStoreProviderServices store)
|
184 |
throws InitializeException {
|
185 |
super.initialize(store);
|
186 |
this.initFeatureType();
|
187 |
return this; |
188 |
} |
189 |
|
190 |
protected void initFeatureType() throws InitializeException { |
191 |
try {
|
192 |
this.open();
|
193 |
} catch (OpenException e) {
|
194 |
throw new InitializeException(NAME, e); |
195 |
} |
196 |
EditableFeatureType fType = this.store.createFeatureType();
|
197 |
FeatureType finalFType; |
198 |
|
199 |
fType.setHasOID(true);
|
200 |
|
201 |
getFields(fType); |
202 |
|
203 |
EditableFeatureAttributeDescriptor attrGeo = fType.add("GEOMETRY",
|
204 |
DataTypes.GEOMETRY); |
205 |
attrGeo.setAllowNull(false);
|
206 |
attrGeo.setGeometryType(Geometry.TYPES.POINT); |
207 |
attrGeo.setSRS(liDARParams.getSRS()); |
208 |
fType.setDefaultGeometryAttributeName(attrGeo.getName()); |
209 |
|
210 |
|
211 |
List types = new ArrayList(1); |
212 |
finalFType = fType.getNotEditableCopy(); |
213 |
types.add(finalFType); |
214 |
this.store.setFeatureTypes(types, finalFType);
|
215 |
} |
216 |
|
217 |
private void getFields(EditableFeatureType fType ){ |
218 |
|
219 |
ContainerColumnDescription columns = new ContainerColumnDescription();
|
220 |
lp.getColumnsDescription(columns); |
221 |
|
222 |
int type;
|
223 |
for(int i=0;i<columns.getColumns().size();i++){ |
224 |
|
225 |
type = columns.get(i).getFieldType(); |
226 |
if(type==ColumnDescription.DOUBLE){
|
227 |
fType.add(columns.get(i).getFieldName(),DataTypes.DOUBLE, columns.get(i).getFieldSize()).setPrecision(columns.get(i).getFieldPrecision()).setDefaultValue( (columns.get(i).getFieldDefaultValue()) ); |
228 |
}else if(type==ColumnDescription.INT){ |
229 |
fType.add(columns.get(i).getFieldName(),DataTypes.INT, columns.get(i).getFieldSize()).setPrecision(columns.get(i).getFieldPrecision()).setDefaultValue( (columns.get(i).getFieldDefaultValue()) ); |
230 |
}else if(type==ColumnDescription.LONG){ |
231 |
fType.add(columns.get(i).getFieldName(),DataTypes.LONG, columns.get(i).getFieldSize()).setPrecision(columns.get(i).getFieldPrecision()).setDefaultValue( (columns.get(i).getFieldDefaultValue()) ); |
232 |
} else if(type==ColumnDescription.BYTE) { |
233 |
fType.add(columns.get(i).getFieldName(),DataTypes.BYTE, columns.get(i).getFieldSize()).setPrecision(columns.get(i).getFieldPrecision()).setDefaultValue( (columns.get(i).getFieldDefaultValue()) ); |
234 |
} |
235 |
} |
236 |
|
237 |
} |
238 |
|
239 |
public long getFeatureCount() throws DataException { |
240 |
this.open();
|
241 |
this.liDARResource.begin();
|
242 |
try {
|
243 |
return hdr.getNumPointsRecord();
|
244 |
} finally {
|
245 |
this.liDARResource.end();
|
246 |
} |
247 |
} |
248 |
|
249 |
/**
|
250 |
*
|
251 |
* @param index
|
252 |
* @return
|
253 |
* @throws DataException
|
254 |
*/
|
255 |
FeatureData getFeatureDataByIndex(long index, FeatureType fType)
|
256 |
throws DataException {
|
257 |
FeatureData data = this.createFeatureData(fType);
|
258 |
this.loadFeatureDataByIndex(data, index, fType);
|
259 |
return data;
|
260 |
} |
261 |
|
262 |
|
263 |
/* (non-Javadoc)
|
264 |
* @see org.gvsig.fmap.dal.feature.spi.AbstractFeatureStoreProvider#getExplorer()
|
265 |
*/
|
266 |
@Override
|
267 |
public DataServerExplorer getExplorer() throws ReadException { |
268 |
// TODO Auto-generated method stub
|
269 |
return null; |
270 |
} |
271 |
|
272 |
/* (non-Javadoc)
|
273 |
* @see org.gvsig.fmap.dal.feature.spi.AbstractFeatureStoreProvider#performEditing(java.util.Iterator, java.util.Iterator, java.util.Iterator)
|
274 |
*/
|
275 |
@Override
|
276 |
public void performEditing(Iterator deleteds, Iterator inserteds, |
277 |
Iterator updateds, Iterator originalFeatureTypesUpdated) throws PerformEditingException { |
278 |
// TODO Auto-generated method stub
|
279 |
|
280 |
} |
281 |
|
282 |
/* (non-Javadoc)
|
283 |
* @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#append(org.gvsig.fmap.dal.feature.Feature)
|
284 |
*/
|
285 |
public void append(FeatureData featureData) throws DataException { |
286 |
// TODO Auto-generated method stub
|
287 |
|
288 |
} |
289 |
|
290 |
/* (non-Javadoc)
|
291 |
* @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#beginAppend()
|
292 |
*/
|
293 |
public void beginAppend() throws DataException { |
294 |
// TODO Auto-generated method stub
|
295 |
|
296 |
} |
297 |
|
298 |
/* (non-Javadoc)
|
299 |
* @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#canWriteGeometry(int)
|
300 |
*/
|
301 |
public boolean canWriteGeometry(int geometryType) throws DataException { |
302 |
// TODO Auto-generated method stub
|
303 |
return false; |
304 |
} |
305 |
|
306 |
/* (non-Javadoc)
|
307 |
* @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#createNewOID()
|
308 |
*/
|
309 |
public Object createNewOID() { |
310 |
if (this.counterNewsOIDs < 0) { |
311 |
// try {
|
312 |
// this.counterNewsOIDs = this.getFeatureCount();
|
313 |
// } catch (DataException e) {
|
314 |
// e.printStackTrace();
|
315 |
// }
|
316 |
|
317 |
} else {
|
318 |
this.counterNewsOIDs++;
|
319 |
} |
320 |
return new Long(counterNewsOIDs); |
321 |
} |
322 |
|
323 |
/* (non-Javadoc)
|
324 |
* @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#createSet(org.gvsig.fmap.dal.feature.FeatureQuery)
|
325 |
*/
|
326 |
public FeatureSetProvider createSet(FeatureQuery query, FeatureType featureType)
|
327 |
throws DataException {
|
328 |
return new LiDARSetProvider(this, query, featureType); |
329 |
} |
330 |
|
331 |
/* (non-Javadoc)
|
332 |
* @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#endAppend()
|
333 |
*/
|
334 |
public void endAppend() throws DataException { |
335 |
// TODO Auto-generated method stub
|
336 |
|
337 |
} |
338 |
|
339 |
/* (non-Javadoc)
|
340 |
* @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#getFeatureDataByReference(org.gvsig.fmap.dal.feature.spi.FeatureReferenceProviderServices)
|
341 |
*/
|
342 |
public FeatureData getFeatureDataByReference(
|
343 |
FeatureReferenceProviderServices reference) throws DataException {
|
344 |
return this.getFeatureDataByReference(reference, this.store |
345 |
.getDefaultFeatureType()); |
346 |
} |
347 |
|
348 |
/* (non-Javadoc)
|
349 |
* @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#getFeatureDataByReference(org.gvsig.fmap.dal.feature.spi.FeatureReferenceProviderServices, org.gvsig.fmap.dal.feature.FeatureType)
|
350 |
*/
|
351 |
public FeatureData getFeatureDataByReference(
|
352 |
FeatureReferenceProviderServices reference, FeatureType featureType) |
353 |
throws DataException {
|
354 |
return this.getFeatureDataByIndex((Long) reference.getOID(), |
355 |
featureType); |
356 |
} |
357 |
|
358 |
/* (non-Javadoc)
|
359 |
* @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#getFeatureReferenceOIDType()
|
360 |
*/
|
361 |
public int getFeatureReferenceOIDType() { |
362 |
return DataTypes.LONG;
|
363 |
} |
364 |
|
365 |
/* (non-Javadoc)
|
366 |
* @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#getName()
|
367 |
*/
|
368 |
public String getName() { |
369 |
return NAME;
|
370 |
} |
371 |
|
372 |
/* (non-Javadoc)
|
373 |
* @see org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider#supportsAppendMode()
|
374 |
*/
|
375 |
public boolean supportsAppendMode() { |
376 |
return false; |
377 |
} |
378 |
|
379 |
/* (non-Javadoc)
|
380 |
* @see org.gvsig.tools.persistence.Persistent#getState()
|
381 |
*/
|
382 |
public PersistentState getState() throws PersistenceException { |
383 |
// TODO Auto-generated method stub
|
384 |
return null; |
385 |
} |
386 |
|
387 |
/* (non-Javadoc)
|
388 |
* @see org.gvsig.tools.persistence.Persistent#loadState(org.gvsig.tools.persistence.PersistentState)
|
389 |
*/
|
390 |
public void loadState(PersistentState state) throws PersistenceException { |
391 |
// TODO Auto-generated method stub
|
392 |
|
393 |
} |
394 |
|
395 |
/* (non-Javadoc)
|
396 |
* @see org.gvsig.tools.persistence.Persistent#setState(org.gvsig.tools.persistence.PersistentState)
|
397 |
*/
|
398 |
public void setState(PersistentState state) throws PersistenceException { |
399 |
// TODO Auto-generated method stub
|
400 |
|
401 |
} |
402 |
|
403 |
/* (non-Javadoc)
|
404 |
* @see org.gvsig.fmap.dal.spi.DataStoreProvider#getChilds()
|
405 |
*/
|
406 |
public Iterator getChilds() { |
407 |
// TODO Auto-generated method stub
|
408 |
return null; |
409 |
} |
410 |
|
411 |
/* (non-Javadoc)
|
412 |
* @see org.gvsig.fmap.dal.spi.DataStoreProvider#open()
|
413 |
*/
|
414 |
public void open() throws OpenException { |
415 |
if (isOpen) {
|
416 |
return;
|
417 |
} |
418 |
try {
|
419 |
liDARResource.begin(); |
420 |
} catch (ResourceBeginException e1) {
|
421 |
throw new OpenException(NAME, e1); |
422 |
} |
423 |
|
424 |
try {
|
425 |
|
426 |
hdr = InicializeLidar.InizializeLidarHeader(m_Fich); |
427 |
|
428 |
lp = InicializeLidar.InizializeLidarPoint(m_Fich); |
429 |
|
430 |
fin = new FileInputStream(m_Fich); |
431 |
|
432 |
|
433 |
// Open the file and then get a channel from the stream
|
434 |
channel = fin.getChannel(); |
435 |
|
436 |
// Get the file's size and then map it into memory
|
437 |
// bb = channel.map(FileChannel.MapMode.READ_ONLY, 0, size);
|
438 |
bb = new BigByteBuffer2(channel, FileChannel.MapMode.READ_ONLY); |
439 |
bb.order(ByteOrder.LITTLE_ENDIAN);
|
440 |
|
441 |
isOpen = true;
|
442 |
liDARResource.notifyOpen(); |
443 |
|
444 |
// Cargar Metadatos !!! (Envelope, SRS...)
|
445 |
Envelope envelope = geomManager.createEnvelope(hdr.getMinX(), hdr |
446 |
.getMinY(), hdr.getMaxX(), hdr.getMaxY(), SUBTYPES.GEOM2D); |
447 |
this.dynObject.setDynValue("Envelope", envelope); |
448 |
} catch (IOException e) { |
449 |
throw new OpenException(NAME, e); |
450 |
} catch (ResourceNotifyOpenException e) {
|
451 |
throw new OpenException(NAME, e); |
452 |
} catch (UnexpectedLidarHeaderException e) {
|
453 |
throw new OpenException(NAME, e); |
454 |
} catch (CreateEnvelopeException e) {
|
455 |
throw new OpenException(NAME, e); |
456 |
} finally {
|
457 |
liDARResource.end(); |
458 |
} |
459 |
} |
460 |
|
461 |
public boolean closeResourceRequested(ResourceProvider resource) { |
462 |
try {
|
463 |
this.close();
|
464 |
} catch (CloseException e) {
|
465 |
return false; |
466 |
} |
467 |
return true; |
468 |
} |
469 |
|
470 |
public boolean allowWrite() { |
471 |
// TODO
|
472 |
return false; |
473 |
} |
474 |
|
475 |
public void close() throws CloseException { |
476 |
if (!isOpen) {
|
477 |
return;
|
478 |
} |
479 |
try {
|
480 |
liDARResource.begin(); |
481 |
} catch (ResourceBeginException e2) {
|
482 |
throw new CloseException(NAME, e2); |
483 |
} |
484 |
|
485 |
try {
|
486 |
IOException ret = null; |
487 |
try {
|
488 |
channel.close(); |
489 |
} catch (IOException e) { |
490 |
ret = e; |
491 |
} finally {
|
492 |
try {
|
493 |
fin.close(); |
494 |
} catch (IOException e1) { |
495 |
ret = e1; |
496 |
} |
497 |
} |
498 |
|
499 |
if (ret != null) { |
500 |
throw ret;
|
501 |
} |
502 |
bb = null;
|
503 |
channel = null;
|
504 |
fin = null;
|
505 |
isOpen = false;
|
506 |
} catch (IOException e) { |
507 |
throw new CloseException(NAME, e); |
508 |
} finally {
|
509 |
liDARResource.end(); |
510 |
} |
511 |
|
512 |
} |
513 |
|
514 |
@Override
|
515 |
public void dispose() throws CloseException { |
516 |
this.close();
|
517 |
this.lp = null; |
518 |
this.hdr = null; |
519 |
liDARResource.removeConsumer(this);
|
520 |
liDARResource = null;
|
521 |
liDARParams = null;
|
522 |
m_Fich = null;
|
523 |
fTemp = null;
|
524 |
} |
525 |
|
526 |
@Override
|
527 |
public void refresh() throws OpenException { |
528 |
try {
|
529 |
this.close();
|
530 |
} catch (CloseException e) {
|
531 |
throw new OpenException(this.getName(), e); |
532 |
} |
533 |
this.open();
|
534 |
try {
|
535 |
this.initFeatureType();
|
536 |
} catch (InitializeException e) {
|
537 |
throw new OpenException(this.getName(), e); |
538 |
} |
539 |
|
540 |
} |
541 |
|
542 |
public void resourceChanged(ResourceProvider resource) { |
543 |
this.store.notifyChange(DataStoreNotification.RESOURCE_CHANGED,
|
544 |
resource); |
545 |
} |
546 |
|
547 |
public void loadFeatureDataByIndex(FeatureData data, long index, |
548 |
FeatureType featureType) throws DataException {
|
549 |
this.open();
|
550 |
liDARResource.begin(); |
551 |
|
552 |
try {
|
553 |
|
554 |
if (index < 0 || hdr.getNumPointsRecord() <= index) { |
555 |
// FIXME
|
556 |
throw new ArrayIndexOutOfBoundsException("" + index); |
557 |
} |
558 |
|
559 |
// lp.readPoint(bb, hdr, index);
|
560 |
|
561 |
data.setOID(index); |
562 |
|
563 |
FeatureAttributeDescriptor attr; |
564 |
Iterator iter = featureType.iterator();
|
565 |
|
566 |
Point2D.Double point;
|
567 |
while (iter.hasNext()) {
|
568 |
attr = (FeatureAttributeDescriptor) iter.next(); |
569 |
if (attr.getDataType() != DataTypes.GEOMETRY) {
|
570 |
data.set(attr.getIndex(), lp.getFieldValueByName(bb, attr |
571 |
.getName(), hdr, index)); |
572 |
} else {
|
573 |
point = lp.readPoint2D(bb, hdr, index); |
574 |
try {
|
575 |
data.set(attr.getIndex(), geomManager.createPoint( |
576 |
point.x, point.y, SUBTYPES.GEOM2D)); |
577 |
} catch (CreateGeometryException e) {
|
578 |
logger.error("Error adding a point", e);
|
579 |
} |
580 |
} |
581 |
} |
582 |
|
583 |
|
584 |
} finally {
|
585 |
liDARResource.end(); |
586 |
} |
587 |
|
588 |
} |
589 |
|
590 |
public Object getSourceId() { |
591 |
return this.getLiDARParameters().getFile(); |
592 |
} |
593 |
|
594 |
FeatureStoreProviderServices getProviderServices() { |
595 |
return this.store; |
596 |
} |
597 |
} |