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

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

本文整理了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

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

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

  1. public String[] getPropertyNames(Object object) {
  2. Node node = (Node) object;
  3. List children = node.getChildren();
  4. if ((children == null) || children.isEmpty()) {
  5. return new String[] {};
  6. }
  7. String[] propertyNames = new String[children.size()];
  8. for (int i = 0; i < children.size(); i++) {
  9. Node child = (Node) children.get(i);
  10. propertyNames[i] = child.getComponent().getName();
  11. }
  12. return propertyNames;
  13. }

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

  1. @SuppressWarnings("unchecked")
  2. private List<String> childNames(Node node) {
  3. if (null == node) {
  4. return Collections.emptyList();
  5. }
  6. List<Node> children = node.getChildren();
  7. List<String> names = new ArrayList<String>(children.size());
  8. for (Node child : children) {
  9. InstanceComponent component = child.getComponent();
  10. String paramValue = component.getName();
  11. names.add(paramValue);
  12. }
  13. return names;
  14. }

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

  1. /**
  2. *
  3. * <!-- begin-user-doc -->
  4. * <!-- end-user-doc -->
  5. *
  6. * @generated modifiable
  7. */
  8. public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  9. Expression[] args = new Expression[node.getChildren().size()];
  10. for (int i = 0; i < node.getChildren().size(); i++) {
  11. Node child = (Node) node.getChildren().get(i);
  12. args[i] = (Expression) child.getValue();
  13. }
  14. String name = (String) node.getAttribute("name").getValue();
  15. return factory.function(name, args);
  16. }

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

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

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

  1. /**
  2. *
  3. * <!-- begin-user-doc -->
  4. * <!-- end-user-doc -->
  5. *
  6. * @generated modifiable
  7. */
  8. public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  9. List ops = new ArrayList();
  10. for (Iterator i = node.getChildren().iterator(); i.hasNext(); ) {
  11. Node child = (Node) i.next();
  12. ops.add(factory.spatialOperator(child.getComponent().getName(), null));
  13. }
  14. return factory.spatialOperators(
  15. (SpatialOperator[]) ops.toArray(new SpatialOperator[ops.size()]));
  16. }

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

  1. /**
  2. * Construct a line string from CurveMembers coordinates.
  3. *
  4. * @param node
  5. * @return
  6. */
  7. public static CoordinateList extractCurveMemberCoordinates(Node node) {
  8. List curveMembers = node.getChildren("curveMember");
  9. CoordinateList clist = new CoordinateList();
  10. for (int i = 0; i < curveMembers.size(); i++) {
  11. List curves = ((Node) curveMembers.get(i)).getChildren(MultiLineString.class);
  12. for (int j = 0; j < curves.size(); j++) {
  13. MultiLineString mls = (MultiLineString) ((Node) curves.get(j)).getValue();
  14. clist.add(mls.getCoordinates(), false);
  15. }
  16. }
  17. return clist;
  18. }
  19. }

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

  1. /**
  2. *
  3. * <!-- begin-user-doc -->
  4. * <!-- end-user-doc -->
  5. *
  6. * @generated modifiable
  7. */
  8. public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  9. List sections = node.getChildren("Section");
  10. if (null != sections) {
  11. for (Iterator iterator = sections.iterator(); iterator.hasNext(); ) {
  12. Node child = (Node) iterator.next();
  13. child.setValue(Section.get((String) child.getValue()));
  14. }
  15. }
  16. return super.parse(instance, node, value);
  17. }

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

  1. /**
  2. *
  3. * <!-- begin-user-doc -->
  4. * <!-- end-user-doc -->
  5. *
  6. * @generated modifiable
  7. */
  8. public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  9. LinearRing shell = (LinearRing) node.getChild("outerBoundaryIs").getValue();
  10. List innerRings = node.getChildren("innerBoundaryIs");
  11. LinearRing[] holes = new LinearRing[innerRings.size()];
  12. for (int i = 0; i < innerRings.size(); i++) {
  13. Node inode = (Node) innerRings.get(i);
  14. holes[i] = (LinearRing) inode.getValue();
  15. }
  16. return gFactory.createPolygon(shell, holes);
  17. }

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

  1. /**
  2. *
  3. * <!-- begin-user-doc -->
  4. * <!-- end-user-doc -->
  5. *
  6. * @generated modifiable
  7. */
  8. public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  9. TileMatrixSetLimitsType limits = factory.createTileMatrixSetLimitsType();
  10. @SuppressWarnings("unchecked")
  11. List<Node> children = node.getChildren("TileMatrixLimits");
  12. for (Node c : children) {
  13. limits.getTileMatrixLimits().add((TileMatrixLimitsType) c.getValue());
  14. }
  15. return limits;
  16. }
  17. }

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

  1. @Override
  2. public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  3. List children = node.getChildren("curveMember");
  4. List<LineString> components = new ArrayList<>();
  5. for (Iterator it = children.iterator(); it.hasNext(); ) {
  6. Node child = (Node) it.next();
  7. if (child.getValue() instanceof LineString) {
  8. LineString ls = (LineString) child.getValue();
  9. components.add(ls);
  10. }
  11. }
  12. if (components.isEmpty()) {
  13. return gFactory.createLineString(new Coordinate[0]);
  14. } else {
  15. CoordinateSequence cs = components.get(0).getCoordinateSequence();
  16. CurvedGeometryFactory factory =
  17. GML3ParsingUtils.getCurvedGeometryFactory(arcParameters, gFactory, cs);
  18. return factory.createCurvedGeometry(components);
  19. }
  20. }

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

  1. /**
  2. *
  3. * <!-- begin-user-doc -->
  4. * Returns a coordinate sequence with a single coordinate in it.
  5. * <!-- end-user-doc -->
  6. *
  7. * @generated modifiable
  8. */
  9. public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  10. double x = ((BigDecimal) node.getChild("X").getValue()).doubleValue();
  11. double y = Double.NaN;
  12. double z = Double.NaN;
  13. if (!node.getChildren("Y").isEmpty()) {
  14. y = ((BigDecimal) node.getChild("Y").getValue()).doubleValue();
  15. }
  16. if (!node.getChildren("Z").isEmpty()) {
  17. z = ((BigDecimal) node.getChild("Z").getValue()).doubleValue();
  18. }
  19. return new Coordinate(x, y, z);
  20. }

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

  1. /**
  2. *
  3. * <!-- begin-user-doc -->
  4. * <!-- end-user-doc -->
  5. *
  6. * @generated modifiable
  7. */
  8. @SuppressWarnings("unchecked")
  9. public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  10. ContentsType contents = factory.createContentsType();
  11. List<Node> children = node.getChildren("Layer");
  12. for (Node c : children) {
  13. contents.getDatasetDescriptionSummary().add(c.getValue());
  14. }
  15. List<Node> children1 = node.getChildren("TileMatrixSet");
  16. for (Node c : children1) {
  17. contents.getTileMatrixSet().add((TileMatrixSetType) c.getValue());
  18. }
  19. List<Node> children2 = node.getChildren(MetadataType.class);
  20. for (Node c : children2) {
  21. contents.getOtherSource().add(c.getValue());
  22. }
  23. return contents;
  24. }
  25. }

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

  1. /** Helper method for settings properties of an eobject. */
  2. void setProperties(EObject eObject, Node node, boolean lax) {
  3. // reflectivley set the properties of it
  4. for (Iterator c = node.getChildren().iterator(); c.hasNext(); ) {
  5. Node child = (Node) c.next();
  6. String property = child.getComponent().getName();
  7. setProperty(eObject, property, child.getValue(), lax);
  8. }
  9. for (Iterator a = node.getAttributes().iterator(); a.hasNext(); ) {
  10. Node att = (Node) a.next();
  11. String property = att.getComponent().getName();
  12. setProperty(eObject, property, att.getValue(), lax);
  13. }
  14. }

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

  1. /**
  2. *
  3. * <!-- begin-user-doc -->
  4. * <!-- end-user-doc -->
  5. *
  6. * @generated modifiable
  7. */
  8. public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  9. ArrayList list = new ArrayList();
  10. List children = node.getChildren();
  11. for (int i = 0; i < children.size(); i++) {
  12. list.add(((Node) children.get(i)).getValue());
  13. }
  14. return list;
  15. }

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

  1. public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  2. ComplexDataType data = factory.createComplexDataType();
  3. if (node.hasAttribute("schema")) {
  4. data.setSchema(node.getAttributeValue("schema").toString());
  5. }
  6. if (node.hasAttribute("mimeType")) {
  7. data.setMimeType(node.getAttributeValue("mimeType").toString());
  8. }
  9. if (node.hasAttribute("encoding")) {
  10. data.setEncoding(node.getAttributeValue("encoding").toString());
  11. }
  12. for (Iterator i = node.getChildren().iterator(); i.hasNext(); ) {
  13. Node c = (Node) i.next();
  14. data.getData().add(c.getValue());
  15. }
  16. return data;
  17. }

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

  1. @Override
  2. public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  3. for (Node n : ((List<Node>) node.getChildren())) {
  4. if (n.getValue() instanceof Text) {
  5. sb.append(((Text) n.getValue()).getValue());
  6. } else {
  7. sb.append("'").append(n.getValue()).append("'");
  8. }
  9. }
  10. return value;
  11. }
  12. }

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

  1. @SuppressWarnings("unchecked")
  2. @Override
  3. public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  4. Ows10Factory ows10Factory = Ows10Factory.eINSTANCE;
  5. DCPType dcpType = ows10Factory.createDCPType();
  6. HTTPType httpType = ows10Factory.createHTTPType();
  7. dcpType.setHTTP(httpType);
  8. List<Node> httpChildren = node.getChildren("HTTP");
  9. for (Node http : httpChildren) {
  10. Node get = http.getChild("Get");
  11. if (get != null) {
  12. RequestMethodType methodType = createRequestMethodType(ows10Factory, get);
  13. httpType.getGet().add(methodType);
  14. }
  15. Node post = http.getChild("Post");
  16. if (post != null) {
  17. RequestMethodType methodType = createRequestMethodType(ows10Factory, post);
  18. httpType.getPost().add(methodType);
  19. }
  20. }
  21. return dcpType;
  22. }

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

  1. /**
  2. *
  3. * <!-- begin-user-doc -->
  4. * <!-- end-user-doc -->
  5. *
  6. * @generated modifiable
  7. */
  8. public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  9. NormalizeContrastMethodStrategy ret = new NormalizeContrastMethodStrategy();
  10. if (node.getChildValue("Algorithm") != null) {
  11. Expression algor = (Expression) node.getChildValue("Algorithm");
  12. ret.setAlgorithm(algor);
  13. }
  14. List<Node> params = node.getChildren("Parameter");
  15. for (Node param : params) {
  16. String key = (String) param.getAttributeValue("name");
  17. ret.addParameter(key, (Expression) param.getValue());
  18. }
  19. return ret;
  20. }
  21. }

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

  1. /**
  2. *
  3. * <!-- begin-user-doc -->
  4. * <!-- end-user-doc -->
  5. *
  6. * @generated modifiable
  7. */
  8. public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  9. AbstractContrastMethodStrategy ret = new HistogramContrastMethodStrategy();
  10. if (node.getChildValue("Algorithm") != null) {
  11. Expression algor = (Expression) node.getChildValue("Algorithm");
  12. ret.setAlgorithm(algor);
  13. }
  14. List<Node> params = node.getChildren("Parameter");
  15. for (Node param : params) {
  16. String key = (String) param.getAttributeValue("name");
  17. ret.addParameter(key, (Expression) param.getValue());
  18. }
  19. return ret;
  20. }
  21. }

相关文章