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