Class 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 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
    • Constructor Detail

      • ALasDataManager

        public ALasDataManager()
    • 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 create ALasDataManager.
        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 as LasRecord.groundElevation.
        elevThreshold - a threshold to use for the elevation normalization.
        inCrs - the data CoordinateReferenceSystem. 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 Exception
        Open 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 - the Geometry to 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 - the Geometry to 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 Exception
        Get the overall envelope of the las folder.

        This reads the data from the index.

        Returns:
        the ReferencedEnvelope of 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 Exception
        Get the overall envelope 3d of the las folder.

        Warning: this needs to open all involved readers.

        Returns:
        the ReferencedEnvelope3D of the data.
        Throws:
        Exception
      • getOverviewFeatures

        public abstract org.geotools.data.simple.SimpleFeatureCollection getOverviewFeatures()
                                                                                      throws Exception
        Creates a polygon SimpleFeatureCollection for 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 Exception
        Retrieve all the envelope features that intersect the geometry.

        an elev attribute is added with the max elev contained in the envelope.

        Parameters:
        checkGeom - the Geometry to 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 - if true, 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:
        true if 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 os points.
        min - the min value of the range.
        max - the max value of the range.
        isGroundElev - if true, 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 os points.
        min - the min value of the range.
        max - the max value of the range.
        Returns:
        the points contained in the range.