java.lang.Object
org.noise_planet.noisemodelling.pathfinder.profilebuilder.ProfileBuilder

public class ProfileBuilder extends Object
Builder constructing profiles from buildings, topography and ground effects.
  • Field Details

    • epsilon

      public static final double epsilon
      See Also:
    • MILLIMETER

      public static final double MILLIMETER
      See Also:
    • LEFT_SIDE

      public static final double LEFT_SIDE
      See Also:
    • rtree

      public org.locationtech.jts.index.strtree.STRtree rtree
      RTree with Buildings's walls linestrings, walls linestring, GroundEffect linestrings The object is an integer. It's an index of the array processedWalls
    • processedWalls

      public final List<Wall> processedWalls
      List of processed walls.
    • DEFAULT_FREQUENCIES_THIRD_OCTAVE

      public static final int[] DEFAULT_FREQUENCIES_THIRD_OCTAVE
    • DEFAULT_FREQUENCIES_EXACT_THIRD_OCTAVE

      public static final Double[] DEFAULT_FREQUENCIES_EXACT_THIRD_OCTAVE
    • DEFAULT_FREQUENCIES_A_WEIGHTING_THIRD_OCTAVE

      public static final Double[] DEFAULT_FREQUENCIES_A_WEIGHTING_THIRD_OCTAVE
    • frequencyArray

      public List<Integer> frequencyArray
    • exactFrequencyArray

      public List<Double> exactFrequencyArray
    • aWeightingArray

      public List<Double> aWeightingArray
    • wideAngleTranslationEpsilon

      public static final double wideAngleTranslationEpsilon
      Profile cutting point.
      See Also:
  • Constructor Details

    • ProfileBuilder

      public ProfileBuilder()
      Main empty constructor.
    • ProfileBuilder

      public ProfileBuilder(int buildingNodeCapacity, int topoNodeCapacity, int groundNodeCapacity, int maxLineLength)
      Constructor setting parameters.
      Parameters:
      buildingNodeCapacity - Building RTree node capacity.
      topoNodeCapacity - Topographic RTree node capacity.
      groundNodeCapacity - Ground RTree node capacity.
      maxLineLength - Max length of line part used for profile retrieving.
  • Method Details

    • setzBuildings

      public ProfileBuilder setzBuildings(boolean zBuildings)
      Parameters:
      zBuildings - if true take into account z value on Buildings Polygons In this case, z represent the altitude (from the sea to the top of the wall). If false, Z is ignored and the height attribute of the Building/Wall is used to extrude the building from the DEM
      Returns:
      this
    • setFrequencyArray

      public void setFrequencyArray(Collection<Integer> frequencyArray)
      Parameters:
      frequencyArray - Frequency used in the simulation (extracted from Scene.DEFAULT_FREQUENCIES_THIRD_OCTAVE)
    • initializeFrequencyArrayFromReference

      public static void initializeFrequencyArrayFromReference(List<Integer> frequencyArray, List<Double> exactFrequencyArray, List<Double> aWeightingArray)
    • addBuilding

      public ProfileBuilder addBuilding(Building building)
      Add the given Geometry footprint.
      Parameters:
      building - Building.
    • addBuilding

      public ProfileBuilder addBuilding(org.locationtech.jts.geom.Geometry geom)
      Add the given Geometry footprint.
      Parameters:
      geom - Building footprint.
    • addBuilding

      public ProfileBuilder addBuilding(org.locationtech.jts.geom.Coordinate[] coords)
      Add the given Geometry footprint.
      Parameters:
      coords - Building footprint coordinates.
    • addBuilding

      public ProfileBuilder addBuilding(org.locationtech.jts.geom.Geometry geom, double height)
      Add the given Geometry footprint and height as building.
      Parameters:
      geom - Building footprint.
      height - Building height.
    • addBuilding

      public ProfileBuilder addBuilding(org.locationtech.jts.geom.Coordinate[] coords, double height)
      Add the given Geometry footprint.
      Parameters:
      coords - Building footprint coordinates.
      height - Building height.
    • addBuilding

      public ProfileBuilder addBuilding(org.locationtech.jts.geom.Geometry geom, int id)
      Add the given Geometry footprint.
      Parameters:
      geom - Building footprint.
      id - Database primary key.
    • addBuilding

      public ProfileBuilder addBuilding(org.locationtech.jts.geom.Coordinate[] coords, int id)
      Add the given Geometry footprint.
      Parameters:
      coords - Building footprint coordinates.
      id - Database primary key.
    • addBuilding

      public ProfileBuilder addBuilding(org.locationtech.jts.geom.Geometry geom, double height, int id)
      Add the given Geometry footprint, height, alphas (absorption coefficients) and a database id as building.
      Parameters:
      geom - Building footprint.
      height - Building height.
      id - Database id.
    • addBuilding

      public ProfileBuilder addBuilding(org.locationtech.jts.geom.Coordinate[] coords, double height, int id)
      Add the given Geometry footprint.
      Parameters:
      coords - Building footprint coordinates.
      height - Building height.
      id - Database primary key.
    • splitGeometryLineToDem

      public org.locationtech.jts.geom.LineString splitGeometryLineToDem(org.locationtech.jts.geom.LineString lineString, double epsilon)
      Apply a linestring over the digital elevation model by offsetting the z value with the ground elevation.
      Parameters:
      lineString -
      epsilon - ignore elevation point where linear interpolation distance is inferior that this value
      Returns:
      computed lineString
    • makeGeometryRelativeZToAbsolute

      public org.locationtech.jts.geom.Geometry makeGeometryRelativeZToAbsolute(org.locationtech.jts.geom.Geometry geometry, boolean checkForBuildingVolumes)
      Update ground Z coordinates of sound sources absolute to sea levels
      Parameters:
      geometry - Geometry to offset the Z value
      checkForBuildingVolumes - If true, this function will print a warning if the geometry contain at least one point under a building roof
    • offsetCoordinatesToAltitudeUsingDigitalElevationModel

      public org.locationtech.jts.geom.Coordinate[] offsetCoordinatesToAltitudeUsingDigitalElevationModel(org.locationtech.jts.geom.Coordinate[] geometryCoordinates, boolean checkForBuildingVolumes)
      Update ground Z coordinates of sound sources absolute to sea levels
      Parameters:
      geometryCoordinates - Geometry coordinates to offset the Z value
      checkForBuildingVolumes - If true, this function will print a warning if the geometry contain at least one point under a building roof
    • offsetCoordinateToAltitudeUsingDigitalElevationModel

      public org.locationtech.jts.geom.Coordinate offsetCoordinateToAltitudeUsingDigitalElevationModel(org.locationtech.jts.geom.Coordinate geometryCoordinate, boolean checkForBuildingVolumes)
      Offset a coordinate to altitude using the digital elevation model. The Z value of the coordinate is updated with the ground elevation at this point.
      Parameters:
      geometryCoordinate - Coordinate to offset
      checkForBuildingVolumes - If true, this function will print a warning if the geometry contain at least one point under a building roof
      Returns:
    • addBuilding

      public ProfileBuilder addBuilding(org.locationtech.jts.geom.Geometry geom, double height, List<Double> alphas)
      Add the given Geometry footprint, height and alphas (absorption coefficients) as building.
      Parameters:
      geom - Building footprint.
      height - Building height.
      alphas - Absorption coefficients.
    • addBuilding

      public ProfileBuilder addBuilding(org.locationtech.jts.geom.Coordinate[] coords, double height, List<Double> alphas)
      Add the given Geometry footprint.
      Parameters:
      coords - Building footprint coordinates.
      height - Building height.
      alphas - Absorption coefficients.
    • addBuilding

      public ProfileBuilder addBuilding(org.locationtech.jts.geom.Geometry geom, List<Double> alphas)
      Add the given Geometry footprint, height and alphas (absorption coefficients) as building.
      Parameters:
      geom - Building footprint.
      alphas - Absorption coefficients.
    • addBuilding

      public ProfileBuilder addBuilding(org.locationtech.jts.geom.Coordinate[] coords, List<Double> alphas)
      Add the given Geometry footprint.
      Parameters:
      coords - Building footprint coordinates.
      alphas - Absorption coefficients.
    • addBuilding

      public ProfileBuilder addBuilding(org.locationtech.jts.geom.Geometry geom, List<Double> alphas, int id)
      Add the given Geometry footprint, height and alphas (absorption coefficients) as building.
      Parameters:
      geom - Building footprint.
      alphas - Absorption coefficients.
      id - Database primary key.
    • addBuilding

      public ProfileBuilder addBuilding(org.locationtech.jts.geom.Coordinate[] coords, List<Double> alphas, int id)
      Add the given Geometry footprint.
      Parameters:
      coords - Building footprint coordinates.
      alphas - Absorption coefficients.
      id - Database primary key.
    • addBuilding

      public ProfileBuilder addBuilding(org.locationtech.jts.geom.Geometry geom, double height, List<Double> alphas, int id)
      Add the given Geometry footprint, height, alphas (absorption coefficients) and a database primary key as building.
      Parameters:
      geom - Building footprint.
      height - Building height.
      alphas - Absorption coefficients.
      id - Database primary key.
    • addBuilding

      public ProfileBuilder addBuilding(org.locationtech.jts.geom.Coordinate[] coords, double height, List<Double> alphas, int id)
      Add the given Geometry footprint.
      Parameters:
      height - Building height.
      alphas - Absorption coefficients.
      id - Database primary key.
    • addWall

      public ProfileBuilder addWall(org.locationtech.jts.geom.LineString geom, double height, int id)
      Add the given Geometry footprint, height, alphas (absorption coefficients) and a database id as wall.
      Parameters:
      geom - Wall footprint.
      height - Wall height.
      id - Database key.
    • addWall

      public ProfileBuilder addWall(org.locationtech.jts.geom.Coordinate[] coords, double height, int id)
      Add the given Geometry footprint, height, alphas (absorption coefficients) and a database id as wall.
      Parameters:
      coords - Wall footprint coordinates.
      height - Wall height.
      id - Database key.
    • addWall

      public ProfileBuilder addWall(org.locationtech.jts.geom.Coordinate[] coords, int id)
      Add the given Geometry footprint, height, alphas (absorption coefficients) and a database id as wall.
      Parameters:
      coords - Wall footprint coordinates.
      id - Database key.
    • addWall

      public ProfileBuilder addWall(Wall wall)
      Add the given Geometry footprint, height, alphas (absorption coefficients) and a database id as wall.
      Parameters:
      wall -
    • addWall

      public ProfileBuilder addWall(org.locationtech.jts.geom.LineString geom, double height, List<Double> alphas, int id)
      Add the given Geometry footprint, height, alphas (absorption coefficients) and a database id as wall.
      Parameters:
      geom - Wall footprint.
      height - Wall height.
      alphas - Absorption coefficient.
      id - Database key.
    • addWall

      public ProfileBuilder addWall(org.locationtech.jts.geom.Coordinate[] coords, double height, List<Double> alphas, int id)
      Add the given Geometry footprint, height, alphas (absorption coefficients) and a database id as wall.
      Parameters:
      coords - Wall footprint coordinates.
      id - Database key.
    • addWall

      public ProfileBuilder addWall(org.locationtech.jts.geom.Coordinate[] coords, List<Double> alphas, int id)
      Add the given Geometry footprint, height, alphas (absorption coefficients) and a database id as wall.
      Parameters:
      coords - Wall footprint coordinates.
      id - Database key.
    • addTopographicPoint

      public ProfileBuilder addTopographicPoint(org.locationtech.jts.geom.Coordinate point)
      Add the topographic point in the data, to complete the topographic data.
      Parameters:
      point - Topographic point.
    • addTopographicLine

      public ProfileBuilder addTopographicLine(org.locationtech.jts.geom.LineSegment segment)
      Add the topographic line in the data, to complete the topographic data.
    • addTopographicLine

      public ProfileBuilder addTopographicLine(org.locationtech.jts.geom.Coordinate p0, org.locationtech.jts.geom.Coordinate p1)
      Add the topographic line in the data, to complete the topographic data.
    • addTopographicLine

      public ProfileBuilder addTopographicLine(double x0, double y0, double z0, double x1, double y1, double z1)
      Add the topographic line in the data, to complete the topographic data.
    • addTopographicLine

      public ProfileBuilder addTopographicLine(org.locationtech.jts.geom.LineString lineSegment)
      Add the topographic line in the data, to complete the topographic data.
      Parameters:
      lineSegment - Topographic line.
    • addGroundEffect

      public ProfileBuilder addGroundEffect(org.locationtech.jts.geom.Geometry geom, double coefficient)
      Add a ground effect.
      Parameters:
      geom - Ground effect area footprint.
      coefficient - Ground effect coefficient.
    • addGroundEffect

      public ProfileBuilder addGroundEffect(double minX, double maxX, double minY, double maxY, double coefficient)
      Add a ground effect.
      Parameters:
      minX - Ground effect minimum X.
      maxX - Ground effect maximum X.
      minY - Ground effect minimum Y.
      maxY - Ground effect maximum Y.
      coefficient - Ground effect coefficient.
    • getProcessedWalls

      public List<Wall> getProcessedWalls()
    • getBuildings

      public List<Building> getBuildings()
      Retrieve the building list.
      Returns:
      The building list.
    • getBuildingCount

      public int getBuildingCount()
      Retrieve the count of building add to this builder.
      Returns:
      The count of building.
    • getBuilding

      public Building getBuilding(int id)
      Retrieve the building with the given id (id is starting from 1).
      Parameters:
      id - Id of the building
      Returns:
      The building corresponding to the given id.
    • getWalls

      public List<Wall> getWalls()
      Retrieve the wall list.
      Returns:
      The wall list.
    • getWallCount

      public int getWallCount()
      Retrieve the count of wall add to this builder.
      Returns:
      The count of wall.
    • getWall

      public Wall getWall(int id)
      Retrieve the wall with the given id (id is starting from 1).
      Parameters:
      id - Id of the wall
      Returns:
      The wall corresponding to the given id.
    • clearBuildings

      public void clearBuildings()
      Clear the building list.
    • getMeshEnvelope

      public org.locationtech.jts.geom.Envelope getMeshEnvelope()
      Retrieve the global profile envelope.
      Returns:
      The global profile envelope.
    • getTriangles

      public List<Triangle> getTriangles()
      Retrieve the topographic triangles.
      Returns:
      The topographic triangles.
    • getVertices

      public List<org.locationtech.jts.geom.Coordinate> getVertices()
      Retrieve the topographic vertices.
      Returns:
      The topographic vertices.
    • getReceivers

      public List<org.locationtech.jts.geom.Coordinate> getReceivers()
      Retrieve the receivers list.
      Returns:
      The receivers list.
    • getGroundEffects

      public List<GroundAbsorption> getGroundEffects()
      Retrieve the ground effects.
      Returns:
      The ground effects.
    • finishFeeding

      public ProfileBuilder finishFeeding()
      Finish the data feeding. Once called, no more data can be added and process it in order to prepare the profile retrieving. The building are processed to include each facets into a RTree The topographic points and lines are meshed using delaunay and triangles facets are included into a RTree
      Returns:
      True if the finishing has been successfully done, false otherwise.
    • getBuildingAtCoordinate

      public Building getBuildingAtCoordinate(org.locationtech.jts.geom.Coordinate pt)
      Retrieve the building at the given coordinate.
      Parameters:
      pt - Coordinate.
      Returns:
      The building at the given coordinate, null if no building is found.
    • getWallsIn

      public List<Wall> getWallsIn(org.locationtech.jts.geom.Envelope env)
      Parameters:
      env -
      Returns:
    • getProfile

      public CutProfile getProfile(org.locationtech.jts.geom.Coordinate c0, org.locationtech.jts.geom.Coordinate c1)
      Retrieve the cutting profile following the line build from the given coordinates.
      Parameters:
      c0 - Starting point.
      c1 - Ending point.
      Returns:
      Cutting profile.
    • splitSegment

      public static List<org.locationtech.jts.geom.LineSegment> splitSegment(org.locationtech.jts.geom.Coordinate c0, org.locationtech.jts.geom.Coordinate c1, double maxLineLength)
      split the segment between two points in segments of a given length maxLineLength
      Parameters:
      c0 -
      c1 -
      maxLineLength -
      Returns:
    • getProfile

      public CutProfile getProfile(org.locationtech.jts.geom.Coordinate sourceCoordinate, org.locationtech.jts.geom.Coordinate receiverCoordinate, double defaultGroundAttenuation, boolean stopAtObstacleOverSourceReceiver)
      Retrieve the cutting profile following the line build from the given coordinates.
      Parameters:
      sourceCoordinate - Starting point.
      receiverCoordinate - Ending point.
      defaultGroundAttenuation - Default absorption ground effect value if no ground absorption value is found
      stopAtObstacleOverSourceReceiver - If an obstacle is found higher than then segment sourceCoordinate receiverCoordinate, stop computing and a CutProfile with intersection information
      Returns:
      Cutting profile.
    • getIntersectingGroundAbsorption

      public int getIntersectingGroundAbsorption(org.locationtech.jts.geom.Geometry query)
      Fetch the first intersecting ground absorption object that intersects with the provided geometry
      Parameters:
      query - The geometry object to check for intersection
      Returns:
      The ground absorption object or null if nothing is found here
    • getTriangleIdByCoordinate

      public int getTriangleIdByCoordinate(org.locationtech.jts.geom.Coordinate pt)
      Return the triangle id from a point coordinate inside the triangle
      Parameters:
      pt - Point test
      Returns:
      Triangle Id, Or -1 if no triangle has been found
    • addTopoCutPts

      public void addTopoCutPts(org.locationtech.jts.geom.Coordinate p1, org.locationtech.jts.geom.Coordinate p2, CutProfile profile, boolean stopAtObstacleOverSourceReceiver)
      Parameters:
      p1 -
      p2 -
      profile -
    • fetchTopographicProfile

      public boolean fetchTopographicProfile(List<org.locationtech.jts.geom.Coordinate> outputPoints, org.locationtech.jts.geom.Coordinate p1, org.locationtech.jts.geom.Coordinate p2, boolean stopAtObstacleOverSourceReceiver)
      Fetch all intersections with TIN. For simplification only plane change are pushed.
      Parameters:
      p1 - first point
      p2 - second point
      stopAtObstacleOverSourceReceiver - Stop fetching intersections if the segment p1-p2 is intersecting with TIN
      Returns:
      True if the segment p1-p2 is not intersecting with DEM
    • hasDem

      public boolean hasDem()
      Returns:
      True if digital elevation model has been added
    • demAsMultiPolygon

      public org.locationtech.jts.geom.MultiPolygon demAsMultiPolygon()
      Returns:
      Mesh of digital elevation model
    • getZGround

      public double getZGround(org.locationtech.jts.geom.Coordinate coordinate)
      Returns:
      Altitude in meters from sea level
    • getZGround

      public double getZGround(org.locationtech.jts.geom.Coordinate coordinate, AtomicInteger triangleHint)
      Fetch Altitude in meters from sea level at a location. You can use the triangle hint if you request a lot of positions in the same location
      Parameters:
      coordinate - X,Y coordinate to fetch
      triangleHint - Triangle index hint (if >= 0 will be checked, and will be updated with the triangle is found)
      Returns:
      Altitude in meters from sea level
    • getPrecomputedWideAnglePoints

      public ArrayList<org.locationtech.jts.geom.Coordinate> getPrecomputedWideAnglePoints(int build)
      Parameters:
      build - 1-n based building identifier
      Returns:
    • getWideAnglePointsOnPolygon

      public ArrayList<org.locationtech.jts.geom.Coordinate> getWideAnglePointsOnPolygon(org.locationtech.jts.geom.LinearRing linearRing, double minAngle, double maxAngle)
      Parameters:
      linearRing - Coordinates loop
      minAngle -
      maxAngle -
      Returns:
    • getWallsOnPath

      public void getWallsOnPath(org.locationtech.jts.geom.Coordinate p1, org.locationtech.jts.geom.Coordinate p2, BuildingIntersectionPathVisitor visitor)
      Parameters:
      p1 -
      p2 -
      visitor -