Package org.openstreetmap.josm.data.osm
Class PrimitiveData
- java.lang.Object
-
- org.openstreetmap.josm.data.osm.AbstractPrimitive
-
- org.openstreetmap.josm.data.osm.PrimitiveData
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<IPrimitive>
,IQuadBucketType
,IFilterablePrimitive
,IPrimitive
,PrimitiveId
,Stylable
,Tagged
- Direct Known Subclasses:
NodeData
,RelationData
,WayData
public abstract class PrimitiveData extends AbstractPrimitive implements java.io.Serializable
This class can be used to save properties of OsmPrimitive. The main difference between PrimitiveData and OsmPrimitive is that PrimitiveData is not part of the dataset and changes in PrimitiveData are not reported by events- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static long
serialVersionUID
-
Fields inherited from class org.openstreetmap.josm.data.osm.AbstractPrimitive
changesetId, FLAG_ALL_REFERRERS_DOWNLOADED, FLAG_ANNOTATED, FLAG_DELETED, FLAG_DIRECTION_REVERSED, FLAG_DISABLED, FLAG_DISABLED_TYPE, FLAG_HAS_DIRECTIONS, FLAG_HIDDEN_TYPE, FLAG_HIDE_IF_DISABLED, FLAG_HIGHLIGHTED, FLAG_INCOMPLETE, FLAG_MODIFIED, FLAG_PRESERVED, FLAG_TAGGED, FLAG_VISIBLE, flags, id, keys, mappaintCacheIdx, timestamp, user, version
-
Fields inherited from interface org.openstreetmap.josm.data.osm.Tagged
MAX_TAG_LENGTH
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
PrimitiveData(long id)
Constructs a newPrimitiveData
with given id.protected
PrimitiveData(PrimitiveData data)
Constructs a newPrimitiveData
from an existing one.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
declareCachedStyleUpToDate()
Declare that the cached style for this primitive is up to date.StyleCache
getCachedStyle()
Returns the cached style.OsmData<?,?,?,?>
getDataSet()
Returns the parent data set of this primitive.java.util.List<PrimitiveData>
getReferrers(boolean allowWithoutDataset)
Find primitives that reference this primitive.boolean
hasDirectionKeys()
true if this object has direction dependent tags (e.g.boolean
isAnnotated()
Determines if this object is considered "annotated".boolean
isCachedStyleUpToDate()
Check if the cached style for this primitive is up to date.boolean
isHighlighted()
Checks if the highlight flag for this primitive was setboolean
isTagged()
Determines if this object is considered "tagged".protected void
keysChangedImpl(java.util.Map<java.lang.String,java.lang.String> originalKeys)
What to do, when the tags have changed by one of the tag-changing methods.abstract PrimitiveData
makeCopy()
Returns a copy of this primitive data.private void
readObject(java.io.ObjectInputStream ois)
boolean
reversedDirection()
true if this object has the "reversed direction" flag enabledvoid
setCachedStyle(StyleCache mappaintStyle)
Sets the cached style.void
setHighlighted(boolean highlighted)
Updates the highlight flag for this primitive.void
setId(long id)
Sets the primitive identifier.void
setIncomplete(boolean incomplete)
override to make it publicvoid
setVersion(int version)
Sets the primitive version.java.lang.String
toString()
void
visitReferrers(PrimitiveVisitor visitor)
Visitsvisitor
for all referrers.private void
writeObject(java.io.ObjectOutputStream oos)
-
Methods inherited from class org.openstreetmap.josm.data.osm.AbstractPrimitive
clearOsmMetadata, cloneFrom, doGet, get, getChangesetId, getDisabledType, getDiscardableKeys, getFlagsAsString, getHiddenType, getId, getIdGenerator, getIgnoreCase, getInstant, getInterestingTags, getKeys, getNumKeys, getRawTimestamp, getTimestamp, getUninterestingKeys, getUniqueId, getUser, getVersion, getWorkInProgressKeys, hasKey, hasKey, hasKeys, isDeleted, isDisabled, isDisabledAndHidden, isDrawable, isIncomplete, isModified, isNew, isNewOrUndeleted, isPreserved, isReferrersDownloaded, isTimestampEmpty, isUndeleted, isUninterestingKey, isUsable, isVisible, keys, keySet, put, putAll, remove, removeAll, setChangesetId, setDeleted, setDisabledState, setDisabledType, setHiddenType, setInstant, setKeys, setKeys, setModified, setOsmId, setRawTimestamp, setReferrersDownloaded, setTimestamp, setUser, setVisible, unsetDisabledState, updateFlags, updateFlagsChanged, visitKeys
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.openstreetmap.josm.data.osm.IPrimitive
accept, getBBox, getChildren, getDisplayName, getDisplayType, getLocalName, getName, getOsmId, getOsmPrimitiveId, getPrimitiveId, getReferrers, getStyleCacheSyncObject, hasSameInterestingTags, isMemberOfSelected, isMultipolygon, isOuterMemberOfSelected, isSelectable, isSelected
-
Methods inherited from interface org.openstreetmap.josm.data.osm.PrimitiveId
getType
-
Methods inherited from interface org.openstreetmap.josm.data.osm.Stylable
clearCachedStyle
-
Methods inherited from interface org.openstreetmap.josm.data.osm.Tagged
hasTag, hasTag, hasTag, hasTag, hasTagDifferent, hasTagDifferent, hasTagDifferent, isKeyFalse, isKeyTrue, put
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PrimitiveData
protected PrimitiveData(long id)
Constructs a newPrimitiveData
with given id.- Parameters:
id
- id- Since:
- 12017
-
PrimitiveData
protected PrimitiveData(PrimitiveData data)
Constructs a newPrimitiveData
from an existing one.- Parameters:
data
- the data to copy
-
-
Method Detail
-
setId
public void setId(long id)
Sets the primitive identifier.- Parameters:
id
- primitive identifier
-
setVersion
public void setVersion(int version)
Sets the primitive version.- Parameters:
version
- primitive version
-
setIncomplete
public void setIncomplete(boolean incomplete)
override to make it public- Overrides:
setIncomplete
in classAbstractPrimitive
- Parameters:
incomplete
- incomplete flag value
-
makeCopy
public abstract PrimitiveData makeCopy()
Returns a copy of this primitive data.- Returns:
- a copy of this primitive data
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
keysChangedImpl
protected final void keysChangedImpl(java.util.Map<java.lang.String,java.lang.String> originalKeys)
Description copied from class:AbstractPrimitive
What to do, when the tags have changed by one of the tag-changing methods.- Specified by:
keysChangedImpl
in classAbstractPrimitive
- Parameters:
originalKeys
- original tags
-
writeObject
private void writeObject(java.io.ObjectOutputStream oos) throws java.io.IOException
- Throws:
java.io.IOException
-
readObject
private void readObject(java.io.ObjectInputStream ois) throws java.lang.ClassNotFoundException, java.io.IOException
- Throws:
java.lang.ClassNotFoundException
java.io.IOException
-
isTagged
public boolean isTagged()
Description copied from interface:IPrimitive
Determines if this object is considered "tagged". To be "tagged", an object must have one or more "interesting" tags. "created_by" and "source" are typically considered "uninteresting" and do not make an object "tagged".- Specified by:
isTagged
in interfaceIPrimitive
- Overrides:
isTagged
in classAbstractPrimitive
- Returns:
- true if this object is considered "tagged"
-
isAnnotated
public boolean isAnnotated()
Description copied from interface:IPrimitive
Determines if this object is considered "annotated". To be "annotated", an object must have one or more "work in progress" tags, such as "note" or "fixme".- Specified by:
isAnnotated
in interfaceIPrimitive
- Overrides:
isAnnotated
in classAbstractPrimitive
- Returns:
- true if this object is considered "annotated"
-
hasDirectionKeys
public boolean hasDirectionKeys()
Description copied from interface:IPrimitive
true if this object has direction dependent tags (e.g. oneway)- Specified by:
hasDirectionKeys
in interfaceIPrimitive
- Overrides:
hasDirectionKeys
in classAbstractPrimitive
- Returns:
true
if this object has direction dependent tags
-
reversedDirection
public boolean reversedDirection()
Description copied from interface:IPrimitive
true if this object has the "reversed direction" flag enabled- Specified by:
reversedDirection
in interfaceIPrimitive
- Overrides:
reversedDirection
in classAbstractPrimitive
- Returns:
true
if this object has the "reversed direction" flag enabled
-
setHighlighted
public void setHighlighted(boolean highlighted)
Description copied from interface:IPrimitive
Updates the highlight flag for this primitive.- Specified by:
setHighlighted
in interfaceIPrimitive
- Parameters:
highlighted
- The new highlight flag.
-
isHighlighted
public boolean isHighlighted()
Description copied from interface:IPrimitive
Checks if the highlight flag for this primitive was set- Specified by:
isHighlighted
in interfaceIPrimitive
- Overrides:
isHighlighted
in classAbstractPrimitive
- Returns:
- The highlight flag.
-
getReferrers
public final java.util.List<PrimitiveData> getReferrers(boolean allowWithoutDataset)
Description copied from interface:IPrimitive
Find primitives that reference this primitive. Returns only primitives that are included in the same dataset as this primitive.
For example following code will add wnew as referer to all nodes of existingWay, but this method will not return wnew because it's not part of the dataset
Way wnew = new Way(existingWay)
- Specified by:
getReferrers
in interfaceIPrimitive
- Parameters:
allowWithoutDataset
- If true, method will return empty list if primitive is not part of the dataset. If false, exception will be thrown in this case- Returns:
- a collection of all primitives that reference this primitive.
-
visitReferrers
public void visitReferrers(PrimitiveVisitor visitor)
Description copied from interface:IPrimitive
Visits
visitor
for all referrers.- Specified by:
visitReferrers
in interfaceIPrimitive
- Parameters:
visitor
- the visitor. Ignored, if null.
-
getDataSet
public OsmData<?,?,?,?> getDataSet()
Description copied from interface:IPrimitive
Returns the parent data set of this primitive.- Specified by:
getDataSet
in interfaceIPrimitive
- Returns:
- OsmData this primitive is part of.
-
getCachedStyle
public StyleCache getCachedStyle()
Description copied from interface:Stylable
Returns the cached style.- Specified by:
getCachedStyle
in interfaceStylable
- Returns:
- the cached style
-
setCachedStyle
public void setCachedStyle(StyleCache mappaintStyle)
Description copied from interface:Stylable
Sets the cached style.- Specified by:
setCachedStyle
in interfaceStylable
- Parameters:
mappaintStyle
- the cached style
-
isCachedStyleUpToDate
public boolean isCachedStyleUpToDate()
Description copied from interface:Stylable
Check if the cached style for this primitive is up to date.- Specified by:
isCachedStyleUpToDate
in interfaceStylable
- Returns:
- true if the cached style for this primitive is up to date
-
declareCachedStyleUpToDate
public void declareCachedStyleUpToDate()
Description copied from interface:Stylable
Declare that the cached style for this primitive is up to date.- Specified by:
declareCachedStyleUpToDate
in interfaceStylable
-
-