addPointShapes method

void addPointShapes ()

Adds a list of points to polylineContainer. The list must be given in POLYLINE_POINT_LIST (list of strings): shape,x1,y1,x2,y2,... in the polyline coordinates units. shape defines how the points are drawn, e.g. as a circle. SQUARE_EMPTY, CIRCLE_EMPTY, ...

Implementation

void addPointShapes() {
  // remove existing point shapes
  if (pointShapes != null && pointShapes.isNotEmpty) {
    for (GeometryElement shape in pointShapes) shape.remove();
    pointShapes.clear();
  }

  String markerAttr = attr[PyA.POINT_LIST];
  if (markerAttr == null || markerAttr.isEmpty) return;

  List<String> xyvals = JsonUtils.decodeLS(markerAttr);
  String shape = xyvals.first;
  if (xyvals.length < 4) return;

  for (int i = 2; i < xyvals.length; i += 2) {
    double x = double.parse(xyvals[i]);
    double y = double.parse(xyvals[i + 1]);
    int mxs = xphysToXscreen(x).round();
    int mys = yphysToYscreen(y).round();
    GeometryElement pointShape = createPointShape(mxs, mys, shape);
    pointShapes.add(pointShape);
    polylineContainer.append(pointShape);
  }
  attr[PyA.MARKER_TEXT] = xyvals[1];
}