Class OSMContributionImpl

  • All Implemented Interfaces:
    Comparable<OSMContribution>, OSHDBMapReducible, OSMContribution

    public class OSMContributionImpl
    extends Object
    implements OSMContribution
    Information about a single modification ("contribution") of a single OSM object.

    It holds the information about:

    • the timestamp at which this change happened
    • state of the entity before and after the modification
    • the geometry of the entity before and after the modification
    • the type(s) of change which has happened here (e.g. creation/deletion of an entity, modification of a geometry, altering of the tag list, etc.)
    • Constructor Detail

      • OSMContributionImpl

        public OSMContributionImpl​(OSMContribution other,
                                   org.locationtech.jts.geom.Geometry reclippedGeometryBefore,
                                   org.locationtech.jts.geom.Geometry reclippedGeometryAfter)
        Creates a copy of the given contribution object with an updated before/after geometry.
      • OSMContributionImpl

        public OSMContributionImpl​(OSMContribution other,
                                   LazyEvaluatedObject<org.locationtech.jts.geom.Geometry> reclippedGeometryBefore,
                                   LazyEvaluatedObject<org.locationtech.jts.geom.Geometry> reclippedGeometryAfter)
        Creates a copy of the given contribution object with an updated before/after geometry.
    • Method Detail

      • getTimestamp

        public OSHDBTimestamp getTimestamp()
        Description copied from interface: OSMContribution
        Returns the timestamp at which this data modification has happened.
        Specified by:
        getTimestamp in interface OSMContribution
        Returns:
        the modification timestamp as a OSHDBTimestamp object
      • getGeometryBefore

        public org.locationtech.jts.geom.Geometry getGeometryBefore()
        Description copied from interface: OSMContribution
        Returns the geometry of the entity before this modification clipped to the requested area of interest. May be `null` if this is an entity creation.
        Specified by:
        getGeometryBefore in interface OSMContribution
        Returns:
        a JTS Geometry object representing the entity's state before the modification (clipped to the respective area of interest)
      • getGeometryUnclippedBefore

        public org.locationtech.jts.geom.Geometry getGeometryUnclippedBefore()
        Description copied from interface: OSMContribution
        Returns the geometry of the entity before this modification. This is the full (unclipped) geometry of the entity. May be `null` if this is an entity creation.
        Specified by:
        getGeometryUnclippedBefore in interface OSMContribution
        Returns:
        a JTS Geometry object representing the entity's state before the modification (not clipped to the respective area of interest)
      • getGeometryAfter

        public org.locationtech.jts.geom.Geometry getGeometryAfter()
        Description copied from interface: OSMContribution
        Returns the geometry of the entity after this modification clipped to the requested area of interest. May be `null` if this is an entity deletion.
        Specified by:
        getGeometryAfter in interface OSMContribution
        Returns:
        a JTS Geometry object representing the entity's state after the modification (clipped to the respective area of interest)
      • getGeometryUnclippedAfter

        public org.locationtech.jts.geom.Geometry getGeometryUnclippedAfter()
        Description copied from interface: OSMContribution
        Returns the geometry of the entity after this modification. This is the full (unclipped) geometry of the entity. May be `null` if this is an entity deletion.
        Specified by:
        getGeometryUnclippedAfter in interface OSMContribution
        Returns:
        a JTS Geometry object representing the entity's state after the modification (not clipped to the respective area of interest)
      • getEntityBefore

        public OSMEntity getEntityBefore()
        Description copied from interface: OSMContribution
        Returns the entity object in its state before this modification. Is `null` if this is a entity creation.
        Specified by:
        getEntityBefore in interface OSMContribution
        Returns:
        the entity object as it was before this modification
      • getEntityAfter

        public OSMEntity getEntityAfter()
        Description copied from interface: OSMContribution
        Returns the entity object in its state after this modification.

        If this is a entity deletion, the returned entity will have the visible flag set to false: `entity.getEntityAfter().isVisible == false`

        Specified by:
        getEntityAfter in interface OSMContribution
        Returns:
        the entity object as it was after this modification
      • getOSHEntity

        public OSHEntity getOSHEntity()
        Description copied from interface: OSMContribution
        The (parent) osh entity of the osm entities involved in this contribution.
        Specified by:
        getOSHEntity in interface OSMContribution
        Returns:
        the OSHEntity object of this contribution
      • is

        public boolean is​(ContributionType contributionType)
        Description copied from interface: OSMContribution
        Checks if this contribution is of the given contribution type.

        It can be one or more of:

        • CREATION
        • DELETION
        • TAG_CHANGE
        • GEOMETRY_CHANGE

        If this is a entity creation or deletion, the other flags are not set (even though one might argue that a just created object clearly has a different geometry than before, for example).

        Specified by:
        is in interface OSMContribution
        Returns:
        a set of modification type this contribution made on the underlying data
      • getContributionTypes

        public EnumSet<ContributionType> getContributionTypes()
        Description copied from interface: OSMContribution
        Determined the type of modification this contribution has made.

        Can be one or more of:

        • CREATION
        • DELETION
        • TAG_CHANGE
        • GEOMETRY_CHANGE

        If this is a entity creation or deletion, the other flags are not set (even though one might argue that a just created object clearly has a different geometry than before, for example).

        Specified by:
        getContributionTypes in interface OSMContribution
        Returns:
        a set of modification type this contribution made on the underlying data
      • getContributorUserId

        public int getContributorUserId()
        Description copied from interface: OSMContribution
        Returns the user id of the osm contributor responsible for this data modification.

        This user id can be different from what one gets by calling `.getEntityAfter().getUserId()` if the contribution is a pure geometry change (i.e. the entity itself has not ben modified, but one or more of its child entities):

        If the entity is a way or relation, and in a contribution *"only"* the geometry has been changed, we can't find out the respective contributor's user id only by looking at the entity alone – instead, we need to iterate over all the entity's children to find the actual contributor's user id.

        Specified by:
        getContributorUserId in interface OSMContribution
        Returns:
        returns the user id of the contributor who made this modification
      • getChangesetId

        public long getChangesetId()
        Description copied from interface: OSMContribution
        Returns the osm changeset id of the contribution.
        Specified by:
        getChangesetId in interface OSMContribution
        Returns:
        the id of the osm changeset represented by the current contribution object