21
21
22
22
import java .awt .*;
23
23
import java .awt .event .*;
24
+ import java .beans .*;
24
25
import java .util .*;
25
26
import java .util .List ;
26
27
40
41
* @author tag
41
42
* @version $Id: ShapeEditor.java 3423 2015-09-23 20:59:03Z tgaskins $
42
43
*/
43
- public class ShapeEditor implements SelectListener
44
+ public class ShapeEditor implements SelectListener , PropertyChangeListener
44
45
{
45
46
// Control point purposes
46
47
/**
@@ -680,6 +681,7 @@ protected void enable()
680
681
this .updateControlPoints ();
681
682
682
683
this .getWwd ().addSelectListener (this );
684
+ this .getWwd ().getSceneController ().addPropertyChangeListener (this );
683
685
}
684
686
685
687
/**
@@ -695,6 +697,7 @@ protected void disable()
695
697
layers .remove (this .getShadowLayer ());
696
698
697
699
getWwd ().removeSelectListener (this );
700
+ getWwd ().getSceneController ().removePropertyChangeListener (this );
698
701
699
702
((Component ) this .getWwd ()).setCursor (null );
700
703
}
@@ -846,6 +849,28 @@ else if (dragEvent.getTopPickedObject().getParentLayer() == this.getControlPoint
846
849
}
847
850
}
848
851
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
+
849
874
/**
850
875
* Creates the shape that will remain at the same location and is the same size as the shape to be edited.
851
876
*/
@@ -1230,11 +1255,17 @@ protected void updateOrientationLine(Position centerPosition, Position controlPo
1230
1255
rotationLine .setAltitudeMode (WorldWind .RELATIVE_TO_GROUND );
1231
1256
rotationLine .setFollowTerrain (true );
1232
1257
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 (
1235
1260
centerPosition .getLatitude (), centerPosition .getLongitude ());
1236
- rAltitude = 100 + controlPoint .getAltitude () - this .getWwd ().getModel ().getGlobe ().getElevation (
1261
+ rAltitude = controlPoint .getAltitude () - this .getWwd ().getModel ().getGlobe ().getElevation (
1237
1262
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 ;
1238
1269
}
1239
1270
else if (this .getShapeAltitudeMode () == WorldWind .CLAMP_TO_GROUND )
1240
1271
{
0 commit comments