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:
Serializable,Comparable<IPrimitive>,IQuadBucketType,IFilterablePrimitive,IPrimitive,PrimitiveId,Stylable,Tagged
- Direct Known Subclasses:
NodeData,RelationData,WayData
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:
-
Field Summary
FieldsFields 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, versionFields inherited from interface org.openstreetmap.josm.data.osm.Tagged
MAX_TAG_LENGTH -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPrimitiveData(long id) Constructs a newPrimitiveDatawith given id.protectedPrimitiveData(PrimitiveData data) Constructs a newPrimitiveDatafrom an existing one. -
Method Summary
Modifier and TypeMethodDescriptionvoidClears the cached style.voiddeclareCachedStyleUpToDate(ElemStyles styles) Declare that the cached style for this primitive is up to date.getCachedStyle(ElemStyles styles) Returns the cached style.OsmData<?,?, ?, ?> Returns the parent data set of this primitive.final List<PrimitiveData>getReferrers(boolean allowWithoutDataset) Find primitives that reference this primitive.booleantrue if this object has direction dependent tags (e.g.booleanDetermines if this object is considered "annotated".booleanisCachedStyleUpToDate(ElemStyles styles) Check if the cached style for this primitive is up to date.booleanChecks if the highlight flag for this primitive was setbooleanisTagged()Determines if this object is considered "tagged".protected final voidkeysChangedImpl(Map<String, 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 voidbooleantrue if this object has the "reversed direction" flag enabledvoidsetCachedStyle(ElemStyles styles, 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.toString()voidvisitReferrers(PrimitiveVisitor visitor) Visitsvisitorfor all referrers.private voidMethods 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, visitKeysMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Comparable
compareToMethods 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, isSelectedMethods inherited from interface org.openstreetmap.josm.data.osm.PrimitiveId
getTypeMethods inherited from interface org.openstreetmap.josm.data.osm.Tagged
hasTag, hasTag, hasTag, hasTag, hasTagDifferent, hasTagDifferent, hasTagDifferent, isKeyFalse, isKeyTrue, put
-
Field Details
-
serialVersionUID
- See Also:
-
-
Constructor Details
-
PrimitiveData
Constructs a newPrimitiveDatawith given id.- Parameters:
id- id- Since:
- 12017
-
PrimitiveData
Constructs a newPrimitiveDatafrom an existing one.- Parameters:
data- the data to copy
-
-
Method Details
-
setId
Sets the primitive identifier.- Parameters:
id- primitive identifier
-
setVersion
Sets the primitive version.- Parameters:
version- primitive version
-
setIncomplete
override to make it public- Overrides:
setIncompletein classAbstractPrimitive- Parameters:
incomplete- incomplete flag value
-
makeCopy
Returns a copy of this primitive data.- Returns:
- a copy of this primitive data
-
toString
-
keysChangedImpl
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
- Throws:
IOException
-
readObject
- Throws:
ClassNotFoundExceptionIOException
-
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
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
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
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
Description copied from interface:IPrimitiveUpdates the highlight flag for this primitive.- Specified by:
setHighlightedin interfaceIPrimitive- Parameters:
highlighted- The new highlight flag.
-
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
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
Description copied from interface:IPrimitiveVisits
visitorfor all referrers.- Specified by:
visitReferrersin interfaceIPrimitive- Parameters:
visitor- the visitor. Ignored, if null.
-
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
Description copied from interface:StylableReturns the cached style.- Specified by:
getCachedStylein interfaceStylable- Parameters:
styles- styles for which the data is retrieved- Returns:
- the cached style
-
setCachedStyle
Description copied from interface:StylableSets the cached style.- Specified by:
setCachedStylein interfaceStylable- Parameters:
styles- styles for which the data is storedmappaintStyle- the cached style
-
isCachedStyleUpToDate
Description copied from interface:StylableCheck if the cached style for this primitive is up to date.- Specified by:
isCachedStyleUpToDatein interfaceStylable- Parameters:
styles- styles for which the data is checked- Returns:
- true if the cached style for this primitive is up to date
-
declareCachedStyleUpToDate
Description copied from interface:StylableDeclare that the cached style for this primitive is up to date.- Specified by:
declareCachedStyleUpToDatein interfaceStylable- Parameters:
styles- styles for which the data is handled
-
clearCachedStyle
Description copied from interface:StylableClears the cached style. This should not be called from outside. Fixing the UI to add relevant get/set functions calling this implicitly is preferred, so we can have transparent cache handling in the future.- Specified by:
clearCachedStylein interfaceStylable
-