Skip to content

Commit d438cdf

Browse files
Fixing issue with setting Pitch on PointPlacemarks. See: https://stackoverflow.com/questions/49637844/worldwind-pointplacemark-pitch
1 parent 9312416 commit d438cdf

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

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

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -977,9 +977,24 @@ protected void doDrawOrderedRenderable(DrawContext dc, PickSupport pickCandidate
977977
(byte) color.getAlpha());
978978
}
979979

980-
// The image is drawn using a parallel projection.
981-
osh.pushProjectionIdentity(gl);
982-
gl.glOrtho(0d, dc.getView().getViewport().width, 0d, dc.getView().getViewport().height, -1d, 1d);
980+
// Compute the scale
981+
double xscale;
982+
Double scale = this.getActiveAttributes().getScale();
983+
if (scale != null)
984+
xscale = scale * this.activeTexture.getWidth(dc);
985+
else
986+
xscale = this.activeTexture.getWidth(dc);
987+
988+
double yscale;
989+
if (scale != null)
990+
yscale = scale * this.activeTexture.getHeight(dc);
991+
else
992+
yscale = this.activeTexture.getHeight(dc);
993+
double maxwh = Math.max(xscale, yscale);
994+
995+
// The image is drawn using a parallel projection.
996+
osh.pushProjectionIdentity(gl);
997+
gl.glOrtho(0d, dc.getView().getViewport().width, 0d, dc.getView().getViewport().height, -0.6 * maxwh, 0.6 * maxwh);
983998

984999
// Apply the depth buffer but don't change it (for screen-space shapes).
9851000
if ((!dc.isDeepPickingEnabled()))
@@ -1001,20 +1016,6 @@ protected void doDrawOrderedRenderable(DrawContext dc, PickSupport pickCandidate
10011016
osh.pushModelviewIdentity(gl);
10021017
gl.glTranslated(opm.screenPoint.x + this.dx, opm.screenPoint.y + this.dy, 0);
10031018

1004-
// Compute the scale
1005-
double xscale;
1006-
Double scale = this.getActiveAttributes().getScale();
1007-
if (scale != null)
1008-
xscale = scale * this.activeTexture.getWidth(dc);
1009-
else
1010-
xscale = this.activeTexture.getWidth(dc);
1011-
1012-
double yscale;
1013-
if (scale != null)
1014-
yscale = scale * this.activeTexture.getHeight(dc);
1015-
else
1016-
yscale = this.activeTexture.getHeight(dc);
1017-
10181019
Double heading = getActiveAttributes().getHeading();
10191020
Double pitch = getActiveAttributes().getPitch();
10201021

0 commit comments

Comments
 (0)