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

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

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

Node.getChild介绍

[英]Returns a node corresponding to a child element which has a parsed value which is an instance of clazz. This method returns the first such node it finds and no order is guarenteed, it is providedd for convenience. This method returns null if it finds no such child mathing the above criteria.
[中]返回与子元素对应的节点,该子元素的解析值是clazz的实例。这个方法返回它找到的第一个这样的节点,并且不保证顺序,它是为了方便而提供的。此方法返回null if it finds no such child mathing the above criteria.

代码示例

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

/**
 *
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 *
 * @generated modifiable
 */
public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  if (node.getChild("low") != null) {
    int[] l = (int[]) node.getChildValue("low");
    int[] h = (int[]) node.getChildValue("high");
    GridEnvelope envelope = new GeneralGridEnvelope(l, h, true);
    return envelope;
  }
  return null;
}

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

rotation);
if (node.getChild("Displacement") != null) {
  graphic.setDisplacement((Displacement) node.getChildValue("Displacement"));
if (node.getChild("AnchorPoint") != null) {
  graphic.setAnchorPoint((AnchorPoint) node.getChildValue("AnchorPoint"));

代码示例来源: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
 */
public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  if (node.getChild("coord") != null) {
    Coordinate c = (Coordinate) node.getChild("coord").getValue();
    return gFactory.createPoint(c);
  }
  if (node.getChild("coordinates") != null) {
    CoordinateSequence seq = (CoordinateSequence) node.getChild("coordinates").getValue();
    return gFactory.createPoint(seq);
  }
  throw new RuntimeException("Could not find a coordinate");
}

代码示例来源: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 {
  // do the null check
  if (node.getChild("null") != null) {
    // ignore the description as to why its null
    Envelope e = new Envelope();
    e.setToNull();
    return e;
  }
  // has to be a valid bounding box
  return (Envelope) node.getChildValue(0);
}

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

/**
 *
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 *
 * @generated modifiable
 */
public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  Instant begining = new DefaultInstant((Position) node.getChild("BeginPosition").getValue());
  Instant ending = new DefaultInstant((Position) node.getChild("EndPosition").getValue());
  Period timePeriod = new DefaultPeriod(begining, ending);
  return timePeriod;
}

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

    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

/**
 *
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 *
 * @generated modifiable
 */
public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  Instant begining = new DefaultInstant((Position) node.getChild("beginPosition").getValue());
  Instant ending = new DefaultInstant((Position) node.getChild("endPosition").getValue());
  Period timePeriod = new DefaultPeriod(begining, ending);
  return timePeriod;
}

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

if (node.getChild("coordinates") != null) {
  Node cnode = (Node) node.getChild("coordinates");
  CoordinateSequence lineSeq = (CoordinateSequence) cnode.getValue();

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

/**
   *
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @generated modifiable
   */
  public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
    // TODO: units
    Expression[] operands = OGCUtils.spatial(node, filterFactory, geometryFactory);
    double distance = ((Double) node.getChildValue("Distance")).doubleValue();
    Object units = node.getChild("Distance").getAttributeValue("units");
    return filterFactory.dwithin(
        operands[0], operands[1], distance, units == null ? null : units.toString());
  }
}

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

/**
   *
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @generated modifiable
   */
  public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
    OperationsType om = factory.createOperationsType();
    for (Object ob : OperationType.VALUES) {
      if (node.getChild(((OperationType) ob).getName()) != null) {
        om.getOperation().add(ob);
      }
    }
    return om;
  }
}

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

/**
 *
 * <!-- begin-user-doc -->
 * This method returns an object of type
 *
 * @link org.locationtech.jts.geom.Envelope.
 *     <!-- end-user-doc -->
 * @generated modifiable
 */
