Beispiel #1
0
  @Override
  public JAXBElement<AreaSymbolizerType> getJAXBElement() {
    ObjectFactory of = new ObjectFactory();
    AreaSymbolizerType s = of.createAreaSymbolizerType();

    this.setJAXBProperty(s);

    if (this.getGeometryAttribute() != null) {
      s.setGeometry(getGeometryAttribute().getJAXBGeometryType());
    }

    if (getUom() != null) {
      s.setUom(this.getUom().toURN());
    }

    if (getTranslate() != null) {
      s.setDisplacement(getTranslate().getJAXBType());
    }

    if (this.perpendicularOffset != null) {
      s.setPerpendicularOffset(perpendicularOffset.getJAXBParameterValueType());
    }

    if (fill != null) {
      s.setFill(fill.getJAXBElement());
    }

    if (stroke != null) {
      s.setStroke(stroke.getJAXBElement());
    }

    return of.createAreaSymbolizer(s);
  }
Beispiel #2
0
 @Override
 public void setFill(Fill fill) {
   if (fill != null) {
     fill.setParent(this);
   }
   this.fill = fill;
 }
Beispiel #3
0
  /**
   * Build a new <code>AreaSymbolizer</code>, using a JAXB element to fill its properties.
   *
   * @param st
   * @throws org.orbisgis.coremap.renderer.se.SeExceptions.InvalidStyle
   */
  public AreaSymbolizer(JAXBElement<AreaSymbolizerType> st) throws InvalidStyle {
    super(st);

    AreaSymbolizerType ast = st.getValue();

    if (ast.getGeometry() != null) {
      this.setGeometryAttribute(new GeometryAttribute(ast.getGeometry()));
    }

    if (ast.getUom() != null) {
      setUom(Uom.fromOgcURN(ast.getUom()));
    }

    if (ast.getPerpendicularOffset() != null) {
      this.setPerpendicularOffset(
          SeParameterFactory.createRealParameter(ast.getPerpendicularOffset()));
    }

    if (ast.getDisplacement() != null) {
      this.setTranslate(new Translate(ast.getDisplacement()));
    }

    if (ast.getFill() != null) {
      this.setFill(Fill.createFromJAXBElement(ast.getFill()));
    }

    if (ast.getStroke() != null) {
      this.setStroke(Stroke.createFromJAXBElement(ast.getStroke()));
    }
  }
Beispiel #4
0
  /**
   * Build a new {@code Category} from the given {@code CategoryType}.
   *
   * @param c
   * @throws org.orbisgis.coremap.renderer.se.SeExceptions.InvalidStyle
   */
  public Category(CategoryType c) throws InvalidStyle {
    if (c.getFill() != null) {
      setFill(Fill.createFromJAXBElement(c.getFill()));
    }

    if (c.getGraphic() != null) {
      setGraphicCollection(new GraphicCollection(c.getGraphic(), this));
    }

    if (c.getStroke() != null) {
      setStroke(Stroke.createFromJAXBElement(c.getStroke()));
    }

    if (c.getValue() != null) {
      setMeasure(SeParameterFactory.createRealParameter(c.getValue()));
    }

    if (c.getName() != null) {
      setName(c.getName());
    }
  }
Beispiel #5
0
  /**
   * @param g2
   * @param rs
   * @param fid
   * @throws ParameterException
   * @throws IOException error while accessing external resource
   * @throws java.sql.SQLException
   */
  @Override
  public void draw(
      Graphics2D g2, ResultSet rs, long fid, boolean selected, MapTransform mt, Geometry the_geom)
      throws ParameterException, IOException, SQLException {

    List<Shape> shapes = new LinkedList<Shape>();
    shapes.add(mt.getShape(the_geom, true));
    Map<String, Object> map = getFeaturesMap(rs, fid);
    for (Shape shp : shapes) {
      if (this.getTranslate() != null) {
        shp =
            getTranslate()
                .getAffineTransform(
                    map, getUom(), mt, (double) mt.getWidth(), (double) mt.getHeight())
                .createTransformedShape(shp);
      }
      if (shp != null) {
        if (fill != null) {
          fill.draw(g2, map, shp, selected, mt);
        }

        if (stroke != null) {
          double offset = 0.0;
          if (perpendicularOffset != null) {
            offset =
                Uom.toPixel(
                    perpendicularOffset.getValue(rs, fid),
                    getUom(),
                    mt.getDpi(),
                    mt.getScaleDenominator(),
                    null);
          }
          stroke.draw(g2, map, shp, selected, mt, offset);
        }
      }
    }
  }
Beispiel #6
0
 @Override
 public void setFill(Fill fill) {
   this.fill = fill;
   fill.setParent(this);
 }