code: public static void substituteMark( Rule rule, String wellKnownMarkName ) {
          PointSymbolizer pointSymbolizer = StyleUtilities.pointSymbolizerFromRule(rule);
          Mark oldMark = SLD.mark(pointSymbolizer);
  
          Graphic graphic = SLD.graphic(pointSymbolizer);
          graphic.graphicalSymbols().clear();
  
          Mark mark = StyleUtilities.sf.createMark();
          mark.setWellKnownName(StyleUtilities.ff.literal(wellKnownMarkName));
          if (oldMark != null) {
              mark.setFill(oldMark.getFill());
              mark.setStroke(oldMark.getStroke());
          }
          graphic.graphicalSymbols().add(mark);
      }
docs: Change the mark shape in a rule.
  
  @param rule the rule of which the mark has to be changed.
  @param wellKnownMarkName the name of the new mark.