Ejemplo n.º 1
0
 @Override
 public LineStyle clone() {
   LineStyle copy;
   copy = ((LineStyle) super.clone());
   copy.lineStyleSimpleExtension = new ArrayList<Object>((getLineStyleSimpleExtension().size()));
   for (Object iter : lineStyleSimpleExtension) {
     copy.lineStyleSimpleExtension.add(iter);
   }
   copy.lineStyleObjectExtension =
       new ArrayList<AbstractObject>((getLineStyleObjectExtension().size()));
   for (AbstractObject iter : lineStyleObjectExtension) {
     copy.lineStyleObjectExtension.add(iter.clone());
   }
   return copy;
 }
    /** Encodes a KML IconStyle + LineStyle from a polygon style and symbolizer. */
    protected void setLineStyle(Style style, SimpleFeature feature, Stroke stroke) {
      LineStyle ls = style.createAndSetLineStyle();

      if (stroke != null) {
        // opacity
        Double opacity = stroke.getOpacity().evaluate(feature, Double.class);
        if (opacity == null || Double.isNaN(opacity)) {
          opacity = 1.0;
        }

        Color color = null;
        Expression sc = stroke.getColor();
        if (sc != null) {
          color = (Color) sc.evaluate(feature, Color.class);
        }
        if (color == null) {
          color = Color.DARK_GRAY;
        }
        ls.setColor(colorToHex(color, opacity));

        // width
        Double width = null;
        Expression sw = stroke.getWidth();
        if (sw != null) {
          width = sw.evaluate(feature, Double.class);
        }
        if (width == null) {
          width = 1d;
        }
        ls.setWidth(width);
      } else {
        // default
        ls.setColor("ffaaaaaa");
        ls.setWidth(1);
      }
    }