Class MeasurementRectangle


public class MeasurementRectangle extends MeasurementShapeMovable
Defines measurement rectangle shape. Allows to measure temperature in rectangular area. It gives the possibility to find area's minimum, maximum and average temperature. There is functionality to find the exact location for minimum and maximum values.
Below is an example, how to read and modify the collection containing rectangle measurement tools.
 public class MyMeasurements {
 
private ThermalImage mImage;
// ... load the image from file or FLIR Thermal camera
public void getRectangleMeasurements() { MeasurementShapeCollection collection = mImage.getMeasurements(); List<MeasurementRectangle> rectangles = collection.getRectangles(); // use rectangles }
public void addRectangleMeasurement(int left, int top, int width, int height) { try { mImage.getMeasurements().addRectangle(left, top, width, height); } catch (IllegalArgumentException e) { // invalid shape coordinates } } }
  • Method Details

    • moveTo

      public void moveTo(Point point) throws MeasurementException, IllegalArgumentException
      Description copied from class: MeasurementShapeMovable
      Moves the shape to the desired position.
      Specified by:
      moveTo in class MeasurementShapeMovable
      Parameters:
      point - A point where the shape should be moved to. If not stated otherwise, the point corresponds to top left corner of the shape.
      Throws:
      MeasurementException - when the shape is invalid (i.e. removed from measurements collection)
      IllegalArgumentException - when moving to given point causes the shape to be out of image bound (i.e. moving to negative coordinates)
    • offset

      public void offset(int offsetX, int offsetY) throws MeasurementException, IllegalArgumentException
      Description copied from class: MeasurementShapeMovable
      Moves the shape by offsetX on X axis and by offsetY on Y axis.
      Specified by:
      offset in class MeasurementShapeMovable
      Parameters:
      offsetX - an X axis offset by which the shape will be moved
      offsetY - an Y axis offset by which the shape will be moved
      Throws:
      MeasurementException - when the shape is invalid (i.e. removed from measurements collection)
      IllegalArgumentException - when moving to given position causes the shape to be out of image bound (i.e. moving to negative coordinates)
    • getWidth

      public int getWidth()
      Gets the width of the area the rectangle measurement tool covers.
      Returns:
      the width of the area the rectangle measurement tool covers.
    • setWidth

      public void setWidth(int width) throws MeasurementException, IllegalArgumentException
      Sets the new width of the area the rectangle measurement tool covers. The location of top right corner remains unchanged.
      Parameters:
      width - the width of the tool to set.
      Throws:
      MeasurementException - when the shape is invalid (i.e. removed from measurements collection)
      IllegalArgumentException - when width is incorrect (i.e. negative width or causes the shape to be out of image bound)
    • getHeight

      public int getHeight()
      Gets the height of the area the rectangle measurement tool covers.
      Returns:
      the height of the area the rectangle measurement tool covers.
    • setHeight

      public void setHeight(int height) throws MeasurementException, IllegalArgumentException
      Sets the new height of the area the rectangle measurement tool covers. The location of top right corner remains unchanged. The height is changed only, if provided value is greater than 0.
      Parameters:
      height - the height of the tool to set.
      Throws:
      MeasurementException - when the shape is invalid (i.e. removed from measurements collection)
      IllegalArgumentException - when height is incorrect (i.e. negative height or causes the shape to be out of image bound)
    • getPosition

      public Point getPosition()
      Gets the location of the area covered by the rectangle measurement tool. This location describes top left corner of the rectangle.
      Returns:
      the location of top left corner of the area representing rectangle measurement tool.
    • getRectangle

      public Rectangle getRectangle()
      Gets the area covered by rectangle measurement tool. All measurement's values depend on the area the tool covers.
      Returns:
      the area covered by rectangle measurement tool.
    • setRectangle

      public void setRectangle(@NotNull @NotNull Rectangle rectangle)
      Sets the area covered by rectangle measurement tool. All measurement's values depend on the area the tool covers.
    • getMinMarkerPosition

      public Point getMinMarkerPosition()
    • getMinMarker

      public boolean getMinMarker()
    • setMinMarker

      public void setMinMarker(boolean visible) throws MeasurementException
      Throws:
      MeasurementException
    • getMaxMarkerPosition

      public Point getMaxMarkerPosition()
    • getMaxMarker

      public boolean getMaxMarker()
    • setMaxMarker

      public void setMaxMarker(boolean visible) throws MeasurementException
      Throws:
      MeasurementException
    • getAvgValue

      public ThermalValue getAvgValue()
    • getMinValue

      public ThermalValue getMinValue()
    • getMaxValue

      public ThermalValue getMaxValue()
    • getAvgCalc

      public boolean getAvgCalc()
    • setAvgCalc

      public void setAvgCalc(boolean enable) throws MeasurementException
      Throws:
      MeasurementException
    • getMinCalc

      public boolean getMinCalc()
    • setMinCalc

      public void setMinCalc(boolean enable) throws MeasurementException
      Throws:
      MeasurementException
    • getMaxCalc

      public boolean getMaxCalc()
    • setMaxCalc

      public void setMaxCalc(boolean enable) throws MeasurementException
      Throws:
      MeasurementException
    • getAreaDimensions

      public AreaDimensions getAreaDimensions()
    • getAreaCalc

      public boolean getAreaCalc()
    • setAreaCalc

      public void setAreaCalc(boolean enable)
    • toString

      public String toString()
      Overrides:
      toString in class Object