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 List<GpxTrack> |
lastTracks |
private int |
lastUpdateCount |
boolean[] |
trackVisibility |
FILTER_STATE_PROP, 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.
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(Date fromDate,
Date toDate,
boolean showWithoutDate) |
File |
getAssociatedFile() |
Color |
getColor(boolean ignoreCustom)
Return a Color for this layer.
|
Icon |
getIcon()
Return a representative small image for this layer.
|
Object |
getInfoComponent() |
Action[] |
getMenuEntries()
Returns list of actions.
|
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 |
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 List<WayPoint> |
listVisibleSegments(Bounds box) |
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) |
addPropertyChangeListener, destroy, estimateMemoryUsage, fireFilterStateChanged, fireOpacityChanged, fireVisibleChanged, getName, getOpacity, hookUpMapView, isBackgroundLayer, isProjectionSupported, isVisible, nameSupportedProjections, onPostLoadFromFile, removePropertyChangeListener, setBackgroundLayer, setFilterStateChanged, setName, setOpacity, setVisible, toggleVisible
private boolean isLocalFile
public boolean[] trackVisibility
private final List<GpxTrack> lastTracks
private int lastUpdateCount
private final GpxDrawHelper drawHelper
public Color getColor(boolean ignoreCustom)
Layer
public static String getTimespanForTrack(GpxTrack trk)
trk
- The GPX track for which timespan is displayedpublic Icon getIcon()
Layer
public Object getInfoComponent()
getInfoComponent
in class Layer
public boolean isInfoResizable()
Layer
isInfoResizable
in class Layer
true
if the info dialog can be resized, false
otherwisepublic Action[] getMenuEntries()
Layer
Layer.SeparatorLayerAction.INSTANCE
instead of new JSeparatorgetMenuEntries
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
public void paint(Graphics2D g, MapView mv, Bounds box)
Layer
paint
in interface MapViewPaintable
paint
in class Layer
g
- Graphicsmv
- The object that can translate GeoPoints to screen coordinates.box
- Bounding boxprivate List<WayPoint> listVisibleSegments(Bounds box)
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 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)