org.geotools.xsd.Node类的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(12.0k)|赞(0)|评价(0)|浏览(93)

本文整理了Java中org.geotools.xsd.Node类的一些代码示例,展示了Node类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node类的具体详情如下:
包路径:org.geotools.xsd.Node
类名称:Node

Node介绍

[英]Represents a value in the parse tree. A node has a corresponds to a particular instance component of a document (element or attribute). Each node contains a parsed value, as well as a reference to the instance.
[中]表示解析树中的值。节点具有与文档(元素或属性)的特定实例组件相对应的。每个节点都包含一个解析的值,以及对实例的引用。

代码示例

代码示例来源:origin: geotools/geotools

/**
 *
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 *
 * @generated modifiable
 */
public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  // &lt;xsd:element ref="ogc:Simple_Arithmetic"/&gt;
  boolean simpleArithmetic =
      node.hasChild("Simple_Arithmetic") || node.hasChild("SimpleArithmetic"); // 1.1
  // &lt;xsd:element name="Functions" type="ogc:FunctionsType"/&gt;
  Functions functions = (Functions) node.getChildValue(Functions.class);
  return factory.arithmeticOperators(simpleArithmetic, functions);
}

代码示例来源:origin: geoserver/geoserver

/**
   *
   * <!-- begin-user-doc -->
   *
   * @param value an instance of {@link GetCapabilitiesType} (possibly a subclass) if a binding
   *     for a specific service's GetCapabilities request used {@link Binding#BEFORE} {@link
   *     #getExecutionMode() execution mode}, and thus relies on this binding to fill the common
   *     properties. <code>null</code> otherwise.
   *     <!-- end-user-doc -->
   * @generated modifiable
   */
  public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
    GetCapabilitiesType getCapabilities;

    if ((value != null) && value instanceof GetCapabilitiesType) {
      getCapabilities = (GetCapabilitiesType) value;
    } else {
      getCapabilities = owsfactory.createGetCapabilitiesType();
    }

    getCapabilities.setAcceptVersions(
        (AcceptVersionsType) node.getChildValue(AcceptVersionsType.class));
    getCapabilities.setSections((SectionsType) node.getChildValue(SectionsType.class));
    getCapabilities.setAcceptFormats(
        (AcceptFormatsType) node.getChildValue(AcceptFormatsType.class));
    getCapabilities.setUpdateSequence((String) node.getAttributeValue("updateSequence"));

    return getCapabilities;
  }
}

代码示例来源:origin: geotools/geotools

/**
 *
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 *
 * @generated modifiable
 */
public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  Expression[] args = new Expression[node.getChildren().size()];
  for (int i = 0; i < node.getChildren().size(); i++) {
    Node child = (Node) node.getChildren().get(i);
    args[i] = (Expression) child.getValue();
  }
  String name = (String) node.getAttribute("name").getValue();
  return factory.function(name, args);
}

代码示例来源:origin: geotools/geotools

PropertyName propertyName = (PropertyName) node.getChildValue(PropertyName.class);
Envelope box = (Envelope) node.getChildValue(Envelope.class);
  Node srsNode = node.getChild(Envelope.class).getAttribute("srsName");
  String srs = (srsNode != null) ? srsNode.getValue().toString() : null;

代码示例来源:origin: geotools/geotools

RectifiedGridType grid = Gml4wcsFactory.eINSTANCE.createRectifiedGridType();
if (node.hasAttribute("srsName")) {
  grid.setSrsName(node.getAttributeValue("srsName").toString());
grid.setDimension((BigInteger) node.getAttribute("dimension").getValue());
GeneralGridEnvelope limitsEnvelope = (GeneralGridEnvelope) node.getChildValue("limits");
        (int) limitsEnvelope.getHigh(0), (int) limitsEnvelope.getHigh(1)));
