Skip to content

Commit

Permalink
save wall/building primary key
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-f committed Dec 11, 2024
1 parent 3e4a506 commit 1fa1e7f
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,9 @@ public static org.apache.commons.math3.geometry.euclidean.threed.Vector3D coordi
private void insertReflectionPointAttributes(CutPoint sourceOrReceiverPoint, List<CutPoint> mainProfileCutPoints, MirrorReceiver mirrorReceiver) {
CutPointReflection reflectionPoint = new CutPointReflection(sourceOrReceiverPoint,
mirrorReceiver.getWall().getLineSegment(), mirrorReceiver.getWall().getAlphas());
if(mirrorReceiver.wall.primaryKey >= 0) {
reflectionPoint.wallPk = mirrorReceiver.wall.primaryKey;
}
mainProfileCutPoints.add(reflectionPoint);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
package org.noise_planet.noisemodelling.pathfinder.profilebuilder;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.LineSegment;

Expand All @@ -21,12 +22,9 @@ public class CutPointReflection extends CutPoint {
* z is altitude
*/
public LineSegment wall;
/**
* Unique external identifier of the wall. Could be the primary key of the related building in the database
*/
public long wallPrimaryKey = -1;

/** Database primary key value of the obstacle */
/** Unique external identifier of the wall. Could be the primary key of the related building in the database */
@JsonInclude(JsonInclude.Include.NON_NULL)
public Long wallPk = null;

/**
Expand Down Expand Up @@ -76,7 +74,7 @@ public void setWallAlpha(List<Double> wallAlpha) {
public String toString() {
return "CutPointReflection{" +
"\nwall=" + wall +
"\n, wallPrimaryKey=" + wallPrimaryKey +
(wallPk == null ? "" : "\n, wallPrimaryKey=" + wallPk) +
"\n, wallAlpha=" + wallAlpha +
"\n, coordinate=" + coordinate +
"\n, zGround=" + zGround +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,6 @@
*/
public class CutPointVEdgeDiffraction extends CutPoint {

/** Database primary key value of the obstacle */
public Long wallPk = null;

public CutPointVEdgeDiffraction setPk(long pk) {
this.wallPk = pk;
return this;
}

/**
* Empty constructor for deserialization
*/
Expand All @@ -30,4 +22,13 @@ public CutPointVEdgeDiffraction() {
public CutPointVEdgeDiffraction(CutPoint source) {
super(source);
}

@Override
public String toString() {
return "CutPointVEdgeDiffraction{" +
", coordinate=" + coordinate +
", zGround=" + zGround +
", groundCoefficient=" + groundCoefficient +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import org.locationtech.jts.geom.Coordinate;
import org.locationtech.jts.geom.LineSegment;

Expand Down Expand Up @@ -41,6 +42,7 @@ public enum INTERSECTION_TYPE { AREA_ENTER, AREA_EXIT, LINE_ENTER_EXIT}
public INTERSECTION_TYPE intersectionType = INTERSECTION_TYPE.LINE_ENTER_EXIT;

/** Database primary key value of the obstacle */
@JsonInclude(JsonInclude.Include.NON_NULL)
public Long wallPk = null;

/**
Expand All @@ -56,8 +58,15 @@ public CutPointWall(int processedWallIndex, Coordinate intersection, LineSegment
this.wallAlpha = wallAlpha;
}

/**
*
* @param pk External primary key value, will be updated if >= 0
* @return this
*/
public CutPointWall setPk(long pk) {
this.wallPk = pk;
if(pk >= 0) {
this.wallPk = pk;
}
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,9 @@ private boolean processWall(int processedWallIndex, Coordinate intersection, Wal
CutPointWall cutPointWall = new CutPointWall(processedWallIndex,
intersection, facetLine.getLineSegment(), facetLine.alphas);
cutPointWall.intersectionType = CutPointWall.INTERSECTION_TYPE.LINE_ENTER_EXIT;
cutPointWall.setPk(facetLine.primaryKey);
if(facetLine.primaryKey >= 0) {
cutPointWall.setPk(facetLine.primaryKey);
}
newCutPoints.add(cutPointWall);

double zRayReceiverSource = Vertex.interpolateZ(intersection, fullLine.p0, fullLine.p1);
Expand All @@ -1044,7 +1046,9 @@ private boolean processBuilding(int processedWallIndex, Coordinate intersection,
boolean stopAtObstacleOverSourceReceiver, CutProfile profile) {
CutPointWall wallCutPoint = new CutPointWall(processedWallIndex, intersection, facetLine.getLineSegment(),
buildings.get(facetLine.getOriginId()).alphas);
wallCutPoint.setPk(facetLine.primaryKey);
if(facetLine.primaryKey >= 0) {
wallCutPoint.setPk(facetLine.primaryKey);
}
newCutPoints.add(wallCutPoint);
double zRayReceiverSource = Vertex.interpolateZ(intersection, fullLine.p0, fullLine.p1);
// add a point at the bottom of the building on the exterior side of the building
Expand Down

0 comments on commit 1fa1e7f

Please sign in to comment.