Package adams.data.mapobject
Class AbstractMapObject
- java.lang.Object
-
- adams.data.mapobject.AbstractMapObject
-
- All Implemented Interfaces:
adams.core.MetaDataSupporter
,MetaDataSupporter
,TimestampSupporter
,org.openstreetmap.gui.jmapviewer.interfaces.MapObject
- Direct Known Subclasses:
SimpleMapMarkerCircle
,SimpleMapPolygon
,SimpleMapRectangle
public abstract class AbstractMapObject extends Object implements org.openstreetmap.gui.jmapviewer.interfaces.MapObject, MetaDataSupporter, TimestampSupporter
AdaptedMapObjectImpl
code.- Version:
- $Revision$
- Author:
- OpenStreetMap (original code:
MapObjectImpl
), FracPete (fracpete at waikato dot ac dot nz)
-
-
Field Summary
Fields Modifier and Type Field Description protected org.openstreetmap.gui.jmapviewer.Layer
layer
protected HashMap<String,Object>
metaData
for storing meta-data.protected String
name
protected org.openstreetmap.gui.jmapviewer.Style
style
protected Date
timestamp
the timestamp.protected Boolean
visible
-
Constructor Summary
Constructors Constructor Description AbstractMapObject(String name)
AbstractMapObject(org.openstreetmap.gui.jmapviewer.Layer layer)
AbstractMapObject(org.openstreetmap.gui.jmapviewer.Layer layer, String name, org.openstreetmap.gui.jmapviewer.Style style)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
addMetaData(String key, Object value)
Adds a key-value pair to the meta-data store.Color
getBackColor()
Color
getColor()
static Font
getDefaultFont()
Font
getFont()
org.openstreetmap.gui.jmapviewer.Layer
getLayer()
HashMap<String,Object>
getMetaData()
Returns the meta-data store.Object
getMetaData(String key)
Returns the specified value from the meta-data store.String
getName()
Stroke
getStroke()
org.openstreetmap.gui.jmapviewer.Style
getStyle()
org.openstreetmap.gui.jmapviewer.Style
getStyleAssigned()
Date
getTimestamp()
Returns the current timestamp.boolean
isVisible()
Set<String>
metaDataKeys()
Returns the set of meta-data keys.void
paintText(Graphics g, Point position)
Object
removeMetaData(String key)
Removes a key-value pair from the meta-data store.void
setBackColor(Color backColor)
void
setColor(Color color)
void
setFont(Font font)
void
setLayer(org.openstreetmap.gui.jmapviewer.Layer layer)
void
setName(String txt)
void
setStroke(Stroke stroke)
void
setStyle(org.openstreetmap.gui.jmapviewer.Style style)
void
setTimestamp(Date value)
Sets the timestamp.void
setVisible(Boolean visible)
-
-
-
Constructor Detail
-
AbstractMapObject
public AbstractMapObject(String name)
-
AbstractMapObject
public AbstractMapObject(org.openstreetmap.gui.jmapviewer.Layer layer)
-
AbstractMapObject
public AbstractMapObject(org.openstreetmap.gui.jmapviewer.Layer layer, String name, org.openstreetmap.gui.jmapviewer.Style style)
-
-
Method Detail
-
getLayer
public org.openstreetmap.gui.jmapviewer.Layer getLayer()
- Specified by:
getLayer
in interfaceorg.openstreetmap.gui.jmapviewer.interfaces.MapObject
-
setLayer
public void setLayer(org.openstreetmap.gui.jmapviewer.Layer layer)
- Specified by:
setLayer
in interfaceorg.openstreetmap.gui.jmapviewer.interfaces.MapObject
-
getStyle
public org.openstreetmap.gui.jmapviewer.Style getStyle()
- Specified by:
getStyle
in interfaceorg.openstreetmap.gui.jmapviewer.interfaces.MapObject
-
getStyleAssigned
public org.openstreetmap.gui.jmapviewer.Style getStyleAssigned()
- Specified by:
getStyleAssigned
in interfaceorg.openstreetmap.gui.jmapviewer.interfaces.MapObject
-
setStyle
public void setStyle(org.openstreetmap.gui.jmapviewer.Style style)
-
getColor
public Color getColor()
- Specified by:
getColor
in interfaceorg.openstreetmap.gui.jmapviewer.interfaces.MapObject
-
setColor
public void setColor(Color color)
-
getBackColor
public Color getBackColor()
- Specified by:
getBackColor
in interfaceorg.openstreetmap.gui.jmapviewer.interfaces.MapObject
-
setBackColor
public void setBackColor(Color backColor)
-
getStroke
public Stroke getStroke()
- Specified by:
getStroke
in interfaceorg.openstreetmap.gui.jmapviewer.interfaces.MapObject
-
setStroke
public void setStroke(Stroke stroke)
-
getFont
public Font getFont()
- Specified by:
getFont
in interfaceorg.openstreetmap.gui.jmapviewer.interfaces.MapObject
-
setFont
public void setFont(Font font)
-
isVisible
public boolean isVisible()
- Specified by:
isVisible
in interfaceorg.openstreetmap.gui.jmapviewer.interfaces.MapObject
-
setVisible
public void setVisible(Boolean visible)
-
getName
public String getName()
- Specified by:
getName
in interfaceorg.openstreetmap.gui.jmapviewer.interfaces.MapObject
-
setName
public void setName(String txt)
-
getTimestamp
public Date getTimestamp()
Returns the current timestamp.- Specified by:
getTimestamp
in interfaceTimestampSupporter
- Returns:
- the timestamp
-
setTimestamp
public void setTimestamp(Date value)
Sets the timestamp.- Specified by:
setTimestamp
in interfaceTimestampSupporter
- Parameters:
value
- the new timestamp
-
addMetaData
public Object addMetaData(String key, Object value)
Adds a key-value pair to the meta-data store.- Specified by:
addMetaData
in interfaceadams.core.MetaDataSupporter
- Specified by:
addMetaData
in interfaceMetaDataSupporter
- Parameters:
key
- the key to store the value forvalue
- the value to store- Returns:
- any previously stored object for this key, otherwise null
-
removeMetaData
public Object removeMetaData(String key)
Removes a key-value pair from the meta-data store.- Specified by:
removeMetaData
in interfaceadams.core.MetaDataSupporter
- Specified by:
removeMetaData
in interfaceMetaDataSupporter
- Parameters:
key
- the key to remove the value for- Returns:
- any previously stored object for this key, null if none was present
-
getMetaData
public Object getMetaData(String key)
Returns the specified value from the meta-data store.- Specified by:
getMetaData
in interfaceadams.core.MetaDataSupporter
- Specified by:
getMetaData
in interfaceMetaDataSupporter
- Parameters:
key
- the key to retrieve the value for- Returns:
- stored object for this key, null if none was present
-
getMetaData
public HashMap<String,Object> getMetaData()
Returns the meta-data store.- Specified by:
getMetaData
in interfaceadams.core.MetaDataSupporter
- Specified by:
getMetaData
in interfaceMetaDataSupporter
- Returns:
- the meta-data
-
metaDataKeys
public Set<String> metaDataKeys()
Returns the set of meta-data keys.- Specified by:
metaDataKeys
in interfaceadams.core.MetaDataSupporter
- Specified by:
metaDataKeys
in interfaceMetaDataSupporter
- Returns:
- the meta-data keys
-
getDefaultFont
public static Font getDefaultFont()
-
-