List<Node> axisNames = node.getChildren("axisName");
if (axisNames != null && !axisNames.isEmpty()) {
  for (Node axisName : axisNames) {
    grid.getAxisName().add(axisName.getValue());

代码示例来源:origin: geotools/geotools

/**
 *
 * <!-- begin-user-doc -->
 * Surprised we actually have something to do: namely collapse multiple fid filters using AND
 * <!-- end-user-doc -->
 *
 * @generated modifiable
 */
public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  if (node.hasChild("FeatureId")) {
    // round up into a featureId filter
    HashSet fids = new HashSet();
    fids.addAll(node.getChildValues("FeatureId"));
    return factory.id(fids);
  }
  return node.getChildValue(Filter.class);
}

代码示例来源:origin: geotools/geotools

/**
   *
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @generated modifiable
   */
  public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
    Expression e1 = (Expression) node.getChildValue(0);
    Expression e2 = (Expression) node.getChildValue(1);

    // &lt;xsd:attribute default="true" name="matchCase" type="xsd:boolean" use="optional"/&gt;
    Boolean matchCase = Boolean.TRUE;

    if (node.hasAttribute("matchCase")) {
      matchCase = (Boolean) node.getAttributeValue("matchCase");
    }

    return filterfactory.equal(e1, e2, matchCase.booleanValue());
  }
}

代码示例来源:origin: geotools/geotools

expressions[1] = (Expression) node.getChildValue("NumericValue");
expressions[0] = filterFactory.literal(node.getChildValue("Pattern"));
if (node.hasChild("NegativePattern")) {
  expressions[2] = filterFactory.literal(node.getChildValue("NegativePattern"));
} else {
  expressions[2] = filterFactory.literal("-");
if (node.hasAttribute("decimalPoint")) {
  expressions[3] = filterFactory.literal(node.getAttributeValue("decimalPoint"));
} else {
  expressions[3] = filterFactory.literal(".");
if (node.hasAttribute("groupingSeparator")) {
  expressions[4] = filterFactory.literal(node.getAttributeValue("groupingSeparator"));
} else {
  expressions[4] = filterFactory.literal(",");

代码示例来源:origin: geotools/geotools

/**
 *
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 *
 * @generated modifiable
 */
public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  UpdateElementType updateElement = wfsfactory.createUpdateElementType();
  // &lt;xsd:element maxOccurs="unbounded" ref="wfs:Property"&gt;
  updateElement.getProperty().addAll(node.getChildValues(PropertyType.class));
  // &lt;xsd:element maxOccurs="1" minOccurs="0" ref="ogc:Filter"&gt;
  updateElement.setFilter((Filter) node.getChildValue(Filter.class));
  // &lt;xsd:attribute name="handle" type="xsd:string" use="optional"&gt;
  if (node.hasAttribute("handle")) {
    updateElement.setHandle((String) node.getAttributeValue("handle"));
  }
  // &lt;xsd:attribute name="typeName" type="xsd:QName" use="required"&gt;
  updateElement.setTypeName((QName) node.getAttributeValue("typeName"));
  // &lt;xsd:attribute default="x-application/gml:3" name="inputFormat"
  //      type="xsd:string" use="optional"&gt;
  if (node.hasAttribute("inputFormat")) {
    updateElement.setInputFormat((String) node.getAttributeValue("inputFormat"));
  }
  // &lt;xsd:attribute name="srsName" type="xsd:anyURI" use="optional"&gt;
  if (node.hasAttribute("srsName")) {
    updateElement.setSrsName((URI) node.getAttributeValue("srsName"));
  }
  return updateElement;
}

代码示例来源:origin: geotools/geotools

public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  ComplexDataType data = factory.createComplexDataType();
  if (node.hasAttribute("schema")) {
    data.setSchema(node.getAttributeValue("schema").toString());
  }
  if (node.hasAttribute("mimeType")) {
    data.setMimeType(node.getAttributeValue("mimeType").toString());
  }
  if (node.hasAttribute("encoding")) {
    data.setEncoding(node.getAttributeValue("encoding").toString());
  }
  for (Iterator i = node.getChildren().iterator(); i.hasNext(); ) {
    Node c = (Node) i.next();
    data.getData().add(c.getValue());
  }
  return data;
}

代码示例来源:origin: geotools/geotools

/**
   *
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @generated modifiable
   */
  public Object parse(ElementInstance instance, Node node, Object value) throws Exception {

    Expression[] operands = OGCUtils.spatial(node, filterFactory, geometryFactory);
    double distance = ((Double) node.getChildValue(Double.class)).doubleValue();
    Object units = node.getChild("Distance").getAttributeValue("units");
    return filterFactory.beyond(
        operands[0], operands[1], distance, units == null ? null : units.toString());
  }
}

