createPointShape method
Creates a point shape for the screen position
mxs, mys
with the geometric form shape
.
Implementation
GeometryElement createPointShape(int mxs, int mys, String shape) {
GeometryElement pointShape;
String stroke = attr[PyA.STROKE], fill = "white";
if (shape == POLYLINE_POINT_SHAPE_SQUARE_EMPTY) {
int width = 8, height = width;
pointShape = RectElement();
SVG.setAttr(pointShape, {
"x": "${mxs + width / ~2}", // center the square
"y": "${mys + height / ~2}",
"width": "$width",
"height": "$height",
SVG.STROKE: "$stroke",
SVG.FILL: "$fill"
});
} else if (shape == POLYLINE_POINT_SHAPE_CIRCLE_EMPTY) {
int radius = 6;
pointShape = CircleElement();
SVG.setAttr(pointShape, {
"cx": "${mxs}",
"cy": "${mys}",
"r": "$radius",
SVG.STROKE: "$stroke",
SVG.FILL: "$fill"
});
}
return pointShape;
}