2 Copyright (C) 2001, 2006 United States Government
3 as represented by the Administrator of the
4 National Aeronautics and Space Administration.
7 package gov
.nasa
.worldwind
.layers
;
9 import gov
.nasa
.worldwind
.tracks
.*;
10 import gov
.nasa
.worldwind
.geom
.Sector
;
11 import gov
.nasa
.worldwind
.util
.Logging
;
12 import gov
.nasa
.worldwind
.render
.DrawContext
;
13 import gov
.nasa
.worldwind
.globes
.SectorGeometryList
;
15 import java
.util
.List
;
19 * @version $Id: TrackLayer.java 2817 2007-09-12 19:28:14Z tgaskins $
21 public abstract class TrackLayer
extends AbstractLayer
23 private java
.util
.List
<Track
> tracks
= new java
.util
.ArrayList
<Track
>();
24 private Sector boundingSector
;
25 private int lowerLimit
;
26 private int upperLimit
;
27 private boolean overrideElevation
= false;
28 private double elevation
= 10d
;
30 public TrackLayer(List
<Track
> tracks
)
34 String msg
= Logging
.getMessage("nullValue.TracksIsNull");
35 Logging
.logger().severe(msg
);
36 throw new IllegalArgumentException(msg
);
40 this.boundingSector
= Sector
.boundingSector(this.iterator());
43 public TrackPointIteratorImpl
iterator()
45 return new TrackPointIteratorImpl(this.tracks
);
48 public int getNumPoints()
50 return this.iterator().getNumPoints();
53 public List
<Track
> getTracks()
58 public void setTracks(List
<Track
> tracks
)
63 public Sector
getBoundingSector()
65 return boundingSector
;
68 public void setBoundingSector(Sector boundingSector
)
70 this.boundingSector
= boundingSector
;
73 public int getLowerLimit()
78 public void setLowerLimit(int lowerLimit
)
80 this.lowerLimit
= lowerLimit
;
83 public int getUpperLimit()
88 public void setUpperLimit(int upperLimit
)
90 this.upperLimit
= upperLimit
;
93 public double getElevation()
95 return this.elevation
;
98 public void setElevation(double markerElevation
)
100 this.elevation
= markerElevation
;
103 public boolean isOverrideElevation()
105 return this.overrideElevation
;
108 public void setOverrideElevation(boolean overrideElevation
)
110 this.overrideElevation
= overrideElevation
;
114 public String
toString()
116 return Logging
.getMessage("layers.TrackLayer.Name");
120 protected void doPick(DrawContext dc
, java
.awt
.Point pickPoint
)
122 this.draw(dc
, pickPoint
);
125 protected void doRender(DrawContext dc
)
130 private void draw(DrawContext dc
, java
.awt
.Point pickPoint
)
132 TrackPointIterator trackPoints
= this.iterator();
133 if (!trackPoints
.hasNext())
136 if (dc
.getVisibleSector() == null)
139 SectorGeometryList geos
= dc
.getSurfaceGeometry();
143 if (!dc
.getVisibleSector().intersects(this.getBoundingSector()))
146 this.doDraw(dc
, trackPoints
, pickPoint
);
149 protected abstract void doDraw(DrawContext dc
, TrackPointIterator trackPoints
, java
.awt
.Point pickPoint
);