@@ -143,27 +143,6 @@ public static interface PositionColors {
143143 Color getColor (Position position , int ordinal );
144144 }
145145
146- /**
147- * Provides a concrete implementation of PositionColors that specifies a single color per position. Provided
148- * primarily to ease migration from {@link Polyline}.
149- */
150- public class OneColorPositionColors implements PositionColors {
151-
152- Color color ;
153-
154- OneColorPositionColors (Color color ) {
155- this .color = color ;
156- }
157-
158- /**
159- * {@inheritDoc}
160- */
161- @ Override
162- public Color getColor (Position position , int ordinal ) {
163- return color ;
164- }
165- }
166-
167146 /**
168147 * Maintains globe-dependent computed data such as Cartesian vertices and extents. One entry exists for each
169148 * distinct globe that this shape encounters in calls to {@link AbstractShape#render(DrawContext)}. See {@link
@@ -769,7 +748,7 @@ public Path(Position posA, Position posB) {
769748 throw new IllegalArgumentException (message );
770749 }
771750
772- List <Position > endPoints = new ArrayList <Position >(2 );
751+ List <Position > endPoints = new ArrayList <>(2 );
773752 endPoints .add (posA );
774753 endPoints .add (posB );
775754 this .setPositions (endPoints );
@@ -825,6 +804,7 @@ public void setPositions(Iterable<? extends Position> positions) {
825804 this .positions = positions ;
826805 this .computePositionCount ();
827806 this .positionsSpanDateline = LatLon .locationsCrossDateLine (this .positions );
807+ this .measurer .setPositions (this .positions );
828808
829809 this .reset ();
830810 }
@@ -955,11 +935,11 @@ public void setNumSubsegments(int numSubsegments) {
955935 * @return the path's length in meters.
956936 */
957937 public double getLength () {
958- Object foo = this .getCurrentPathData (). getEntries (); //.iterator ();
959- System . out . println ( foo );
960- // this.getCurrentPathData().getEntries()
961- // Iterator<Position> infos = this.positions.values().iterator();
962- return 0 ; // infos.hasNext() ? this.measurer.getLength(infos.next().globe) : 0;
938+ PathData data = this .getCurrentPathData ();
939+ if ( data != null && data . getGlobeStateKey () != null ) {
940+ return this .measurer . getLength ( data . getGlobeStateKey (). getGlobe ());
941+ }
942+ return 0 ;
963943 }
964944
965945 public double getLength (Globe globe ) {
@@ -1102,6 +1082,7 @@ public void setShowPositionsThreshold(double showPositionsThreshold) {
11021082 this .showPositionsThreshold = showPositionsThreshold ;
11031083 }
11041084
1085+ @ Override
11051086 public Sector getSector () {
11061087 if (this .sector == null && this .positions != null ) {
11071088 this .sector = Sector .boundingSector (this .positions );
@@ -1563,6 +1544,7 @@ protected void prepareToDrawPoints(DrawContext dc) {
15631544 *
15641545 * @param dc the current draw context.
15651546 */
1547+ @ Override
15661548 protected void doDrawInterior (DrawContext dc ) {
15671549 if (this .shouldUseVBOs (dc )) {
15681550 int [] vboIds = this .getVboIds (dc );
@@ -1867,8 +1849,8 @@ protected void makeTessellatedPositions(DrawContext dc, PathData pathData) {
18671849
18681850 if (pathData .tessellatedPositions == null || pathData .tessellatedPositions .size () < this .numPositions ) {
18691851 int size = (this .numSubsegments * (this .numPositions - 1 ) + 1 ) * (this .isExtrude () ? 2 : 1 );
1870- pathData .tessellatedPositions = new ArrayList <Position >(size );
1871- pathData .tessellatedColors = (this .positionColors != null ) ? new ArrayList <Color >(size ) : null ;
1852+ pathData .tessellatedPositions = new ArrayList <>(size );
1853+ pathData .tessellatedColors = (this .positionColors != null ) ? new ArrayList <>(size ) : null ;
18721854 } else {
18731855 pathData .tessellatedPositions .clear ();
18741856
@@ -1964,7 +1946,7 @@ protected void makePositions(DrawContext dc, PathData pathData) {
19641946
19651947 // Mark where the split position is so a new line is started there during rendering.
19661948 if (pathData .splitPositions == null ) {
1967- pathData .splitPositions = new ArrayList <Integer >(1 );
1949+ pathData .splitPositions = new ArrayList <>(1 );
19681950 }
19691951 pathData .splitPositions .add (pathData .tessellatedPositions .size ());
19701952
@@ -2347,6 +2329,7 @@ protected Extent computeExtent(PathData current) {
23472329 return box ;
23482330 }
23492331
2332+ @ Override
23502333 public Extent getExtent (Globe globe , double verticalExaggeration ) {
23512334 // See if we've cached an extent associated with the globe.
23522335 Extent extent = super .getExtent (globe , verticalExaggeration );
@@ -2375,10 +2358,12 @@ public Extent getExtent(Globe globe, double verticalExaggeration) {
23752358 *
23762359 * @return the computed reference position.
23772360 */
2361+ @ Override
23782362 public Position getReferencePosition () {
23792363 return this .numPositions < 1 ? null : this .positions .iterator ().next (); // use the first position
23802364 }
23812365
2366+ @ Override
23822367 protected void fillVBO (DrawContext dc ) {
23832368 PathData pathData = this .getCurrentPathData ();
23842369 int numIds = this .isShowPositions () ? 3 : pathData .hasExtrusionPoints && this .isDrawVerticals () ? 2 : 1 ;
@@ -2433,6 +2418,7 @@ public List<Intersection> intersect(Line line, Terrain terrain) throws Interrupt
24332418 return null ;
24342419 }
24352420
2421+ @ Override
24362422 public void move (Position delta ) {
24372423 if (delta == null ) {
24382424 String msg = Logging .getMessage ("nullValue.PositionIsNull" );
@@ -2452,6 +2438,7 @@ public void move(Position delta) {
24522438 this .moveTo (refPos .add (delta ));
24532439 }
24542440
2441+ @ Override
24552442 public void moveTo (Position position ) {
24562443 if (position == null ) {
24572444 String msg = Logging .getMessage ("nullValue.PositionIsNull" );
@@ -2546,83 +2533,13 @@ protected void doExportAsKML(XMLStreamWriter xmlWriter) throws IOException, XMLS
25462533 }
25472534
25482535 /**
2549- * Provided to ease the transition from Polyline
2550- *
2551- * @param color
2552- */
2553- public void setColor (Color color ) {
2554- if (color == null ) {
2555- String msg = Logging .getMessage ("nullValue.ColorIsNull" );
2556- Logging .logger ().severe (msg );
2557- throw new IllegalArgumentException (msg );
2558- }
2559-
2560- setPositionColors (new OneColorPositionColors (color ));
2561- if (this .surfaceShape != null ) {
2562- ShapeAttributes attrs = this .surfaceShape .getAttributes ();
2563- attrs .setOutlineMaterial (new Material (color ));
2564- attrs .setOutlineOpacity (color .getAlpha () / 255.0 );
2565- attrs .setInteriorMaterial (attrs .getOutlineMaterial ());
2566- attrs .setInteriorOpacity (attrs .getOutlineOpacity ());
2567- }
2568-
2569- }
2570-
2571- /**
2572- * Provided to ease the transition from Polyline
2573- *
2574- * @param lineWidth
2575- */
2576- public void setLineWidth (double lineWidth ) {
2577-
2578- this .activeAttributes .setOutlineWidth (lineWidth );
2579- this .reset ();
2580- if (this .surfaceShape != null ) {
2581- this .surfaceShape .getAttributes ().setOutlineWidth (this .activeAttributes .getOutlineWidth ());
2582- }
2583- }
2584-
2585- /**
2586- * Specifies an offset, in meters, to add to the path points when the path's follow-terrain attribute is true. See
2587- * {@link #setFollowTerrain(boolean)}. Provided to ease the transition from Polyline
2536+ * Specifies an offset, in meters, to add to the path points when the path's altitude mode is
2537+ * {@link WorldWind.CLAMP_TO_GROUND}. See {@link #setAltitudeMode(int) }.
25882538 *
25892539 * @param offset the path offset in meters.
25902540 */
25912541 public void setOffset (double offset ) {
2592- this .offset = offset ;
2542+ this .offset = offset ;
25932543 this .reset ();
25942544 }
2595-
2596- /**
2597- * Sets the stipple pattern for specifying line types other than solid. See the OpenGL specification or programming
2598- * guides for a description of this parameter. Stipple is also affected by the path's stipple factor, {@link
2599- * #setStippleFactor(int)}.
2600- *
2601- * @param stipplePattern the stipple pattern.
2602- */
2603- public void setStipplePattern (short stipplePattern ) {
2604- System .out .println ("foo" );
2605-
2606- // this.stipplePattern = stipplePattern;
2607- // if (this.surfaceShape != null) {
2608- // this.surfaceShape.getAttributes().setOutlineStipplePattern(this.stipplePattern);
2609- // }
2610- }
2611-
2612- /**
2613- * Sets the stipple factor for specifying line types other than solid. See the OpenGL specification or programming
2614- * guides for a description of this parameter. Stipple is also affected by the path's stipple pattern, {@link
2615- * #setStipplePattern(short)}.
2616- *
2617- * @param stippleFactor the stipple factor.
2618- */
2619- public void setStippleFactor (int stippleFactor ) {
2620- System .out .println ("foo" );
2621- // this.stippleFactor = stippleFactor;
2622- //
2623- // if (this.surfaceShape != null) {
2624- // this.surfaceShape.getAttributes().setOutlineStippleFactor(this.stippleFactor);
2625- // }
2626- }
2627-
26282545}
0 commit comments