Class PolygonViewHelper
-
- All Implemented Interfaces:
public class PolygonViewHelperHelper to make it easier to draw polygon on view
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classPolygonViewHelper.EdgeRepresents edge of polygon with near and far points as well as intersecting lines from other edges
pointA handle pointB O========[0]=========O | ^ edgeLine ^ | | | |lineA | lineB | | | | O====================O pointFarA pointFarB
public classPolygonViewHelper.LineRepresentation of line
Calculates line by two points and finds intersection points with other lines General line formula is a * x + b * y + c = 0
-
Constructor Summary
Constructors Constructor Description PolygonViewHelper()
-
Method Summary
Modifier and Type Method Description static booleancheckPolygonSize(List<Point> polygon)voidsetImageSize(int width, int height)Set scaled image size that will be drawn on screen voidsetLayout(int left, int top, int right, int bottom)Sets layout of surface inside parent to compensate differences between viewport and preview sizes and draw polygon correctly voidpolygonToLinePoints(List<PointF> polygon, Array<float> points)Calculates lines points from polygon multiplying 0..1 values by view dimensions and applying rotation matrix. voidpolygonToPoints(List<PointF> polygon, Array<float> points)Calculates points from polygon multiplying 0..1 values by view dimensions and applying rotation matrix. voidgetDrawingPolygon(List<PointF> polygon, List<PointF> drawingPolygon)Processes original polygon with coordinates 0.. voidgetPolygonFromDrawingPolygon(List<PointF> drawingPolygon, List<PointF> polygon)Processes drawing polygon coordinates to polygon with coordinates 0.. voidsetRotation(int degrees)Set rotation in degrees for polygon -
-
Method Detail
-
checkPolygonSize
static boolean checkPolygonSize(List<Point> polygon)
-
setImageSize
void setImageSize(int width, int height)
Set scaled image size that will be drawn on screen
-
setLayout
void setLayout(int left, int top, int right, int bottom)
Sets layout of surface inside parent to compensate differences between viewport and preview sizes and draw polygon correctly
-
polygonToLinePoints
void polygonToLinePoints(List<PointF> polygon, Array<float> points)
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
-
polygonToPoints
void polygonToPoints(List<PointF> polygon, Array<float> points)
Calculates points from polygon multiplying 0..1 values by view dimensions and applying rotation matrix. Usually used on preview as it has camera rotation
-
getDrawingPolygon
void getDrawingPolygon(List<PointF> polygon, List<PointF> drawingPolygon)
Processes original polygon with coordinates 0..1 to drawing polygon by multiplying them by view dimensions
-
getPolygonFromDrawingPolygon
void getPolygonFromDrawingPolygon(List<PointF> drawingPolygon, List<PointF> polygon)
Processes drawing polygon coordinates to polygon with coordinates 0..1 by dividing them by view dimensions
-
setRotation
void setRotation(int degrees)
Set rotation in degrees for polygon
- Parameters:
degrees- usually camera rotation angle is used here
-
-
-
-