代码示例来源:origin: geotools/geotools

@SuppressWarnings("unchecked")
private void addDCPTypes(Node node, OperationType operationType) {
  List<Node> dcpNodes = node.getChildren(DCPType.class);
  for (Node dcpNode : dcpNodes) {
    DCPType dcp = (DCPType) dcpNode.getValue();
    operationType.getDCP().add(dcp);
  }
}

代码示例来源:origin: geotools/geotools

/**
 *
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 *
 * @generated modifiable
 */
public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  return node.getChildValue(SimpleFeature.class);
  // TODO: xlink and remoteSchema attributes, hard to do because of streaming
}

代码示例来源:origin: geotools/geotools

/**
 *
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 *
 * @generated modifiable
 */
public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  Envelope envelope = (Envelope) node.getChildValue("envelope");
  String body = (String) node.getChildValue("body");
  BigInteger id = (BigInteger) node.getAttributeValue("id");
  List atts = node.getChildValues("attachment");
  Attachment[] attachments = (Attachment[]) atts.toArray(new Attachment[atts.size()]);
  return new Mail(id, body, envelope, attachments);
}

代码示例来源:origin: geotools/geotools

/** Helper method for settings properties of an eobject. */
void setProperties(EObject eObject, Node node, boolean lax) {
  // reflectivley set the properties of it
  for (Iterator c = node.getChildren().iterator(); c.hasNext(); ) {
    Node child = (Node) c.next();
    String property = child.getComponent().getName();
    setProperty(eObject, property, child.getValue(), lax);
  }
  for (Iterator a = node.getAttributes().iterator(); a.hasNext(); ) {
    Node att = (Node) a.next();
    String property = att.getComponent().getName();
    setProperty(eObject, property, att.getValue(), lax);
  }
}

代码示例来源:origin: geoserver/geoserver

/**
   *
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @generated modifiable
   */
  public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
    AcceptFormatsType acceptFormats = owsfactory.createAcceptFormatsType();
    acceptFormats.getOutputFormat().addAll(node.getChildValues("OutputFormat"));

    return acceptFormats;
  }
}

代码示例来源:origin: geotools/geotools

/**
 *
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 *
 * @generated modifiable
 */
public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  LinearRing shell = (LinearRing) node.getChild("outerBoundaryIs").getValue();
  List innerRings = node.getChildren("innerBoundaryIs");
  LinearRing[] holes = new LinearRing[innerRings.size()];
  for (int i = 0; i < innerRings.size(); i++) {
    Node inode = (Node) innerRings.get(i);
    holes[i] = (LinearRing) inode.getValue();
  }
  return gFactory.createPolygon(shell, holes);
}

代码示例来源:origin: geotools/geotools

/**
   *
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @generated modifiable
   */
  public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
    List l = node.getChildValues(Symbolizer.class);
    Symbolizer[] syms = (Symbolizer[]) l.toArray(new Symbolizer[l.size()]);

    FeatureTypeStyle style = sb.createFeatureTypeStyle(syms, 1.0, 1.0);

    // if the style has an id, throw it in to the style cache
    if (node.hasAttribute("id")) {
      String id = (String) node.getAttributeValue("id");

      // create a uri with just a fragment
      URI uri = new URI("#" + id);

      styleMap.put(uri, style);
    }

    return style;
  }
}

代码示例来源:origin: geotools/geotools

/**
 *
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 *
 * @generated modifiable
 */
public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  // &lt;xsd:attribute ref="gml:id" use="required"/&gt;
  return filterfactory.gmlObjectId((String) node.getAttributeValue("id"));
}

代码示例来源:origin: geotools/geotools

public String[] getPropertyNames(Object object) {
  Node node = (Node) object;
  List children = node.getChildren();
  if ((children == null) || children.isEmpty()) {
    return new String[] {};
  }
  String[] propertyNames = new String[children.size()];
  for (int i = 0; i < children.size(); i++) {
    Node child = (Node) children.get(i);
    propertyNames[i] = child.getComponent().getName();
  }
  return propertyNames;
}

相关文章