Class MergeOverlapsHelper


  • public class MergeOverlapsHelper
    extends Object
    Helper class for merging object overlaps.
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    • Constructor Detail

      • MergeOverlapsHelper

        public MergeOverlapsHelper()
    • Method Detail

      • findObjectsToMerge

        public static List<LocatedObject> findObjectsToMerge​(LocatedObject obj,
                                                             Map<LocatedObject,​Double> matches,
                                                             Set<LocatedObject> merged,
                                                             String labelKey)
        Determines the objects to merge.
        Parameters:
        obj - the objects for which matches were located
        matches - the matching objects
        merged - the objects that have been merged already
        labelKey - the key in the metadata containing the label
        Returns:
        the list of objects to merge
      • toGeometry

        public static org.locationtech.jts.geom.Geometry toGeometry​(LocatedObject obj,
                                                                    ObjectOverlap algorithm)
        Turns the located object's polygon or bbox into a Geometry instance. Takes potential bbox fallback into account.
        Parameters:
        obj - the object to convert
        algorithm - the overlap algorithm to use
        Returns:
        the generated Gemoetry
      • mergeObjects

        public static List<LocatedObject> mergeObjects​(LoggingObject loggingObject,
                                                       List<LocatedObject> objs,
                                                       ObjectOverlap algorithm,
                                                       String scoreKey,
                                                       String labelKey,
                                                       MergedScoreCalculation mergedScoreCalculation)
        Merges the objects into a single on.
        Parameters:
        loggingObject - the project use for logging errors etc, can be null
        objs - the objects to merge
        algorithm - the overlap algorithm to use
        scoreKey - the meta-data key with the score
        labelKey - the meta-data key with the label
        mergedScoreCalculation - how to calculate the merged score
        Returns:
        the merged object