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 longserialVersionUID-
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 protectedPrimitiveData(long id)Constructs a newPrimitiveDatawith given id.protectedPrimitiveData(PrimitiveData data)Constructs a newPrimitiveDatafrom an existing one.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voiddeclareCachedStyleUpToDate()Declare that the cached style for this primitive is up to date.StyleCachegetCachedStyle()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.booleanhasDirectionKeys()true if this object has direction dependent tags (e.g.booleanisAnnotated()Determines if this object is considered "annotated".booleanisCachedStyleUpToDate()Check if the cached style for this primitive is up to date.booleanisHighlighted()Checks if the highlight flag for this primitive was setbooleanisTagged()Determines if this object is considered "tagged".protected voidkeysChangedImpl(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 PrimitiveDatamakeCopy()Returns a copy of this primitive data.private voidreadObject(java.io.ObjectInputStream ois)booleanreversedDirection()true if this object has the "reversed direction" flag enabledvoidsetCachedStyle(StyleCache mappaintStyle)Sets the cached style.voidsetHighlighted(boolean highlighted)Updates the highlight flag for this primitive.voidsetId(long id)Sets the primitive identifier.voidsetIncomplete(boolean incomplete)override to make it publicvoidsetVersion(int version)Sets the primitive version.java.lang.StringtoString()voidvisitReferrers(PrimitiveVisitor visitor)Visitsvisitorfor all referrers.private voidwriteObject(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, 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, 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 newPrimitiveDatawith given id.- Parameters:
id- id- Since:
- 12017
-
PrimitiveData
protected PrimitiveData(PrimitiveData data)
Constructs a newPrimitiveDatafrom 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:
setIncompletein 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:
toStringin classjava.lang.Object
-
keysChangedImpl
protected final void keysChangedImpl(java.util.Map<java.lang.String,java.lang.String> originalKeys)
Description copied from class:AbstractPrimitiveWhat to do, when the tags have changed by one of the tag-changing methods.- Specified by:
keysChangedImplin 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.ClassNotFoundExceptionjava.io.IOException
-
isTagged
public boolean isTagged()
Description copied from interface:IPrimitiveDetermines 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:
isTaggedin interfaceIPrimitive- Overrides:
isTaggedin classAbstractPrimitive- Returns:
- true if this object is considered "tagged"
-
isAnnotated
public boolean isAnnotated()
Description copied from interface:IPrimitiveDetermines 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:
isAnnotatedin interfaceIPrimitive- Overrides:
isAnnotatedin classAbstractPrimitive- Returns:
- true if this object is considered "annotated"
-
hasDirectionKeys
public boolean hasDirectionKeys()
Description copied from interface:IPrimitivetrue if this object has direction dependent tags (e.g. oneway)- Specified by:
hasDirectionKeysin interfaceIPrimitive- Overrides:
hasDirectionKeysin classAbstractPrimitive- Returns:
trueif this object has direction dependent tags
-
reversedDirection
public boolean reversedDirection()
Description copied from interface:IPrimitivetrue if this object has the "reversed direction" flag enabled- Specified by:
reversedDirectionin interfaceIPrimitive- Overrides:
reversedDirectionin classAbstractPrimitive- Returns:
trueif this object has the "reversed direction" flag enabled
-
setHighlighted
public void setHighlighted(boolean highlighted)
Description copied from interface:IPrimitiveUpdates the highlight flag for this primitive.- Specified by:
setHighlightedin interfaceIPrimitive- Parameters:
highlighted- The new highlight flag.
-
isHighlighted
public boolean isHighlighted()
Description copied from interface:IPrimitiveChecks if the highlight flag for this primitive was set- Specified by:
isHighlightedin interfaceIPrimitive- Overrides:
isHighlightedin classAbstractPrimitive- Returns:
- The highlight flag.
-
getReferrers
public final java.util.List<PrimitiveData> getReferrers(boolean allowWithoutDataset)
Description copied from interface:IPrimitiveFind 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:
getReferrersin 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:IPrimitiveVisits
visitorfor all referrers.- Specified by:
visitReferrersin interfaceIPrimitive- Parameters:
visitor- the visitor. Ignored, if null.
-
getDataSet
public OsmData<?,?,?,?> getDataSet()
Description copied from interface:IPrimitiveReturns the parent data set of this primitive.- Specified by:
getDataSetin interfaceIPrimitive- Returns:
- OsmData this primitive is part of.
-
getCachedStyle
public StyleCache getCachedStyle()
Description copied from interface:StylableReturns the cached style.- Specified by:
getCachedStylein interfaceStylable- Returns:
- the cached style
-
setCachedStyle
public void setCachedStyle(StyleCache mappaintStyle)
Description copied from interface:StylableSets the cached style.- Specified by:
setCachedStylein interfaceStylable- Parameters:
mappaintStyle- the cached style
-
isCachedStyleUpToDate
public boolean isCachedStyleUpToDate()
Description copied from interface:StylableCheck if the cached style for this primitive is up to date.- Specified by:
isCachedStyleUpToDatein interfaceStylable- Returns:
- true if the cached style for this primitive is up to date
-
declareCachedStyleUpToDate
public void declareCachedStyleUpToDate()
Description copied from interface:StylableDeclare that the cached style for this primitive is up to date.- Specified by:
declareCachedStyleUpToDatein interfaceStylable
-
-