public class GpxLayer extends Layer
Modifier and Type | Class and Description |
---|---|
(package private) static class |
GpxLayer.colorModes |
Layer.LayerAction, Layer.LayerGpxExportAction, Layer.LayerSaveAction, Layer.LayerSaveAsAction, Layer.MultiLayerAction, Layer.SeparatorLayerAction
Modifier and Type | Field and Description |
---|---|
private static Color[] |
colors |
private static Color[] |
colors_cyclic |
private boolean |
computeCacheColorDynamic |
private GpxLayer.colorModes |
computeCacheColored |
private int |
computeCacheColorTracksTune |
private Color |
computeCacheColorUsed |
private boolean |
computeCacheInSync |
private int |
computeCacheMaxLineLengthUsed |
GpxData |
data |
private static int[][] |
dir |
private boolean |
isLocalFile |
private List<GpxTrack> |
lastTracks |
private int |
lastUpdateCount |
private static int |
ll0 |
protected static double |
PHI |
private static int |
sl4 |
private static int |
sl9 |
boolean[] |
trackVisibility |
ICON_SIZE, NAME_PROP, OPACITY_PROP, propertyChangeSupport, VISIBLE_PROP
Constructor and Description |
---|
GpxLayer(GpxData d) |
GpxLayer(GpxData d,
String name) |
GpxLayer(GpxData d,
String name,
boolean isLocal) |
Modifier and Type | Method and Description |
---|---|
boolean |
checkSaveConditions()
Checks whether it is ok to launch a save (whether we have data, there is no conflict etc.)
|
File |
createAndOpenSaveFileChooser()
Creates a new "Save" dialog for this layer and makes it visible.
|
private void |
ensureTrackVisibilityLength()
ensures the trackVisibility array has the correct length without losing data.
|
void |
filterTracksByDate(Date fromDate,
Date toDate,
boolean showWithoutDate) |
File |
getAssociatedFile() |
Color |
getColor(boolean ignoreCustom)
Return a Color for this layer.
|
GpxLayer.colorModes |
getColorMode() |
static Color |
getGenericColor() |
Icon |
getIcon()
Return a representative small image for this layer.
|
Object |
getInfoComponent() |
Action[] |
getMenuEntries()
Returns list of actions.
|
Date[] |
getMinMaxTimeForAllTracks()
Returns minimum and maximum timestamps for all tracks
Warning: there are lot of track with broken timestamps,
so we just ingore points from future and from year before 1970 in this method
works correctly @since 5815
|
static Date[] |
getMinMaxTimeForTrack(GpxTrack trk)
returns minimum and maximum timestamps in the track
|
static String |
getTimespanForTrack(GpxTrack trk)
returns a human readable string that shows the timespan of the given track
|
String |
getToolTipText() |
boolean |
isChanged()
Check changed status of layer
|
boolean |
isLocalFile() |
boolean |
isMergable(Layer other) |
boolean |
isSavable()
Replies the savable state of this layer (i.e if it can be saved through a "File->Save" dialog).
|
void |
mergeFrom(Layer from)
Merges the given layer into this layer.
|
void |
paint(Graphics2D g,
MapView mv,
Bounds box)
Paint the dataset using the engine set.
|
void |
projectionChanged(Projection oldValue,
Projection newValue) |
void |
setAssociatedFile(File file) |
private int |
sumUpdateCount() |
void |
visitBoundingBox(BoundingXYVisitor v) |
private static float |
w(float x)
transition function:
w(0)=1, w(1)=0, 0<=w(x)<=1
|
addPropertyChangeListener, destroy, fireOpacityChanged, fireVisibleChanged, getName, getOpacity, hookUpMapView, isBackgroundLayer, isProjectionSupported, isVisible, nameSupportedProjections, onPostLoadFromFile, removePropertyChangeListener, setBackgroundLayer, setName, setOpacity, setVisible, toggleVisible
protected static final double PHI
private boolean computeCacheInSync
private int computeCacheMaxLineLengthUsed
private Color computeCacheColorUsed
private boolean computeCacheColorDynamic
private GpxLayer.colorModes computeCacheColored
private int computeCacheColorTracksTune
private boolean isLocalFile
public boolean[] trackVisibility
private final List<GpxTrack> lastTracks
private int lastUpdateCount
private static final Color[] colors_cyclic
private static final int ll0
private static final int sl4
private static final int sl9
private static final int[][] dir
public static Date[] getMinMaxTimeForTrack(GpxTrack trk)
public Date[] getMinMaxTimeForAllTracks()
public static String getTimespanForTrack(GpxTrack trk)
public Icon getIcon()
Layer
public Object getInfoComponent()
getInfoComponent
in class Layer
public Color getColor(boolean ignoreCustom)
Layer
public GpxLayer.colorModes getColorMode()
public static Color getGenericColor()
public Action[] getMenuEntries()
Layer
getMenuEntries
in class Layer
public boolean isLocalFile()
public String getToolTipText()
getToolTipText
in class Layer
public boolean isMergable(Layer other)
isMergable
in class Layer
other
- The other layer that is tested to be mergable with this.private int sumUpdateCount()
public boolean isChanged()
Layer
public void filterTracksByDate(Date fromDate, Date toDate, boolean showWithoutDate)
public void mergeFrom(Layer from)
Layer
private static float w(float x)
x
- number: 0<=x<=1public void paint(Graphics2D g, MapView mv, Bounds box)
Layer
paint
in interface MapViewPaintable
paint
in class Layer
mv
- The object that can translate GeoPoints to screen coordinates.public void visitBoundingBox(BoundingXYVisitor v)
visitBoundingBox
in class Layer
public File getAssociatedFile()
getAssociatedFile
in class Layer
public void setAssociatedFile(File file)
setAssociatedFile
in class Layer
private final void ensureTrackVisibilityLength()
public void projectionChanged(Projection oldValue, Projection newValue)
projectionChanged
in interface ProjectionChangeListener
projectionChanged
in class Layer
public boolean isSavable()
Layer
public boolean checkSaveConditions()
Layer
checkSaveConditions
in class Layer
true
, if it is safe to save.public File createAndOpenSaveFileChooser()
Layer
createAndOpenSaveFileChooser
in class Layer
File
SaveActionBase.createAndOpenSaveFileChooser(java.lang.String, org.openstreetmap.josm.actions.ExtensionFileFilter)