예제 #1
0
  /**
   *
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @generated modifiable
   */
  public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
    Expression color = null;
    Expression opacity = null;
    Graphic graphicFill = null;

    graphicFill = (Graphic) node.getChildValue("GraphicFill");

    // &quot;fill&quot; (color)
    // &quot;fill-opacity&quot;
    List params = node.getChildValues(CssParameter.class);

    for (Iterator itr = params.iterator(); itr.hasNext(); ) {
      CssParameter param = (CssParameter) itr.next();

      if ("fill".equals(param.getName())) {
        color = param.getExpression();
      }

      if ("fill-opacity".equals(param.getName())) {
        opacity = param.getExpression();
      }
    }

    Fill fill = styleFactory.createFill(color);

    if (opacity != null) {
      fill.setOpacity(opacity);
    }

    return fill;
  }
예제 #2
0
  public static List<Filter> BinaryLogicOperator_getChildFilters(
      Node node, org.opengis.filter.FilterFactory factory) {
    List<Filter> filters = node.getChildValues(Filter.class);
    if (filters.size() < 2) {
      // look for Id elements and turn them into fid filters
      // note: this is not spec compliant and is a bit lax
      List<Identifier> ids = node.getChildValues(Identifier.class);
      for (Identifier id : ids) {
        filters.add(factory.id(Collections.singleton(id)));
      }

      // look for extended operator(s)
      filters.addAll(parseExtendedOperators(node, factory));
    }

    // TODO: this parsing returns teh children out of order...
    return filters;
  }
  /**
   *
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @generated modifiable
   */
  public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
    DescribeFeatureTypeType describeFeatureType = wfsfactory.createDescribeFeatureTypeType();

    WFSBindingUtils.service(describeFeatureType, node);
    WFSBindingUtils.version(describeFeatureType, node);
    WFSBindingUtils.outputFormat(describeFeatureType, node, "XMLSCHEMA");

    describeFeatureType.getTypeName().addAll(node.getChildValues(QName.class));

    return describeFeatureType;
  }
  /**
   *
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @generated modifiable
   */
  public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
    TextSymbolizer ts = styleFactory.createTextSymbolizer();

    // &lt;xsd:element ref="sld:Geometry" minOccurs="0"/&gt;
    if (node.hasChild("Geometry")) {
      Expression geometry = (Expression) node.getChildValue("Geometry");
      if (geometry instanceof PropertyName) {
        PropertyName propertyName = (PropertyName) geometry;
        ts.setGeometryPropertyName(propertyName.getPropertyName());
      } else {
        ts.setGeometry(geometry);
      }
    }

    // &lt;xsd:element ref="sld:Label" minOccurs="0"/&gt;
    if (node.hasChild("Label")) {
      ts.setLabel((Expression) node.getChildValue("Label"));
    }

    // &lt;xsd:element ref="sld:Font" minOccurs="0"/&gt;
    if (node.hasChild("Font")) {
      ts.setFonts(new Font[] {(Font) node.getChildValue("Font")});
    }

    // &lt;xsd:element ref="sld:LabelPlacement" minOccurs="0"/&gt;
    if (node.hasChild("LabelPlacement")) {
      ts.setPlacement((LabelPlacement) node.getChildValue("LabelPlacement"));
    }

    // &lt;xsd:element ref="sld:Halo" minOccurs="0"/&gt;
    if (node.hasChild("Halo")) {
      ts.setHalo((Halo) node.getChildValue("Halo"));
    }

    // &lt;xsd:element ref="sld:Fill" minOccurs="0"/&gt;
    if (node.hasChild("Fill")) {
      ts.setFill((Fill) node.getChildValue("Fill"));
    }

    if (node.hasChild("Priority")) {
      ts.setPriority((Expression) node.getChildValue("Priority"));
    }

    // &lt;xsd:element ref="sld:VendorOption" minOccurs="0" maxOccurs="unbounded"/&gt;
    for (CssParameter param : (List<CssParameter>) node.getChildValues(CssParameter.class)) {
      ts.getOptions().put(param.getName(), param.getExpression().evaluate(null, String.class));
    }
    return ts;
  }
  /**
   *
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @generated modifiable
   */
  public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
    CoordinateReferenceSystem crs = GML3ParsingUtils.crs(node);

    if (node.getChild("lowerCorner") != null) {
      DirectPosition l = (DirectPosition) node.getChildValue("lowerCorner");
      DirectPosition u = (DirectPosition) node.getChildValue("upperCorner");

      return new ReferencedEnvelope(
          l.getOrdinate(0), u.getOrdinate(0), l.getOrdinate(1), u.getOrdinate(1), crs);
    }

    if (node.hasChild(Coordinate.class)) {
      List c = node.getChildValues(Coordinate.class);
      Coordinate c1 = (Coordinate) c.get(0);
      Coordinate c2 = (Coordinate) c.get(1);

      return new ReferencedEnvelope(c1.x, c2.x, c1.y, c2.y, crs);
    }

    if (node.hasChild(DirectPosition.class)) {
      List dp = node.getChildValues(DirectPosition.class);
      DirectPosition dp1 = (DirectPosition) dp.get(0);
      DirectPosition dp2 = (DirectPosition) dp.get(1);

      return new ReferencedEnvelope(
          dp1.getOrdinate(0), dp2.getOrdinate(0), dp1.getOrdinate(1), dp2.getOrdinate(1), crs);
    }

    if (node.hasChild(CoordinateSequence.class)) {
      CoordinateSequence seq = (CoordinateSequence) node.getChildValue(CoordinateSequence.class);

      return new ReferencedEnvelope(seq.getX(0), seq.getX(1), seq.getY(0), seq.getY(1), crs);
    }

    return null;
  }