2121
2222import java .awt .*;
2323import java .awt .event .*;
24+ import java .beans .*;
2425import java .util .*;
2526import java .util .List ;
2627
4041 * @author tag
4142 * @version $Id: ShapeEditor.java 3423 2015-09-23 20:59:03Z tgaskins $
4243 */
43- public class ShapeEditor implements SelectListener
44+ public class ShapeEditor implements SelectListener , PropertyChangeListener
4445{
4546 // Control point purposes
4647 /**
@@ -680,6 +681,7 @@ protected void enable()
680681 this .updateControlPoints ();
681682
682683 this .getWwd ().addSelectListener (this );
684+ this .getWwd ().getSceneController ().addPropertyChangeListener (this );
683685 }
684686
685687 /**
@@ -695,6 +697,7 @@ protected void disable()
695697 layers .remove (this .getShadowLayer ());
696698
697699 getWwd ().removeSelectListener (this );
700+ getWwd ().getSceneController ().removePropertyChangeListener (this );
698701
699702 ((Component ) this .getWwd ()).setCursor (null );
700703 }
@@ -846,6 +849,28 @@ else if (dragEvent.getTopPickedObject().getParentLayer() == this.getControlPoint
846849 }
847850 }
848851
852+ /**
853+ * The property change listener, the method called when a property of the Scene Controller changes
854+ * (vertical exaggeration, etc.). Does not necessarily indicate a property associated with this editor.
855+ *
856+ * @param event the property change event indicating the property name and its associated value.
857+ */
858+ public void propertyChange (PropertyChangeEvent event )
859+ {
860+ if (event == null )
861+ {
862+ String msg = Logging .getMessage ("nullValue.EventIsNull" );
863+ Logging .logger ().log (java .util .logging .Level .FINE , msg );
864+ throw new IllegalArgumentException (msg );
865+ }
866+
867+ if (event .getPropertyName ().equals (AVKey .VERTICAL_EXAGGERATION ))
868+ {
869+ // The orientation line altitudes depend on the vertical exaggeration.
870+ this .updateControlPoints ();
871+ }
872+ }
873+
849874 /**
850875 * Creates the shape that will remain at the same location and is the same size as the shape to be edited.
851876 */
@@ -1230,11 +1255,17 @@ protected void updateOrientationLine(Position centerPosition, Position controlPo
12301255 rotationLine .setAltitudeMode (WorldWind .RELATIVE_TO_GROUND );
12311256 rotationLine .setFollowTerrain (true );
12321257
1233- // Add a little altitude so that the line isn't lost during depth buffering .
1234- cAltitude = 100 + centerPosition .getAltitude () - this .getWwd ().getModel ().getGlobe ().getElevation (
1258+ // Set the line's altitude relative to the ground .
1259+ cAltitude = centerPosition .getAltitude () - this .getWwd ().getModel ().getGlobe ().getElevation (
12351260 centerPosition .getLatitude (), centerPosition .getLongitude ());
1236- rAltitude = 100 + controlPoint .getAltitude () - this .getWwd ().getModel ().getGlobe ().getElevation (
1261+ rAltitude = controlPoint .getAltitude () - this .getWwd ().getModel ().getGlobe ().getElevation (
12371262 controlPoint .getLatitude (), controlPoint .getLongitude ());
1263+ // Path does not incorporate vertical exaggeration, but airspace shapes do. Compensate for that difference here.
1264+ cAltitude *= this .getWwd ().getSceneController ().getVerticalExaggeration ();
1265+ rAltitude *= this .getWwd ().getSceneController ().getVerticalExaggeration ();
1266+ // Add a little altitude so that the line isn't lost during depth buffering.
1267+ cAltitude += 100 ;
1268+ rAltitude += 100 ;
12381269 }
12391270 else if (this .getShapeAltitudeMode () == WorldWind .CLAMP_TO_GROUND )
12401271 {
0 commit comments