makePointStyleBuildFragment function

XmlDocumentFragment makePointStyleBuildFragment(
  1. PointStyle style
)

Implementation

xml.XmlDocumentFragment makePointStyleBuildFragment(PointStyle style) {
  xml.XmlBuilder builder = xml.XmlBuilder();
  builder.namespace(uriSld, SLD_NSP);
  builder.element(POINTSYMBOLIZER, namespace: uriSld, nest: () {
    style.markerName ??= WktMarkers.CIRCLE.name;
    builder.element(GRAPHIC, namespace: uriSld, nest: () {
      // marker size
      builder.element(SIZE, namespace: uriSld, nest: () {
        builder.text(style.markerSize);
      });
      // marker
      builder.element(MARK, namespace: uriSld, nest: () {
        // shape
        builder.element(WELLKNOWNNAME, namespace: uriSld, nest: () {
          builder.text(style.markerName);
        });

        // fill
        builder.element(FILL, namespace: uriSld, nest: () {
          builder.element(CSS_PARAMETER, namespace: uriSld, nest: () {
            builder.attribute(ATTRIBUTE_NAME, ATTRIBUTE_FILL);
            builder.text(style.fillColorHex);
          });
          builder.element(CSS_PARAMETER, namespace: uriSld, nest: () {
            builder.attribute(ATTRIBUTE_NAME, ATTRIBUTE_FILL_OPACITY);
            builder.text(style.fillOpacity);
          });
        });
        // stroke
        builder.element(STROKE, namespace: uriSld, nest: () {
          builder.element(CSS_PARAMETER, namespace: uriSld, nest: () {
            builder.attribute(ATTRIBUTE_NAME, ATTRIBUTE_STROKE);
            builder.text(style.strokeColorHex);
          });
          builder.element(CSS_PARAMETER, namespace: uriSld, nest: () {
            builder.attribute(ATTRIBUTE_NAME, ATTRIBUTE_STROKE_OPACITY);
            builder.text(style.strokeOpacity);
          });
          builder.element(CSS_PARAMETER, namespace: uriSld, nest: () {
            builder.attribute(ATTRIBUTE_NAME, ATTRIBUTE_STROKE_WIDTH);
            builder.text(style.strokeWidth);
          });
        });
      });
    });
  });
  var build = builder.buildFragment();
  return build;
}