Class LocatedObjects

    • Constructor Detail

      • LocatedObjects

        public LocatedObjects()
        Initializes the list.
      • LocatedObjects

        public LocatedObjects​(LocatedObjects objects)
        Initializes the list.
        Parameters:
        objects - the list to initialize with
      • LocatedObjects

        public LocatedObjects​(List<LocatedObject> objects)
        Initializes the list.
        Parameters:
        objects - the list to initialize with
      • LocatedObjects

        public LocatedObjects​(LocatedObject[] objects)
        Initializes the list.
        Parameters:
        objects - the array to initialize with
      • LocatedObjects

        public LocatedObjects​(LocatedObject object)
        Initializes the list.
        Parameters:
        object - the object to initialize with
    • Method Detail

      • getLogger

        public Logger getLogger()
        Returns the logger instance.
        Returns:
        the logger
      • subset

        public LocatedObjects subset​(int[] indices)
        Returns a new instance using the specified object indices.
        Parameters:
        indices - the indices for the subset
        Returns:
        the subset
      • subset

        public LocatedObjects subset​(int[] indices,
                                     boolean invert)
        Returns a new instance using the specified object indices.
        Parameters:
        indices - the indices for the subset
        invert - whether to invert the matching of the indices
        Returns:
        the subset
      • subList

        public LocatedObjects subList​(int[] indices)
        Returns a new instance using the specified list indices.
        Parameters:
        indices - the list indices for the subset
        Returns:
        the subset
      • subList

        public LocatedObjects subList​(int[] indices,
                                      boolean invert)
        Returns a new instance using the specified list indices.
        Parameters:
        indices - the list indices for the subset
        invert - whether to invert the matching of the indices
        Returns:
        the subset
      • remove

        public void remove​(int[] indices)
        Removes the objects with the specified indices.
        Parameters:
        indices - the indices to remove (ie the indices stored with the object!)
      • find

        public LocatedObject find​(int index)
        Returns the object with the specified index.
        Parameters:
        index - the index to look for
        Returns:
        the object, null if none found
      • find

        public LocatedObject find​(String index)
        Returns the object with the specified index.
        Parameters:
        index - the index to look for
        Returns:
        the object, null if none found
      • scale

        public void scale​(double scale)
        Scales all objects with the provided scale factor.
        Parameters:
        scale - the scale factor
      • renameMetaDataKey

        public int renameMetaDataKey​(String oldKey,
                                     String newKey)
        Renames the meta-data key in all objects.
        Parameters:
        oldKey - the old key
        newKey - the new key
        Returns:
        how many keys were updated
      • resetIndex

        public void resetIndex()
        Resets the index value of all the objects (starts at 1) in the meta-data using the current order in the list.
      • resetIndex

        public void resetIndex​(int offset)
        Resets the index value of all the objects (starts at 1) in the meta-data using the current order in the list.
        Parameters:
        offset - the offset to add to the index
      • resetIndexIfNecessary

        public void resetIndexIfNecessary()
        Resets the index value of all the objects (starts at 1) in the meta-data using the current order in the list, but only if necessary (eg missing or duplicate indices).
      • resetIndexIfNecessary

        public void resetIndexIfNecessary​(int offset)
        Resets the index value of all the objects (starts at 1) in the meta-data using the current order in the list, but only if necessary (eg missing or duplicate indices).
        Parameters:
        offset - the offset to add to the index
      • checkIndices

        public boolean checkIndices()
        Checks whether the indices are valid, i.e., no missing or duplicate ones.
        Returns:
        true if valid
      • toReport

        public Report toReport​(String prefix)
        Turns the located objects into a report. Using a prefix like "Object." will result in the following report entries for a single object:
         Object.1.x
         Object.1.y
         Object.1.width
         Object.1.height
         
        Parameters:
        prefix - the prefix to use
        Returns:
        the generated report
      • toReport

        public Report toReport​(String prefix,
                               int offset)
        Turns the located objects into a report. Does not update the index in the meta-data. Using a prefix like "Object." will result in the following report entries for a single object:
         Object.1.x
         Object.1.y
         Object.1.width
         Object.1.height
         Object.1.poly_x -- if polygon data present
         Object.1.poly_y -- if polygon data present
         
        Parameters:
        prefix - the prefix to use
        offset - the offset for the index to use
        Returns:
        the generated report
      • toReport

        public Report toReport​(String prefix,
                               int offset,
                               boolean updateIndex)
        Turns the located objects into a report. Using a prefix like "Object." will result in the following report entries for a single object:
         Object.1.x
         Object.1.y
         Object.1.width
         Object.1.height
         Object.1.poly_x -- if polygon data present
         Object.1.poly_y -- if polygon data present
         
        Parameters:
        prefix - the prefix to use
        offset - the offset for the index to use
        updateIndex - whether to update the index in the meta-data
        Returns:
        the generated report
      • fromReport

        public static LocatedObjects fromReport​(Report report,
                                                String prefix)
        Retrieves all objects from the report.
        Parameters:
        report - the report to process
        prefix - the prefix to look for
        Returns:
        the objects found
      • fromReport

        public static LocatedObjects fromReport​(Report report,
                                                String prefix,
                                                LocatedObjectFilter filter)
        Retrieves all objects from the report.
        Parameters:
        report - the report to process
        prefix - the prefix to look for
        filter - the filter to use for further filtering the objects, ignored if null
        Returns:
        the objects found
      • fromReport

        public static LocatedObjects fromReport​(Report report,
                                                String[] prefixes)
        Retrieves all objects from the report.
        Parameters:
        report - the report to process
        prefixes - the prefixes to look for
        Returns:
        the objects found
      • fromReport

        public static LocatedObjects fromReport​(Report report,
                                                String[] prefixes,
                                                LocatedObjectFilter filter)
        Retrieves all objects from the report.
        Parameters:
        report - the report to process
        prefixes - the prefixes to look for
        filter - the filter to use for further filtering the objects, ignored if null
        Returns:
        the objects found