Package org.hortonmachine.gears.io.las
Class ALasDataManager
- java.lang.Object
-
- org.hortonmachine.gears.io.las.ALasDataManager
-
- All Implemented Interfaces:
AutoCloseable
public abstract class ALasDataManager extends Object implements AutoCloseable
Abstract las data manager class.This is used to create the data manager, being it from single las file or index folder.
- Author:
- Andrea Antonello (www.hydrologis.com)
-
-
Field Summary
Fields Modifier and Type Field Description protected double[]classesprotected org.opengis.referencing.crs.CoordinateReferenceSystemcrsprotected org.locationtech.jts.geom.GeometryFactorygfprotected booleanhasConstraintprotected double[]impulsesprotected intimpulsesNumprotected double[]intensityRange
-
Constructor Summary
Constructors Constructor Description ALasDataManager()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected booleandoAccept(LasRecord lasDot)Check the point for constraints.static ALasDataManagergetDataManager(File dataFile, org.geotools.coverage.grid.GridCoverage2D inDem, double elevThreshold, org.opengis.referencing.crs.CoordinateReferenceSystem inCrs)Factory method to createALasDataManager.abstract org.geotools.geometry.jts.ReferencedEnvelope3DgetEnvelope3D()Get the overall envelope 3d of the las folder.org.geotools.data.simple.SimpleFeatureCollectiongetEnvelopeFeaturesInGeometry(org.locationtech.jts.geom.Geometry checkGeom, boolean doOnlyEnvelope, double[] minMaxZI, boolean doPoints)Retrieve all the envelope features that intersect the geometry.abstract List<org.geotools.geometry.jts.ReferencedEnvelope>getEnvelopeList()Getter for the list of envelopes of all las files.abstract List<org.locationtech.jts.geom.Geometry>getEnvelopesInGeometry(org.locationtech.jts.geom.Geometry checkGeom, boolean doOnlyEnvelope, double[] minMaxZ)Retrieve all the trees envelopes that intersect the geometry.abstract FilegetFile()abstract org.geotools.geometry.jts.ReferencedEnvelopegetOverallEnvelope()Get the overall envelope of the las folder.abstract org.geotools.data.simple.SimpleFeatureCollectiongetOverviewFeatures()Creates a polygonSimpleFeatureCollectionfor all las files.abstract List<LasRecord>getPointsInGeometry(org.locationtech.jts.geom.Geometry checkGeom, boolean doOnlyEnvelope)Get points inside a given geometry boundary.static List<LasRecord>getPointsInHeightRange(List<LasRecord> pointsList, double min, double max)Extracts the points contained inside a height from ground range from the supplied list of points.static List<LasRecord>getPointsInVerticalRange(List<LasRecord> pointsList, double min, double max, boolean isGroundElev)Extracts the points contained inside a vertical range from the supplied list of points.abstract voidopen()Open the main folder file and read the main index.voidsetClassesConstraint(double[] classesToKeep)voidsetImpulsesConstraint(double[] impulsesToKeep)voidsetImpulsesNumConstraint(int impulsesNumToKeep)voidsetIntensityConstraint(double[] minMax)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.AutoCloseable
close
-
-
-
-
Field Detail
-
gf
protected org.locationtech.jts.geom.GeometryFactory gf
-
intensityRange
protected double[] intensityRange
-
impulses
protected double[] impulses
-
impulsesNum
protected int impulsesNum
-
classes
protected double[] classes
-
hasConstraint
protected boolean hasConstraint
-
crs
protected org.opengis.referencing.crs.CoordinateReferenceSystem crs
-
-
Method Detail
-
getDataManager
public static ALasDataManager getDataManager(File dataFile, org.geotools.coverage.grid.GridCoverage2D inDem, double elevThreshold, org.opengis.referencing.crs.CoordinateReferenceSystem inCrs)
Factory method to createALasDataManager.- Parameters:
lasFile- the las file or las folder index file.inDem- a dem to normalize the elevation. If!null, the height over the dtm is added asLasRecord.groundElevation.elevThreshold- a threshold to use for the elevation normalization.inCrs- the dataCoordinateReferenceSystem. if null, the one of the dem is read, if available.
-
getFile
public abstract File getFile()
- Returns:
- the file representing the dataset.
-
open
public abstract void open() throws ExceptionOpen the main folder file and read the main index.- Throws:
Exception
-
setIntensityConstraint
public void setIntensityConstraint(double[] minMax)
-
setImpulsesConstraint
public void setImpulsesConstraint(double[] impulsesToKeep)
-
setImpulsesNumConstraint
public void setImpulsesNumConstraint(int impulsesNumToKeep)
-
setClassesConstraint
public void setClassesConstraint(double[] classesToKeep)
-
getPointsInGeometry
public abstract List<LasRecord> getPointsInGeometry(org.locationtech.jts.geom.Geometry checkGeom, boolean doOnlyEnvelope) throws Exception
Get points inside a given geometry boundary.- Parameters:
checkGeom- theGeometryto use to check.doOnlyEnvelope- check for the geom envelope instead of a intersection with it.- Returns:
- the list of points contained in the supplied geometry.
- Throws:
Exception
-
getEnvelopesInGeometry
public abstract List<org.locationtech.jts.geom.Geometry> getEnvelopesInGeometry(org.locationtech.jts.geom.Geometry checkGeom, boolean doOnlyEnvelope, double[] minMaxZ) throws Exception
Retrieve all the trees envelopes that intersect the geometry.- Parameters:
checkGeom- theGeometryto use to check.doOnlyEnvelope- check for the geom envelope instead of a intersection with it.minMaxZ- an array to be filled with the min and max z to be used as style.- Returns:
- the list of envelopes contained in the supplied geometry.
- Throws:
Exception
-
getOverallEnvelope
public abstract org.geotools.geometry.jts.ReferencedEnvelope getOverallEnvelope() throws ExceptionGet the overall envelope of the las folder.This reads the data from the index.
- Returns:
- the
ReferencedEnvelopeof the data. - Throws:
Exception
-
getEnvelopeList
public abstract List<org.geotools.geometry.jts.ReferencedEnvelope> getEnvelopeList() throws Exception
Getter for the list of envelopes of all las files.- Returns:
- the list of
ReferencedEnvelopes. - Throws:
Exception
-
getEnvelope3D
public abstract org.geotools.geometry.jts.ReferencedEnvelope3D getEnvelope3D() throws ExceptionGet the overall envelope 3d of the las folder.Warning: this needs to open all involved readers.
- Returns:
- the
ReferencedEnvelope3Dof the data. - Throws:
Exception
-
getOverviewFeatures
public abstract org.geotools.data.simple.SimpleFeatureCollection getOverviewFeatures() throws ExceptionCreates a polygonSimpleFeatureCollectionfor all las files.- Returns:
- the features of teh las file bounds.
- Throws:
Exception
-
getEnvelopeFeaturesInGeometry
public org.geotools.data.simple.SimpleFeatureCollection getEnvelopeFeaturesInGeometry(org.locationtech.jts.geom.Geometry checkGeom, boolean doOnlyEnvelope, double[] minMaxZI, boolean doPoints) throws ExceptionRetrieve all the envelope features that intersect the geometry.an elev attribute is added with the max elev contained in the envelope.
- Parameters:
checkGeom- theGeometryto use to check.doOnlyEnvelope- check for the geom envelope instead of a intersection with it.minMaxZI- an array to be filled with the [minz,maxz, minintensity, maxintensity] to be used as style.doPoints- iftrue, create points instead of polygons.- Returns:
- the features of the envelopes contained in the supplied geometry.
- Throws:
Exception
-
doAccept
protected boolean doAccept(LasRecord lasDot)
Check the point for constraints.- Parameters:
lasDot- the point to check.- Returns:
trueif the point is accepted.
-
getPointsInVerticalRange
public static List<LasRecord> getPointsInVerticalRange(List<LasRecord> pointsList, double min, double max, boolean isGroundElev)
Extracts the points contained inside a vertical range from the supplied list of points.- Parameters:
pointsList- the list ospoints.min- the min value of the range.max- the max value of the range.isGroundElev- iftrue, ground elevation is used instead of z.- Returns:
- the points contained in the range.
-
getPointsInHeightRange
public static List<LasRecord> getPointsInHeightRange(List<LasRecord> pointsList, double min, double max)
Extracts the points contained inside a height from ground range from the supplied list of points.No check is done on the existence of the ground height value.
- Parameters:
pointsList- the list ospoints.min- the min value of the range.max- the max value of the range.- Returns:
- the points contained in the range.
-
-