Interface IPolygonScaling

  • All Known Implementing Classes:
    PolygonScaling

    public interface IPolygonScaling
    This interface defines the functionality that is needed to manipulate polygons, that define clickable areas within an image. As the image is cropped, scaled and bordered this influences the locations and size of the defined polygons. Furthermore there is the issue, That the polygons are defined relative to the top left corner of the image, for usage the absolute coordinates on the screen are needed.
    Author:
    Andi Hotz, (c) Sahits GmbH, 2012 Created on Jun 29, 2012
    • Method Detail

      • recalculatePolygons

        ImageData recalculatePolygons​(ImageData imgData,
                                      ImageScaleState state)
        Compute the location and dimensions of the NamedPolygons that are contained in imgData based on the scaling state. If the image was cropped or bordered this may result in a translocation of the defined polygon. If the image was scaled this will result in a translocation to or from the origin (top left corner) by the factor of the scaling. A new instance of image Data with the new polygon definition will be returned.
        Parameters:
        imgData - Input data of the image containing a list of NamedPolygons that are to be recalculated
        state - of the scaled image
        Returns:
        new instance of ImageData containing the recalculated polygons
      • recalculatePolygonsOffset

        ImageData recalculatePolygonsOffset​(ImageData imgData,
                                            javafx.geometry.Point2D offset)
        Recalculate the positions of the polygons to reflect their absolute on screen locations.
        Parameters:
        imgData - Input data of the image containing a list of NamedPolygons that are to be recalculated
        offset - Point indicating the absolute position on screen of the origin (top left corner) of the image
        Returns:
        new instance of ImageData containing the recalculated polygons