WorldWindJava icon indicating copy to clipboard operation
WorldWindJava copied to clipboard

PointPlacemark & PointPlacemarkAttributes Pitch

Open mainstringargs opened this issue 7 years ago • 1 comments

Description

Setting the Pitch on PointPlacemarkAttributes does not seem to work correctly

Steps to Reproduce

This simple example attempts to set a pitch on the PointPlacemark through the PointPlacemarkAttributes. (Uncomment the setPitch line to duplicate screenshots)

package gov.nasa.worldwindx.examples;

import gov.nasa.worldwind.WorldWind;
import gov.nasa.worldwind.avlist.AVKey;
import gov.nasa.worldwind.geom.Position;
import gov.nasa.worldwind.layers.RenderableLayer;
import gov.nasa.worldwind.render.Offset;
import gov.nasa.worldwind.render.PointPlacemark;
import gov.nasa.worldwind.render.PointPlacemarkAttributes;

public class Placemarks extends ApplicationTemplate {
	public static class AppFrame extends ApplicationTemplate.AppFrame {
		public AppFrame() {
			super(true, true, false);

			final RenderableLayer layer = new RenderableLayer();

			PointPlacemark pp = new PointPlacemark(Position.fromDegrees(28, -102, 30000));
			pp.setLabelText("PointPlacemark");
			pp.setLineEnabled(false);
			pp.setAltitudeMode(WorldWind.ABSOLUTE);
			PointPlacemarkAttributes attrs = new PointPlacemarkAttributes();
            attrs.setImageAddress("gov/nasa/worldwindx/examples/images/georss.png");
			attrs.setScale(1.0);
			attrs.setImageOffset(Offset.CENTER);
			
//			attrs.setPitch(10.0);
//			attrs.setPitch(45.0);
			
			pp.setAttributes(attrs);
			layer.addRenderable(pp);

			// Add the layer to the model.
			insertBeforeCompass(getWwd(), layer);
		}
	}

	public static void main(String[] args) {
		ApplicationTemplate.start("WorldWind Placemarks", AppFrame.class);
	}
}

Expected behavior: [What you expect to happen]

I'd expect the icons to "tilt", but it seems instead they are being scrunched.

Actual behavior:

setPitch(0.0):

nopitch

setPitch(10.0):

tenpitch

setPitch(45.0):

fortyfivepitch

Reproduces how often: [What percentage of the time does it reproduce?]

N/A

Operating System and Version

Windows 10

Additional Information

N/A

mainstringargs avatar Feb 26 '18 17:02 mainstringargs

The problem is with z arguments to glOrtho in PointPlacemark. See https://stackoverflow.com/questions/49637844/worldwind-pointplacemark-pitch/49756209#49756209 for fix. I could PR... pretty small change though, probably easier for someone here to make directly.

xinaesthete avatar Apr 11 '18 12:04 xinaesthete