public class PolygonHelper
Helper to make it easier to draw polygon on view
| Modifier and Type | Method and Description |
|---|---|
static boolean |
checkPolygonSize() |
void |
getDrawingPolygon()
Processes original polygon with coordinates 0..1 to drawing polygon by multiplying them by view dimensions
|
void |
getPolygonFromDrawingPolygon()
Processes drawing polygon coordinates to polygon with coordinates 0..1 by dividing them by view dimensions
|
void |
polygonToPoints()
Calculates lines points from polygon multiplying 0..1 values by view dimensions and applying rotation matrix. Usually used on preview as it has camera rotation
|
java.util.List<net.doo.snap.lib.detector.Line2D> |
scaleLines()
Performs scaling from 0..1 values to image pixel values
|
void |
setImageSize()
Set scaled image size that will be drawn on screen
|
void |
setLayout()
Sets layout of surface inside parent to compensate differences between viewport and preview sizes and draw polygon correctly
|
void |
setRotation()
Set rotation in degrees for polygon
|
public static boolean checkPolygonSize()
true if polygon edges sizes less than PolygonHelper#MIN_EDGE_LENGTH_PX, false - otherwisepublic void setRotation()
Set rotation in degrees for polygon
public void setImageSize()
Set scaled image size that will be drawn on screen
public void setLayout()
Sets layout of surface inside parent to compensate differences between viewport and preview sizes and draw polygon correctly
public void polygonToPoints()
Calculates lines points from polygon multiplying 0..1 values by view dimensions and applying rotation matrix. Usually used on preview as it has camera rotation
public void getDrawingPolygon()
Processes original polygon with coordinates 0..1 to drawing polygon by multiplying them by view dimensions
public void getPolygonFromDrawingPolygon()
Processes drawing polygon coordinates to polygon with coordinates 0..1 by dividing them by view dimensions
public java.util.List<net.doo.snap.lib.detector.Line2D> scaleLines()
Performs scaling from 0..1 values to image pixel values