Class CheckFlag

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Iterable<org.openstreetmap.atlas.geography.Location>, org.openstreetmap.atlas.geography.Located

    public class CheckFlag
    extends java.lang.Object
    implements java.lang.Iterable<org.openstreetmap.atlas.geography.Location>, org.openstreetmap.atlas.geography.Located, java.io.Serializable
    A CheckFlag is used to flag one or more AtlasObjects found to violate some set of rules.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String NULL_IDENTIFIERS  
    • Constructor Summary

      Constructors 
      Constructor Description
      CheckFlag​(java.lang.String identifier)
      A basic constructor that simply flags some identifying value
      CheckFlag​(java.lang.String identifier, java.util.Set<? extends org.openstreetmap.atlas.geography.atlas.items.AtlasObject> objects, java.util.List<java.lang.String> instructions)
      Creates a CheckFlag with a set of AtlasObjects to flag, most commonly used when all of the AtlasObjects contribute to the rule violation
      CheckFlag​(java.lang.String identifier, java.util.Set<? extends org.openstreetmap.atlas.geography.atlas.items.AtlasObject> objects, java.util.List<java.lang.String> instructions, java.util.List<org.openstreetmap.atlas.geography.Location> points)
      Creates a CheckFlag with the addition of a list of point Locations that highlight specific points in the geometry that caused the rule violation
      CheckFlag​(java.lang.String identifier, java.util.Set<? extends org.openstreetmap.atlas.geography.atlas.items.AtlasObject> objects, java.util.List<java.lang.String> instructions, java.util.List<org.openstreetmap.atlas.geography.Location> points, java.util.Set<org.openstreetmap.atlas.geography.atlas.change.FeatureChange> fixSuggestions)
      Creates a CheckFlag with the addition of a list of point Locations that highlight specific points and a Set of FeatureChanges that suggest how to fix the flagged objects.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      CheckFlag addFixSuggestion​(org.openstreetmap.atlas.geography.atlas.change.FeatureChange suggestion)
      Add a single FeatureChange to the fix suggestions.
      CheckFlag addFixSuggestions​(java.util.Collection<org.openstreetmap.atlas.geography.atlas.change.FeatureChange> suggestions)
      Add a Set of FeatureChanges to the fix suggestions.
      void addInstruction​(java.lang.String instruction)
      Adds any instructions that may help communicate why the AtlasObject(s) were flagged
      void addInstructions​(java.lang.Iterable<java.lang.String> instructions)
      Adds a list of instructions that may help communicate why the AtlasObject(s) were flagged.
      void addObject​(FlaggedObject object)
      Adds a FlaggedObject to the flag.
      void addObject​(org.openstreetmap.atlas.geography.atlas.items.AtlasObject object)
      Adds an AtlasObject to flag
      void addObject​(org.openstreetmap.atlas.geography.atlas.items.AtlasObject object, java.lang.String instruction)
      Flags an AtlasObject with instructions.
      void addObject​(org.openstreetmap.atlas.geography.atlas.items.AtlasObject object, org.openstreetmap.atlas.geography.Location point, java.lang.String instruction)
      Flags an AtlasObject, highlighting a specific point Location and instructions with more detail.
      void addObjects​(java.lang.Iterable<? extends org.openstreetmap.atlas.geography.atlas.items.AtlasObject> objects)
      Adds a list of AtlasObjects to flag
      void addPoint​(org.openstreetmap.atlas.geography.Location point)
      Flags a specific Location
      void addPoints​(java.lang.Iterable<org.openstreetmap.atlas.geography.Location> points)
      Flags a list of point Locations
      com.google.gson.JsonObject asGeoJsonFeature()  
      org.openstreetmap.atlas.geography.Rectangle bounds()  
      boolean equals​(java.lang.Object other)  
      java.util.Optional<java.lang.String> getChallengeName()  
      java.lang.String getCountryISO()
      Will return the first country ISO that it finds in the objects provided in the flag
      java.util.Set<org.openstreetmap.atlas.geography.atlas.change.FeatureChange> getFixSuggestions()  
      java.util.Set<FlaggedObject> getFlaggedObjects()  
      java.util.Set<FlaggedObject> getFlaggedRelations()  
      java.util.List<org.openstreetmap.atlas.geography.geojson.GeoJsonBuilder.GeometryWithProperties> getGeometryWithProperties()  
      java.lang.String getIdentifier()  
      java.lang.String getInstructions()  
      Task getMapRouletteTask()
      Builds a MapRouletted Task from this CheckFlag
      Task getMapRouletteTask​(boolean includeFixSuggestions)
      Wraps getMapRouletteTask() to embed optional fix suggestions
      java.util.Set<org.openstreetmap.atlas.geography.Location> getPoints()  
      java.util.Set<org.openstreetmap.atlas.geography.PolyLine> getPolyLines()  
      java.util.List<java.lang.String> getRawInstructions()  
      java.lang.Iterable<java.lang.Iterable<org.openstreetmap.atlas.geography.Location>> getShapes()  
      java.util.Set<java.lang.String> getUniqueIdentifiers()
      Generates an id Set for unique flag identification.
      int hashCode()  
      java.util.Iterator<org.openstreetmap.atlas.geography.Location> iterator()  
      CheckFlag makeComplete()
      Decouple the CheckFlag from any Atlass by making all the FlaggedObjects complete.
      void save​(org.openstreetmap.atlas.streaming.resource.WritableResource writableResource)
      Writes the string value of this CheckFlag to the WritableResource
      void setChallengeName​(java.lang.String challengeName)
      Sets a Challenge name for this Flag
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
      • Methods inherited from interface org.openstreetmap.atlas.geography.Located

        within
    • Field Detail

      • NULL_IDENTIFIERS

        public static final java.lang.String NULL_IDENTIFIERS
        See Also:
        Constant Field Values
    • Constructor Detail

      • CheckFlag

        public CheckFlag​(java.lang.String identifier)
        A basic constructor that simply flags some identifying value
        Parameters:
        identifier - the identifying value to flag
      • CheckFlag

        public CheckFlag​(java.lang.String identifier,
                         java.util.Set<? extends org.openstreetmap.atlas.geography.atlas.items.AtlasObject> objects,
                         java.util.List<java.lang.String> instructions)
        Creates a CheckFlag with a set of AtlasObjects to flag, most commonly used when all of the AtlasObjects contribute to the rule violation
        Parameters:
        identifier - the identifying value to flag
        objects - AtlasObjects to flag
        instructions - a list of free form instructions
      • CheckFlag

        public CheckFlag​(java.lang.String identifier,
                         java.util.Set<? extends org.openstreetmap.atlas.geography.atlas.items.AtlasObject> objects,
                         java.util.List<java.lang.String> instructions,
                         java.util.List<org.openstreetmap.atlas.geography.Location> points)
        Creates a CheckFlag with the addition of a list of point Locations that highlight specific points in the geometry that caused the rule violation
        Parameters:
        identifier - the identifying value to flag
        objects - AtlasObjects to flag
        instructions - a list of free form instructions
        points - point Locations to highlight
      • CheckFlag

        public CheckFlag​(java.lang.String identifier,
                         java.util.Set<? extends org.openstreetmap.atlas.geography.atlas.items.AtlasObject> objects,
                         java.util.List<java.lang.String> instructions,
                         java.util.List<org.openstreetmap.atlas.geography.Location> points,
                         java.util.Set<org.openstreetmap.atlas.geography.atlas.change.FeatureChange> fixSuggestions)
        Creates a CheckFlag with the addition of a list of point Locations that highlight specific points and a Set of FeatureChanges that suggest how to fix the flagged objects.
        Parameters:
        identifier - the identifying value to flag
        objects - AtlasObjects to flag
        instructions - a list of free form instructions
        points - point Locations to highlight
        fixSuggestions - Set of FeatureChanges representing suggested fixes for flagged features
    • Method Detail

      • addFixSuggestion

        public CheckFlag addFixSuggestion​(org.openstreetmap.atlas.geography.atlas.change.FeatureChange suggestion)
        Add a single FeatureChange to the fix suggestions. Fix suggestions should be FeatureChanges of CompleteEntitys created from flagged AtlasEntitys with changes suggesting how the flagged feature can be fixed.
        Parameters:
        suggestion - FeatureChange with suggested alterations to a flagged feature
        Returns:
        this CheckFlag
      • addFixSuggestions

        public CheckFlag addFixSuggestions​(java.util.Collection<org.openstreetmap.atlas.geography.atlas.change.FeatureChange> suggestions)
        Add a Set of FeatureChanges to the fix suggestions.
        Parameters:
        suggestions - Collection of FeatureChange fix suggestions
        Returns:
        this CheckFlag
      • addInstruction

        public void addInstruction​(java.lang.String instruction)
        Adds any instructions that may help communicate why the AtlasObject(s) were flagged
        Parameters:
        instruction - a free form instruction
      • addInstructions

        public void addInstructions​(java.lang.Iterable<java.lang.String> instructions)
        Adds a list of instructions that may help communicate why the AtlasObject(s) were flagged. This can be useful if multiple rules were violated
        Parameters:
        instructions - a list of free form instruction
      • addObject

        public void addObject​(org.openstreetmap.atlas.geography.atlas.items.AtlasObject object)
        Adds an AtlasObject to flag
        Parameters:
        object - an AtlasObject
      • addObject

        public void addObject​(org.openstreetmap.atlas.geography.atlas.items.AtlasObject object,
                              org.openstreetmap.atlas.geography.Location point,
                              java.lang.String instruction)
        Flags an AtlasObject, highlighting a specific point Location and instructions with more detail. This helps build flags iteratively when more complex Checks span a large number of AtlasObjects.
        Parameters:
        object - the AtlasObject to flag
        point - the point Location to highlight
        instruction - a free form instruction
      • addObject

        public void addObject​(org.openstreetmap.atlas.geography.atlas.items.AtlasObject object,
                              java.lang.String instruction)
        Flags an AtlasObject with instructions. This helps build flags iteratively when more complex Checks span a large number of AtlasObjects
        Parameters:
        object - the AtlasObject to flag
        instruction - a free form instruction
      • addObjects

        public void addObjects​(java.lang.Iterable<? extends org.openstreetmap.atlas.geography.atlas.items.AtlasObject> objects)
        Adds a list of AtlasObjects to flag
        Parameters:
        objects - a list of AtlasObjects
      • addPoint

        public void addPoint​(org.openstreetmap.atlas.geography.Location point)
        Flags a specific Location
        Parameters:
        point - the point Location to flag
      • addPoints

        public void addPoints​(java.lang.Iterable<org.openstreetmap.atlas.geography.Location> points)
        Flags a list of point Locations
        Parameters:
        points - the point Locations to flag
      • asGeoJsonFeature

        public com.google.gson.JsonObject asGeoJsonFeature()
      • bounds

        public org.openstreetmap.atlas.geography.Rectangle bounds()
        Specified by:
        bounds in interface org.openstreetmap.atlas.geography.Located
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • getChallengeName

        public java.util.Optional<java.lang.String> getChallengeName()
        Returns:
        a Challenge name
      • getCountryISO

        public java.lang.String getCountryISO()
        Will return the first country ISO that it finds in the objects provided in the flag
        Returns:
        a country ISO3 code
      • getFixSuggestions

        public java.util.Set<org.openstreetmap.atlas.geography.atlas.change.FeatureChange> getFixSuggestions()
        Returns:
        a Set of FeatureChange fix suggestions
      • getFlaggedObjects

        public java.util.Set<FlaggedObject> getFlaggedObjects()
        Returns:
        a set of flagged AtlasObjects
      • getFlaggedRelations

        public java.util.Set<FlaggedObject> getFlaggedRelations()
        Returns:
        a set of flagged Relations
      • getGeometryWithProperties

        public java.util.List<org.openstreetmap.atlas.geography.geojson.GeoJsonBuilder.GeometryWithProperties> getGeometryWithProperties()
        Returns:
        a list of GeoJsonBuilder.GeometryWithProperties representing all flagged geometries
      • getIdentifier

        public java.lang.String getIdentifier()
        Returns:
        the flag identifier
      • getInstructions

        public java.lang.String getInstructions()
        Returns:
        all of the instructions in a String
      • getMapRouletteTask

        public Task getMapRouletteTask()
        Builds a MapRouletted Task from this CheckFlag
        Returns:
        a Task
      • getMapRouletteTask

        public Task getMapRouletteTask​(boolean includeFixSuggestions)
        Wraps getMapRouletteTask() to embed optional fix suggestions
        Parameters:
        includeFixSuggestions - true if we want to upload fix suggestions, false if not
        Returns:
        a Task
      • getPoints

        public java.util.Set<org.openstreetmap.atlas.geography.Location> getPoints()
        Returns:
        a set of all point Location geometries flagged
      • getPolyLines

        public java.util.Set<org.openstreetmap.atlas.geography.PolyLine> getPolyLines()
        Returns:
        a set of all polyline geometries flagged
      • getRawInstructions

        public java.util.List<java.lang.String> getRawInstructions()
      • getShapes

        public java.lang.Iterable<java.lang.Iterable<org.openstreetmap.atlas.geography.Location>> getShapes()
        Returns:
        a shape representation of all polyline geometries flagged
      • getUniqueIdentifiers

        public java.util.Set<java.lang.String> getUniqueIdentifiers()
        Generates an id Set for unique flag identification. The set is comprised of the item type + atlas id of the flagged objects. If there are no objects with atlas ids then the set only contains the check flag id.
        Returns:
        a Set of the unique ids
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • iterator

        public java.util.Iterator<org.openstreetmap.atlas.geography.Location> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<org.openstreetmap.atlas.geography.Location>
      • save

        public void save​(org.openstreetmap.atlas.streaming.resource.WritableResource writableResource)
        Writes the string value of this CheckFlag to the WritableResource
        Parameters:
        writableResource - a WritableResource to write to
      • setChallengeName

        public void setChallengeName​(java.lang.String challengeName)
        Sets a Challenge name for this Flag
        Parameters:
        challengeName - a Challenge name
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object