Class VectorPrimitive
java.lang.Object
org.openstreetmap.josm.data.osm.AbstractPrimitive
org.openstreetmap.josm.data.vector.VectorPrimitive
- All Implemented Interfaces:
Comparable<IPrimitive>,IQuadBucketType,IFilterablePrimitive,IPrimitive,PrimitiveId,Stylable,Tagged,DataLayer<String>
- Direct Known Subclasses:
VectorNode,VectorRelation,VectorWay
The base class for Vector primitives
- Since:
- 17862
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate VectorDataSetprivate booleanprivate final Stringprivate final Map<ElemStyles,StyleCache> private ObjectFields 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
ConstructorsModifierConstructorDescriptionprotectedVectorPrimitive(String layer) Create a primitive for a specific vector layer -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddReferrer(IPrimitive referrer) Add new referrer.voidClears the cached style.final voiddeclareCachedStyleUpToDate(ElemStyles elemStyles) Declare that the cached style for this primitive is up to date.private voiddoVisitReferrers(Consumer<IPrimitive> visitor) final StyleCachegetCachedStyle(ElemStyles elemStyles) Returns the cached style.Returns the parent data set of this primitive.getLayer()Data layer information *final List<VectorPrimitive>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".final booleanisCachedStyleUpToDate(ElemStyles elemStyles) Check if the cached style for this primitive is up to date.booleanChecks if the highlight flag for this primitive was setprotected voidkeysChangedImpl(Map<String, String> originalKeys) What to do, when the tags have changed by one of the tag-changing methods.private <T extends IPrimitive>
Stream<T>final <T extends IPrimitive>
Stream<T>Gets all primitives in the current dataset that reference this primitive.protected voidremoveReferrer(IPrimitive referrer) Remove referrer.booleantrue if this object has the "reversed direction" flag enabledfinal voidsetCachedStyle(ElemStyles elemStyles, StyleCache mappaintStyle) Sets the cached style.protected voidsetDataSet(VectorDataSet newDataSet) voidsetDisabled(boolean disabled) Make this object disabledvoidsetHighlighted(boolean highlighted) Updates the highlight flag for this primitive.protected voidsetId(long id) Set the id of the objectvoidsetVisible(boolean visible) Make this object visiblevoidvisitReferrers(PrimitiveVisitor visitor) Visitsvisitorfor all referrers.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, isTagged, isTimestampEmpty, isUndeleted, isUninterestingKey, isUsable, isVisible, keys, keySet, put, putAll, remove, removeAll, setChangesetId, setDeleted, setDisabledState, setDisabledType, setHiddenType, setIncomplete, setInstant, setKeys, setKeys, setModified, setOsmId, setRawTimestamp, setReferrersDownloaded, setUser, unsetDisabledState, updateFlags, updateFlagsChanged, visitKeysMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, 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
-
dataSet
-
highlighted
-
mappaintStyle
-
layer
-
referrers
-
-
Constructor Details
-
VectorPrimitive
Create a primitive for a specific vector layer- Parameters:
layer- The layer for the primitive
-
-
Method Details
-
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
-
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.
-
setHighlighted
Description copied from interface:IPrimitiveUpdates the highlight flag for this primitive.- Specified by:
setHighlightedin interfaceIPrimitive- Parameters:
highlighted- The new highlight flag.
-
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"
-
getDataSet
Description copied from interface:IPrimitiveReturns the parent data set of this primitive.- Specified by:
getDataSetin interfaceIPrimitive- Returns:
- OsmData this primitive is part of.
-
setDataSet
-
getCachedStyle
Description copied from interface:StylableReturns the cached style.- Specified by:
getCachedStylein interfaceStylable- Parameters:
elemStyles- 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:
elemStyles- 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:
elemStyles- 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:
elemStyles- 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
-
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
-
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.
-
addReferrer
Add new referrer. If referrer is already included then no action is taken- Parameters:
referrer- The referrer to add
-
removeReferrer
Remove referrer. No action is taken if referrer is not registered- Parameters:
referrer- The referrer to remove
-
referrers
-
referrers
Gets all primitives in the current dataset that reference this primitive.- Type Parameters:
T- type of primitives- Parameters:
filter- restrict primitives to subclasses- Returns:
- the referrers as Stream
-
visitReferrers
Description copied from interface:IPrimitiveVisits
visitorfor all referrers.- Specified by:
visitReferrersin interfaceIPrimitive- Parameters:
visitor- the visitor. Ignored, if null.
-
doVisitReferrers
-
setId
Set the id of the object- Parameters:
id- The id
-
setDisabled
Make this object disabled- Parameters:
disabled-trueto disable the object
-
setVisible
Make this object visible- Specified by:
setVisiblein interfaceIPrimitive- Overrides:
setVisiblein classAbstractPrimitive- Parameters:
visible-trueto make this object visible (default)- See Also:
-
getLayer
Data layer information *
-