public AbstractShape getShape(){
this.endPath();
ArrayList<Vertex[]> contours = this.pathHandler.getContours();
Vertex[] allPoints = this.pathHandler.getPathPointsArray();
AbstractShape returnComponent = null;
//Check for convexity
int convexity = ConvexityUtil.classifyPolygon2(allPoints.length, allPoints);
switch (convexity) {
case ConvexityUtil.NotConvexDegenerate:
// logger.debug("not Convex Degenerate");
case ConvexityUtil.NotConvex:
// logger.debug("not convex");
returnComponent = createComplexPoly(contours, MTComplexPolygon.WINDING_RULE_ODD);
break;
case ConvexityUtil.ConvexDegenerate:
// logger.debug("convex degenerate");
case ConvexityUtil.ConvexCW:
// logger.debug("convex clockwise");
case ConvexityUtil.ConvexCCW:
// logger.debug("convex counterclockwise");
returnComponent = createPoly(allPoints);
break;
default:
break;
}
//Create some default texture coords
if (returnComponent != null && returnComponent.hasBounds() && returnComponent.getBounds() instanceof BoundsZPlaneRectangle){
BoundsZPlaneRectangle bounds = (BoundsZPlaneRectangle) returnComponent.getBounds();
float width = bounds.getWidthXY(TransformSpace.LOCAL);
float height = bounds.getHeightXY(TransformSpace.LOCAL);
float upperLeftX = bounds.getVectorsLocal()[0].x;
float upperLeftY = bounds.getVectorsLocal()[0].y;
Vertex[] verts = returnComponent.getVerticesLocal();
for (int i = 0; i < verts.length; i++) {
Vertex vertex = verts[i];
vertex.setTexCoordU((vertex.x-upperLeftX)/width);
vertex.setTexCoordV((vertex.y-upperLeftY)/height);
//System.out.println("TexU:" + vertex.getTexCoordU() + " TexV:" + vertex.getTexCoordV());
}
returnComponent.getGeometryInfo().updateTextureBuffer(returnComponent.isUseVBOs());
}
return returnComponent;
}