Skip to content

Commit 0f308c1

Browse files
committed
Polyline deprecation fixes
1 parent 5301c83 commit 0f308c1

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/gov/nasa/worldwind/render/Path.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,7 @@ protected PathData getCurrentPathData() {
673673

674674
protected String pathType = DEFAULT_PATH_TYPE;
675675
protected boolean followTerrain; // true if altitude mode indicates terrain following
676+
protected double offset = 0; // offset to use in clamp to ground mode
676677
protected boolean extrude;
677678
protected double terrainConformance = DEFAULT_TERRAIN_CONFORMANCE;
678679
protected int numSubsegments = DEFAULT_NUM_SUBSEGMENTS;
@@ -1608,7 +1609,7 @@ protected void computePath(DrawContext dc, List<Position> positions, PathData pa
16081609
FloatBuffer path = pathData.renderedPath;
16091610

16101611
if (this.getAltitudeMode() == WorldWind.CLAMP_TO_GROUND || dc.is2DGlobe()) {
1611-
path = this.computePointsRelativeToTerrain(dc, positions, 0d, path, pathData);
1612+
path = this.computePointsRelativeToTerrain(dc, positions, offset, path, pathData);
16121613
} else if (this.getAltitudeMode() == WorldWind.RELATIVE_TO_GROUND) {
16131614
path = this.computePointsRelativeToTerrain(dc, positions, null, path, pathData);
16141615
} else {
@@ -2588,11 +2589,8 @@ public void setLineWidth(double lineWidth) {
25882589
* @param offset the path offset in meters.
25892590
*/
25902591
public void setOffset(double offset) {
2591-
ArrayList<Position> newPositions = new ArrayList<>();
2592-
for (Position p : this.positions) {
2593-
newPositions.add(new Position(p, offset));
2594-
}
2595-
this.setPositions(newPositions);
2592+
this.offset=offset;
2593+
this.reset();
25962594
}
25972595

25982596
/**

src/gov/nasa/worldwindx/examples/Shapes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ private void update() {
211211
path.setLineWidth(currentPathWidth);
212212
path.setFollowTerrain(currentFollowTerrain);
213213
if (path.isFollowTerrain()) {
214-
path.setAltitudeMode(WorldWind.RELATIVE_TO_GROUND);
214+
path.setAltitudeMode(WorldWind.CLAMP_TO_GROUND);
215215
} else {
216216
path.setAltitudeMode(WorldWind.ABSOLUTE);
217217
}

0 commit comments

Comments
 (0)