public class GpxLayer extends Layer
Layer.LayerAction, Layer.LayerGpxExportAction, Layer.LayerSaveAction, Layer.LayerSaveAsAction, Layer.MultiLayerAction, Layer.SeparatorLayerAction
Modifier and Type | Field and Description |
---|---|
GpxData |
data |
private GpxDrawHelper |
drawHelper |
private boolean |
isLocalFile |
private java.util.List<GpxTrack> |
lastTracks |
private int |
lastUpdateCount |
boolean[] |
trackVisibility |
ICON_SIZE, NAME_PROP, OPACITY_PROP, propertyChangeSupport, VISIBLE_PROP
Constructor and Description |
---|
GpxLayer(GpxData d) |
GpxLayer(GpxData d,
java.lang.String name) |
GpxLayer(GpxData d,
java.lang.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.)
|
java.io.File |
createAndOpenSaveFileChooser()
Creates a new "Save" dialog for this layer and makes it visible.
When the user has chosen a file, checks the file extension, and confirms overwrite if needed. |
private void |
ensureTrackVisibilityLength()
ensures the trackVisibility array has the correct length without losing data.
|
void |
filterTracksByDate(java.util.Date fromDate,
java.util.Date toDate,
boolean showWithoutDate) |
java.io.File |
getAssociatedFile() |
java.awt.Color |
getColor(boolean ignoreCustom)
Return a Color for this layer.
|
javax.swing.Icon |
getIcon()
Return a representative small image for this layer.
|
java.lang.Object |
getInfoComponent() |
javax.swing.Action[] |
getMenuEntries()
Returns list of actions.
|
static java.lang.String |
getTimespanForTrack(GpxTrack trk)
Returns a human readable string that shows the timespan of the given track
|
java.lang.String |
getToolTipText() |
boolean |
isChanged()
Check changed status of layer
|
boolean |
isInfoResizable()
Determines if info dialog can be resized (false by default).
|
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).
|
private java.util.List<WayPoint> |
listVisibleSegments(Bounds box) |
void |
mergeFrom(Layer from)
Merges the given layer into this layer.
|
void |
paint(java.awt.Graphics2D g,
MapView mv,
Bounds box)
Paint the dataset using the engine set.
|
void |
projectionChanged(Projection oldValue,
Projection newValue) |
void |
setAssociatedFile(java.io.File file) |
private int |
sumUpdateCount() |
void |
visitBoundingBox(BoundingXYVisitor v) |
addPropertyChangeListener, destroy, fireOpacityChanged, fireVisibleChanged, getName, getOpacity, hookUpMapView, isBackgroundLayer, isProjectionSupported, isVisible, nameSupportedProjections, onPostLoadFromFile, removePropertyChangeListener, setBackgroundLayer, setName, setOpacity, setVisible, toggleVisible
private boolean isLocalFile
public boolean[] trackVisibility
private final java.util.List<GpxTrack> lastTracks
private int lastUpdateCount
private final GpxDrawHelper drawHelper
public java.awt.Color getColor(boolean ignoreCustom)
Layer
public static java.lang.String getTimespanForTrack(GpxTrack trk)
trk
- The GPX track for which timespan is displayedpublic javax.swing.Icon getIcon()
Layer
public java.lang.Object getInfoComponent()
getInfoComponent
in class Layer
public boolean isInfoResizable()
Layer
isInfoResizable
in class Layer
true
if the info dialog can be resized, false
otherwisepublic javax.swing.Action[] getMenuEntries()
Layer
getMenuEntries
in class Layer
public boolean isLocalFile()
public java.lang.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(java.util.Date fromDate, java.util.Date toDate, boolean showWithoutDate)
public void mergeFrom(Layer from)
Layer
public void paint(java.awt.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.private java.util.List<WayPoint> listVisibleSegments(Bounds box)
public void visitBoundingBox(BoundingXYVisitor v)
visitBoundingBox
in class Layer
public java.io.File getAssociatedFile()
getAssociatedFile
in class Layer
public void setAssociatedFile(java.io.File file)
setAssociatedFile
in class Layer
private 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 java.io.File createAndOpenSaveFileChooser()
Layer
createAndOpenSaveFileChooser
in class Layer
File
SaveActionBase.createAndOpenSaveFileChooser(java.lang.String, org.openstreetmap.josm.actions.ExtensionFileFilter)