Esempio n. 1
0
 /**
  * Check if the given color string can be parsed.
  *
  * @param colorString The color to parse.
  */
 public static boolean canParseColor(final String colorString) {
   try {
     return ColorParser.toColor(colorString) != null;
   } catch (Exception exc) {
     return false;
   }
 }
  /** Create the Grid Point style. */
  static Style get(final GridParam params) {
    StyleBuilder builder = new StyleBuilder();

    Symbolizer pointSymbolizer =
        crossSymbolizer("shape://plus", builder, CROSS_SIZE, ColorParser.toColor(params.gridColor));
    Symbolizer halo =
        crossSymbolizer(
            "cross",
            builder,
            CROSS_SIZE + params.haloRadius,
            ColorParser.toColor(params.haloColor));
    final Style style = builder.createStyle(pointSymbolizer);
    final List<Symbolizer> symbolizers =
        style.featureTypeStyles().get(0).rules().get(0).symbolizers();
    symbolizers.add(0, halo);

    return style;
  }