public interface IPrimitive extends Tagged, PrimitiveId, Stylable, java.lang.Comparable<IPrimitive>
OsmPrimitive
and PrimitiveData
.MAX_TAG_LENGTH
Modifier and Type | Method and Description |
---|---|
void |
accept(PrimitiveVisitor visitor)
Makes the given visitor visit this primitive.
|
BBox |
getBBox()
Fetches the bounding box of the primitive.
|
int |
getChangesetId()
Replies the id of the changeset this primitive was last uploaded to.
|
OsmData<?,?,?,?> |
getDataSet()
Returns the parent data set of this primitive.
|
java.lang.String |
getDisplayName(NameFormatter formatter)
Replies the display name of a primitive formatted by
formatter |
default OsmPrimitiveType |
getDisplayType()
Gets the type this primitive is displayed at
|
long |
getId()
Replies the id of this primitive.
|
java.util.Map<java.lang.String,java.lang.String> |
getInterestingTags()
Returns
Tagged.getKeys() for which key does not fulfill uninteresting criteria. |
default java.lang.String |
getLocalName()
Replies a localized name for this primitive given by the value of the name tags
accessed from very specific (language variant) to more generic (default name).
|
default java.lang.String |
getName()
Replies the name of this primitive.
|
default long |
getOsmId()
Replies the OSM id of this primitive.
|
default PrimitiveId |
getOsmPrimitiveId()
Replies the OSM primitive id for this primitive.
|
default PrimitiveId |
getPrimitiveId()
Replies the unique primitive id for this primitive.
|
int |
getRawTimestamp()
Time of last modification to this object.
|
default java.util.List<? extends IPrimitive> |
getReferrers()
Gets a list of all primitives in the current dataset that reference this primitive.
|
java.util.List<? extends IPrimitive> |
getReferrers(boolean allowWithoutDataset)
Find primitives that reference this primitive.
|
java.util.Date |
getTimestamp()
Time of last modification to this object.
|
User |
getUser()
Replies the user who has last touched this object.
|
int |
getVersion()
Replies the version number as returned by the API.
|
boolean |
hasDirectionKeys()
true if this object has direction dependent tags (e.g.
|
default boolean |
hasSameInterestingTags(IPrimitive other)
Replies true if other isn't null and has the same interesting tags (key/value-pairs) as this.
|
boolean |
isAnnotated()
Determines if this object is considered "annotated".
|
boolean |
isDeleted()
Replies
true , if the object has been deleted. |
default boolean |
isDisabled()
Replies true, if this primitive is disabled.
|
default boolean |
isDisabledAndHidden()
Replies true, if this primitive is disabled and marked as completely hidden on the map.
|
default boolean |
isDrawable()
Determines if this object is drawable.
|
boolean |
isHighlighted()
Checks if the highlight flag for this primitive was set
|
boolean |
isIncomplete()
Determines if this primitive is incomplete.
|
default boolean |
isMemberOfSelected()
Determines if this primitive is a member of a selected relation.
|
boolean |
isModified()
Replies
true if the object has been modified since it was loaded from
the server. |
default boolean |
isMultipolygon()
Determines if this object is a relation and behaves as a multipolygon.
|
boolean |
isNewOrUndeleted()
Determines if this primitive is new or undeleted.
|
default boolean |
isOuterMemberOfSelected()
Determines if this primitive is an outer member of a selected multipolygon relation.
|
default boolean |
isPreserved()
Replies true, if this primitive is preserved from filtering.
|
default boolean |
isSelectable()
Determines if this object is selectable.
|
default boolean |
isSelected()
Determines whether the primitive is selected
|
boolean |
isTagged()
Determines if this object is considered "tagged".
|
boolean |
isTimestampEmpty()
Determines if this primitive has no timestamp information.
|
boolean |
isUndeleted()
Replies
true if the object has been deleted on the server and was undeleted by the user. |
boolean |
isUsable()
Replies
true , if the object is usable
(i.e. |
boolean |
isVisible()
Checks if object is known to the server.
|
boolean |
reversedDirection()
true if this object has the "reversed direction" flag enabled
|
void |
setChangesetId(int changesetId)
Sets the changeset id of this primitive.
|
void |
setDeleted(boolean deleted)
Sets whether this primitive is deleted or not.
|
void |
setHighlighted(boolean highlighted)
Updates the highlight flag for this primitive.
|
void |
setModified(boolean modified)
Marks this primitive as being modified.
|
void |
setOsmId(long id,
int version)
Sets the id and the version of this primitive if it is known to the OSM API.
|
void |
setRawTimestamp(int timestamp)
Sets time of last modification to this object
|
void |
setTimestamp(java.util.Date timestamp)
Sets time of last modification to this object
|
void |
setUser(User user)
Sets the user who has last touched this object.
|
void |
setVisible(boolean visible)
Sets whether this primitive is visible, i.e.
|
void |
visitReferrers(PrimitiveVisitor visitor)
Visits
visitor for all referrers. |
get, getKeys, getNumKeys, hasKey, hasKeys, hasTag, hasTag, hasTag, hasTag, hasTagDifferent, hasTagDifferent, hasTagDifferent, isKeyFalse, isKeyTrue, keySet, put, put, remove, removeAll, setKeys, visitKeys
getType, getUniqueId, isNew
clearCachedStyle, declareCachedStyleUpToDate, getCachedStyle, isCachedStyleUpToDate, setCachedStyle
boolean isModified()
true
if the object has been modified since it was loaded from
the server. In this case, on next upload, this object will be updated.
Deleted objects are deleted from the server. If the objects are added (id=0),
the modified is ignored and the object is added to the server.true
if the object has been modified since it was loaded from
the servervoid setModified(boolean modified)
modified
- true, if this primitive is to be modifiedboolean isVisible()
true
, if the object is visible on server.setVisible(boolean)
void setVisible(boolean visible)
visible
- true
if this primitive is visiblejava.lang.IllegalStateException
- if visible is set to false on an primitive with id==0isVisible()
boolean isDeleted()
true
, if the object has been deleted.true
, if the object has been deleted.setDeleted(boolean)
void setDeleted(boolean deleted)
deleted
- true, if this primitive is deleted; false, otherwiseboolean isIncomplete()
true
if this primitive is incomplete, false
otherwiseboolean isUndeleted()
true
if the object has been deleted on the server and was undeleted by the user.true
if the object has been undeletedboolean isUsable()
true
, if the object is usable
(i.e. complete and not deleted).true
, if the object is usable.setDeleted(boolean)
boolean isNewOrUndeleted()
PrimitiveId.isNew()
,
isUndeleted()
default boolean isDisabled()
true
if this object has the "disabled" flag enableddefault boolean isDisabledAndHidden()
true
if this object has both the "disabled" and "hide if disabled" flags enableddefault boolean isPreserved()
true
if this object has the "preserved" flag enableddefault boolean isSelectable()
A primitive can be selected if all conditions are met:
true
if this object is selectabledefault boolean isDrawable()
A primitive is drawable if all conditions are met:
true
if this object is drawabledefault boolean isSelected()
default boolean isMemberOfSelected()
true
if this primitive is a member of a selected relation, false
otherwisedefault boolean isOuterMemberOfSelected()
true
if this primitive is an outer member of a selected multipolygon relation, false
otherwiselong getId()
default long getOsmId()
getId()
.
Can be overidden by primitive implementations handling an internal id different from the OSM one.default PrimitiveId getOsmPrimitiveId()
getOsmId()
default PrimitiveId getPrimitiveId()
PrimitiveId.getUniqueId()
int getVersion()
PrimitiveData.setVersion(int)
void setOsmId(long id, int version)
id
- the id. > 0 requiredversion
- the version > 0 requiredjava.lang.IllegalArgumentException
- if id <= 0java.lang.IllegalArgumentException
- if version <= 0DataIntegrityProblemException
- if id is changed and primitive was already added to the datasetUser getUser()
void setUser(User user)
user
- the userjava.util.Date getTimestamp()
setTimestamp(java.util.Date)
int getRawTimestamp()
setRawTimestamp(int)
void setTimestamp(java.util.Date timestamp)
timestamp
- date of last modificationgetTimestamp()
void setRawTimestamp(int timestamp)
timestamp
- date of last modificationgetRawTimestamp()
boolean isTimestampEmpty()
true
if this primitive has no timestamp informationgetTimestamp()
,
getRawTimestamp()
int getChangesetId()
void setChangesetId(int changesetId)
changesetId
- the id. >= 0 required.java.lang.IllegalStateException
- if this primitive is new.java.lang.IllegalArgumentException
- if id < 0void accept(PrimitiveVisitor visitor)
visitor
- visitorvoid visitReferrers(PrimitiveVisitor visitor)
Visits visitor
for all referrers.
visitor
- the visitor. Ignored, if null.default java.lang.String getName()
name
or null, if this tag is not present.default java.lang.String getLocalName()
null
if no name existsLanguageInfo.getLanguageCodes(java.util.Locale)
java.lang.String getDisplayName(NameFormatter formatter)
formatter
formatter
- formatter to usedefault OsmPrimitiveType getDisplayType()
OsmPrimitiveType
void setHighlighted(boolean highlighted)
highlighted
- The new highlight flag.boolean isHighlighted()
boolean isTagged()
boolean isAnnotated()
default boolean isMultipolygon()
true
if it is a real multipolygon or a boundary relationboolean hasDirectionKeys()
true
if this object has direction dependent tagsboolean reversedDirection()
true
if this object has the "reversed direction" flag enabledBBox getBBox()
default java.util.List<? extends IPrimitive> getReferrers()
java.util.List<? extends IPrimitive> getReferrers(boolean allowWithoutDataset)
Way wnew = new Way(existingWay)
allowWithoutDataset
- If true, method will return empty list if primitive is not part of the dataset. If false,
exception will be thrown in this caseOsmData<?,?,?,?> getDataSet()
java.util.Map<java.lang.String,java.lang.String> getInterestingTags()
Tagged.getKeys()
for which key
does not fulfill uninteresting criteria.default boolean hasSameInterestingTags(IPrimitive other)
other
- the other object primitive