public class GpxLayer extends AbstractModifiableLayer implements ExpertToggleAction.ExpertModeChangeListener
| Modifier and Type | Class and Description |
|---|---|
static class |
GpxLayer.CombineTracksToSegmentedTrackAction
Action to merge tracks into a single segmented track
|
static class |
GpxLayer.SplitTrackSegementsToTracksAction
Action to split track segments into a multiple tracks with one segment each
|
static class |
GpxLayer.SplitTracksToLayersAction
Action to split tracks of one gpx layer into multiple gpx layers,
the result is one GPX track per gpx layer.
|
Layer.LayerAction, Layer.LayerGpxExportAction, Layer.LayerSaveAction, Layer.LayerSaveAsAction, Layer.MultiLayerAction, Layer.SeparatorLayerActionAbstractMapViewPaintable.CompatibilityModeLayerPainterMapViewPaintable.LayerPainter, MapViewPaintable.MapViewEvent, MapViewPaintable.PaintableInvalidationEvent, MapViewPaintable.PaintableInvalidationListener| Modifier and Type | Field and Description |
|---|---|
GpxData |
data
GPX data
|
private GpxData.GpxDataChangeListener |
dataChangeListener
Added as field to be kept as reference.
|
private boolean |
isExpertMode |
private boolean |
isLocalFile |
private MarkerLayer |
linkedMarkerLayer
The MarkerLayer imported from the same file.
|
boolean[] |
trackVisibility
used by
ChooseTrackVisibilityAction to determine which tracks to show/hide
Call AbstractMapViewPaintable.invalidate() after each change!
TODO: Make it private, make it respond to track changes. |
FILTER_STATE_PROP, NAME_PROP, OPACITY_PROP, propertyChangeSupport, VISIBLE_PROP| Constructor and Description |
|---|
GpxLayer(GpxData d)
Constructs a new
GpxLayer without name. |
GpxLayer(GpxData d,
java.lang.String name)
Constructs a new
GpxLayer with a given name. |
GpxLayer(GpxData d,
java.lang.String name,
boolean isLocal)
Constructs a new
GpxLayer with a given name, that can be attached to a local file. |
| 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. |
protected MapViewPaintable.LayerPainter |
createMapViewPainter(MapViewPaintable.MapViewEvent event)
Creates a new LayerPainter.
|
void |
expertChanged(boolean isExpert)
The expert mode changed.
|
void |
filterTracksByDate(java.util.Date fromDate,
java.util.Date toDate,
boolean showWithoutDate)
Shows/hides all tracks of a given date range by setting them to visible/invisible.
|
java.io.File |
getAssociatedFile()
Gets the associated file for this layer.
|
java.lang.String |
getChangesetSourceTag()
Get the source for the layer
|
java.awt.Color |
getColor()
Return the current color of the layer
|
LayerPositionStrategy |
getDefaultLayerPosition()
Gets the strategy that specifies where this layer should be inserted in a layer list.
|
javax.swing.Icon |
getIcon()
Return a representative small image for this layer.
|
java.lang.Object |
getInfoComponent()
Gets the layer information to display to the user.
|
MarkerLayer |
getLinkedMarkerLayer() |
javax.swing.Action[] |
getMenuEntries()
Returns list of actions.
|
static java.lang.String |
getTimespanForTrack(IGpxTrack trk)
Returns a human readable string that shows the timespan of the given track
|
java.lang.String |
getToolTipText() |
boolean |
hasColor() |
boolean |
isInfoResizable()
Determines if info dialog can be resized (false by default).
|
boolean |
isLocalFile()
Determines if data is attached to a local file.
|
boolean |
isMergable(Layer other) |
boolean |
isModified()
Determines if data managed by this layer has been modified.
|
boolean |
isSavable()
Replies the savable state of this layer (i.e if it can be saved through a "File->Save" dialog).
|
void |
mergeFrom(GpxLayer from,
boolean cutOverlapping,
boolean connect)
Merges the given GpxLayer into this layer and can remove timewise overlapping parts of the given track
|
void |
mergeFrom(Layer from)
Merges the given layer into this layer.
|
void |
onPostSaveToFile()
Initializes the layer after a successful save of data to a file.
|
void |
paint(java.awt.Graphics2D g,
MapView mv,
Bounds bbox)
Paint the dataset using the engine set.
|
void |
projectionChanged(Projection oldValue,
Projection newValue) |
boolean |
requiresSaveToFile()
Determines if the data managed by this layer needs to be saved to
a file.
|
void |
setAssociatedFile(java.io.File file)
Sets the associated file for this layer.
|
void |
setColor(java.awt.Color color)
Sets the color for this layer.
|
void |
setLinkedMarkerLayer(MarkerLayer linkedMarkerLayer) |
void |
visitBoundingBox(BoundingXYVisitor v)
Visits the content bounds of this layer.
|
createUploadTask, getUploadDialog, isDownloadable, isLocked, isUploadable, isUploadDiscouraged, isUploadInProgress, lock, onPostUploadToServer, requiresUploadToServer, unlockaddPropertyChangeListener, destroy, fireFilterStateChanged, fireOpacityChanged, fireVisibleChanged, getName, getOpacity, getViewProjectionBounds, hookUpMapView, isBackgroundLayer, isProjectionSupported, isRenamed, isVisible, nameSupportedProjections, onPostLoadFromFile, removePropertyChangeListener, rename, setBackgroundLayer, setFilterStateChanged, setName, setOpacity, setVisible, toggleVisible, toStringaddInvalidationListener, attachToMapView, invalidate, removeInvalidationListenerprivate boolean isLocalFile
private boolean isExpertMode
public boolean[] trackVisibility
ChooseTrackVisibilityAction to determine which tracks to show/hide
Call AbstractMapViewPaintable.invalidate() after each change!
TODO: Make it private, make it respond to track changes.private final GpxData.GpxDataChangeListener dataChangeListener
private MarkerLayer linkedMarkerLayer
public GpxLayer(GpxData d)
GpxLayer without name.d - GPX datapublic GpxLayer(GpxData d, java.lang.String name)
GpxLayer with a given name.d - GPX dataname - layer namepublic java.awt.Color getColor()
Layerpublic void setColor(java.awt.Color color)
Layerpublic boolean hasColor()
public static java.lang.String getTimespanForTrack(IGpxTrack trk)
trk - The GPX track for which timespan is displayedpublic javax.swing.Icon getIcon()
Layerpublic java.lang.Object getInfoComponent()
LayergetInfoComponent in class LayerComponent describing the layer.public boolean isInfoResizable()
LayerisInfoResizable in class Layertrue if the info dialog can be resized, false otherwisepublic javax.swing.Action[] getMenuEntries()
LayerLayer.SeparatorLayerAction.INSTANCE instead of new JSeparatorgetMenuEntries in class Layerpublic boolean isLocalFile()
true if data is attached to a local file, false otherwisepublic java.lang.String getToolTipText()
getToolTipText in class Layerpublic boolean isMergable(Layer other)
isMergable in class Layerother - The other layer that is tested to be mergable with this.public void filterTracksByDate(java.util.Date fromDate, java.util.Date toDate, boolean showWithoutDate)
fromDate - The min datetoDate - The max dateshowWithoutDate - Include tracks that don't have any date set..public void mergeFrom(Layer from)
Layerpublic void mergeFrom(GpxLayer from, boolean cutOverlapping, boolean connect)
from - The GpxLayer that gets merged into this onecutOverlapping - whether overlapping parts of the given track should be removedconnect - whether the tracks should be connected on cutspublic void visitBoundingBox(BoundingXYVisitor v)
LayervisitBoundingBox in class Layerv - The visitor that gets notified about the contents of this layer.public java.io.File getAssociatedFile()
LayergetAssociatedFile in class Layernull if it is unset.Layer.setAssociatedFile(File)public void setAssociatedFile(java.io.File file)
LayersetAssociatedFile in class Layerfile - The file, may be nullpublic MarkerLayer getLinkedMarkerLayer()
public void setLinkedMarkerLayer(MarkerLayer linkedMarkerLayer)
linkedMarkerLayer - the linked MarkerLayerpublic void projectionChanged(Projection oldValue, Projection newValue)
projectionChanged in interface ProjectionChangeListenerprojectionChanged in class Layerpublic boolean isSavable()
LayerisSavable in interface SaveToFileisSavable in class Layerpublic boolean checkSaveConditions()
LayercheckSaveConditions in class Layertrue, if it is safe to save.public java.io.File createAndOpenSaveFileChooser()
LayercreateAndOpenSaveFileChooser in class LayerFileSaveActionBase.createAndOpenSaveFileChooser(java.lang.String, org.openstreetmap.josm.actions.ExtensionFileFilter)public LayerPositionStrategy getDefaultLayerPosition()
LayergetDefaultLayerPosition in class Layerpublic void paint(java.awt.Graphics2D g, MapView mv, Bounds bbox)
MapViewPaintablepaint in interface MapViewPaintableg - Graphicsmv - The object that can translate GeoPoints to screen coordinates.bbox - Bounding boxprotected MapViewPaintable.LayerPainter createMapViewPainter(MapViewPaintable.MapViewEvent event)
AbstractMapViewPaintablecreateMapViewPainter in class AbstractMapViewPaintableevent - The event that triggered the creation.public void expertChanged(boolean isExpert)
ExpertToggleAction.ExpertModeChangeListenerexpertChanged in interface ExpertToggleAction.ExpertModeChangeListenerisExpert - true if expert mode was enabled, false otherwise.public boolean isModified()
AbstractModifiableLayerisModified in class AbstractModifiableLayerpublic boolean requiresSaveToFile()
SaveToFilerequiresSaveToFile in interface SaveToFilerequiresSaveToFile in class AbstractModifiableLayertrue if the data managed by this layer needs to be saved to a file; false, otherwisepublic void onPostSaveToFile()
SaveToFileonPostSaveToFile in interface SaveToFileonPostSaveToFile in class AbstractModifiableLayerpublic java.lang.String getChangesetSourceTag()
LayergetChangesetSourceTag in class Layernull