org.geotools.xsd.Node.getChildren()方法的使用及代码示例

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

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

Node.getChildren介绍

[英]Returns all nodes corresponding child elements.
[中]返回与子元素对应的所有节点。

代码示例

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

public Object getProperty(Object object, String property) {
  Node node = (Node) object;
  return node.getChildren(property);
}

代码示例来源: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;
}

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

@SuppressWarnings("unchecked")
private List<String> childNames(Node node) {
  if (null == node) {
    return Collections.emptyList();
  }
  List<Node> children = node.getChildren();
  List<String> names = new ArrayList<String>(children.size());
  for (Node child : children) {
    InstanceComponent component = child.getComponent();
    String paramValue = component.getName();
    names.add(paramValue);
  }
  return names;
}

代码示例来源: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

@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 {
  List ops = new ArrayList();
  for (Iterator i = node.getChildren().iterator(); i.hasNext(); ) {
    Node child = (Node) i.next();
    ops.add(factory.spatialOperator(child.getComponent().getName(), null));
  }
  return factory.spatialOperators(
      (SpatialOperator[]) ops.toArray(new SpatialOperator[ops.size()]));
}

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

/**
   * Construct a line string from CurveMembers coordinates.
   *
   * @param node
   * @return
   */
  public static CoordinateList extractCurveMemberCoordinates(Node node) {
    List curveMembers = node.getChildren("curveMember");
    CoordinateList clist = new CoordinateList();
    for (int i = 0; i < curveMembers.size(); i++) {
      List curves = ((Node) curveMembers.get(i)).getChildren(MultiLineString.class);
      for (int j = 0; j < curves.size(); j++) {
        MultiLineString mls = (MultiLineString) ((Node) curves.get(j)).getValue();
        clist.add(mls.getCoordinates(), false);
      }
    }
    return clist;
  }
}

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

/**
 *
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 *
 * @generated modifiable
 */
public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  List sections = node.getChildren("Section");
  if (null != sections) {
    for (Iterator iterator = sections.iterator(); iterator.hasNext(); ) {
      Node child = (Node) iterator.next();
      child.setValue(Section.get((String) child.getValue()));
    }
  }
  return super.parse(instance, node, value);
}

代码示例来源: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 {

    TileMatrixSetLimitsType limits = factory.createTileMatrixSetLimitsType();

    @SuppressWarnings("unchecked")
    List<Node> children = node.getChildren("TileMatrixLimits");
    for (Node c : children) {
      limits.getTileMatrixLimits().add((TileMatrixLimitsType) c.getValue());
    }
    return limits;
  }
}

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

@Override
public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  List children = node.getChildren("curveMember");
  List<LineString> components = new ArrayList<>();
  for (Iterator it = children.iterator(); it.hasNext(); ) {
    Node child = (Node) it.next();
    if (child.getValue() instanceof LineString) {
      LineString ls = (LineString) child.getValue();
      components.add(ls);
    }
  }
  if (components.isEmpty()) {
    return gFactory.createLineString(new Coordinate[0]);
  } else {
    CoordinateSequence cs = components.get(0).getCoordinateSequence();
    CurvedGeometryFactory factory =
        GML3ParsingUtils.getCurvedGeometryFactory(arcParameters, gFactory, cs);
    return factory.createCurvedGeometry(components);
  }
}

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

/**
 *
 * <!-- begin-user-doc -->
 * Returns a coordinate sequence with a single coordinate in it.
 * <!-- end-user-doc -->
 *
 * @generated modifiable
 */
public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  double x = ((BigDecimal) node.getChild("X").getValue()).doubleValue();
  double y = Double.NaN;
  double z = Double.NaN;
  if (!node.getChildren("Y").isEmpty()) {
    y = ((BigDecimal) node.getChild("Y").getValue()).doubleValue();
  }
  if (!node.getChildren("Z").isEmpty()) {
    z = ((BigDecimal) node.getChild("Z").getValue()).doubleValue();
  }
  return new Coordinate(x, y, z);
}

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

/**
   *
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @generated modifiable
   */
  @SuppressWarnings("unchecked")
  public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
    ContentsType contents = factory.createContentsType();

    List<Node> children = node.getChildren("Layer");
    for (Node c : children) {
      contents.getDatasetDescriptionSummary().add(c.getValue());
    }

    List<Node> children1 = node.getChildren("TileMatrixSet");
    for (Node c : children1) {
      contents.getTileMatrixSet().add((TileMatrixSetType) c.getValue());
    }

    List<Node> children2 = node.getChildren(MetadataType.class);
    for (Node c : children2) {
      contents.getOtherSource().add(c.getValue());
    }
    return contents;
  }
}

代码示例来源: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: geotools/geotools

/**
 *
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 *
 * @generated modifiable
 */
public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  ArrayList list = new ArrayList();
  List children = node.getChildren();
  for (int i = 0; i < children.size(); i++) {
    list.add(((Node) children.get(i)).getValue());
  }
  return list;
}

代码示例来源: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

@Override
  public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
    for (Node n : ((List<Node>) node.getChildren())) {
      if (n.getValue() instanceof Text) {
        sb.append(((Text) n.getValue()).getValue());
      } else {
        sb.append("'").append(n.getValue()).append("'");
      }
    }
    return value;
  }
}

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

@SuppressWarnings("unchecked")
@Override
public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  Ows10Factory ows10Factory = Ows10Factory.eINSTANCE;
  DCPType dcpType = ows10Factory.createDCPType();
  HTTPType httpType = ows10Factory.createHTTPType();
  dcpType.setHTTP(httpType);
  List<Node> httpChildren = node.getChildren("HTTP");
  for (Node http : httpChildren) {
    Node get = http.getChild("Get");
    if (get != null) {
      RequestMethodType methodType = createRequestMethodType(ows10Factory, get);
      httpType.getGet().add(methodType);
    }
    Node post = http.getChild("Post");
    if (post != null) {
      RequestMethodType methodType = createRequestMethodType(ows10Factory, post);
      httpType.getPost().add(methodType);
    }
  }
  return dcpType;
}

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

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

    NormalizeContrastMethodStrategy ret = new NormalizeContrastMethodStrategy();
    if (node.getChildValue("Algorithm") != null) {
      Expression algor = (Expression) node.getChildValue("Algorithm");
      ret.setAlgorithm(algor);
    }
    List<Node> params = node.getChildren("Parameter");
    for (Node param : params) {
      String key = (String) param.getAttributeValue("name");
      ret.addParameter(key, (Expression) param.getValue());
    }
    return ret;
  }
}

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

/**
   *
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @generated modifiable
   */
  public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
    AbstractContrastMethodStrategy ret = new HistogramContrastMethodStrategy();
    if (node.getChildValue("Algorithm") != null) {
      Expression algor = (Expression) node.getChildValue("Algorithm");
      ret.setAlgorithm(algor);
    }
    List<Node> params = node.getChildren("Parameter");
    for (Node param : params) {
      String key = (String) param.getAttributeValue("name");
      ret.addParameter(key, (Expression) param.getValue());
    }
    return ret;
  }
}

相关文章