public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  List coordinates = node.getChildren("coord");
  if (!coordinates.isEmpty() && (coordinates.size() == 2)) {
    Node n1 = (Node) coordinates.get(0);
    Node n2 = (Node) coordinates.get(1);
    Coordinate c1 = (Coordinate) n1.getValue();
    Coordinate c2 = (Coordinate) n2.getValue();
    return new Envelope(c1.x, c2.x, c1.y, c2.y);
  }
  if (!coordinates.isEmpty()) {
    throw new RuntimeException("Envelope can have only two coordinates");
  }
  if (node.getChild("coordinates") != null) {
    CoordinateSequence cs = (CoordinateSequence) node.getChild("coordinates").getValue();
    if (cs.size() != 2) {
      throw new RuntimeException("Envelope can have only two coordinates");
    }
    return new Envelope(cs.getX(0), cs.getX(1), cs.getY(0), cs.getY(1));
  }
  throw new RuntimeException("Could not find coordinates for envelope");
}

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

/**
   *
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @generated modifiable
   */
  public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
    ContrastEnhancement ce = styleFactory.createContrastEnhancement();

    if (node.getChild("GammaValue") != null) {
      Expression gamma = (Expression) node.getChildValue("GammaValue");
      ce.setGammaValue(gamma);
    }

    if (node.getChild("Normalize") != null) {
      SLDNormalizeBinding binding = new SLDNormalizeBinding(styleFactory, filterFactory);
      Node child = node.getChild("Normalize");
      ce.setMethod(
          (((ContrastMethodStrategy) binding.parse(instance, child, value)).getMethod()));
    } else if (node.getChild("Histogram") != null) {
      SLDHistogramBinding binding = new SLDHistogramBinding();
      Node child = node.getChild("Histogram");
      ce.setMethod(
          (((ContrastMethodStrategy) binding.parse(instance, child, value)).getMethod()));
    }

    return ce;
  }
}

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

@Override
public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  Ows10Factory ows10Factory = Ows10Factory.eINSTANCE;
  OperationsMetadataType om = ows10Factory.createOperationsMetadataType();
  Node request = node.getChild("Request");
  OperationType operation;
  operation = getCapabilities(request.getChild("GetCapabilities"), ows10Factory);
  addOperation(om, operation);
  operation = dft(request.getChild("DescribeFeatureType"), ows10Factory);
  addOperation(om, operation);
  operation = getFeature(request.getChild("GetFeature"), ows10Factory);
  addOperation(om, operation);
  Node nodeOp = request.getChild("Transaction");
  if (nodeOp != null) {
    operation = createOperation("Transaction", nodeOp, ows10Factory);
    addOperation(om, operation);
  }
  nodeOp = request.getChild("LockFeature");
  if (nodeOp != null) {
    operation = createOperation("LockFeature", nodeOp, ows10Factory);
    addOperation(om, operation);
  }
  nodeOp = request.getChild("GetFeatureWithLock");
  if (nodeOp != null) {
    operation = createOperation("GetFeatureWithLock", nodeOp, ows10Factory);
    addOperation(om, operation);
  }
  return om;
}

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

if (node.getChild("coordinates") != null) {
  Node cnode = (Node) node.getChild("coordinates");
  CoordinateSequence lineSeq = (CoordinateSequence) cnode.getValue();

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

@SuppressWarnings("unchecked")
private void addParameter(
    Node node,
    Ows10Factory ows10Factory,
    OperationType operationType,
    String parameterName) {
  Node paramParentNode = node.getChild(parameterName);
  List<String> paramValues = childNames(paramParentNode);
  DomainType domain = ows10Factory.createDomainType();
  domain.setName(parameterName);
  for (String paramValue : paramValues) {
    domain.getValue().add(paramValue);
  }
  operationType.getParameter().add(domain);
}

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

Node n = node.getChild(Expression.class);
Name opName = new NameImpl(n.getComponent().getNamespace(), n.getComponent().getName());

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

/**
 *
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 *
 * @generated modifiable
 */
public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  Node attr = node.getChild("containment");
  if (null != attr) {
    attr.setValue(ContainmentType.get((String) attr.getValue()));
  }
  return super.parse(instance, node, value);
}

相关文章