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

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

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

Node.getAttribute介绍

[英]Returns the node corresponding to the attribute which has a parsed value which is an instance of clazz. In the event that the node contains multple attributes matching the above criteria, the first encountered is returned, with no guaratnee of order. For all nodes matching this criteria use #getAttributes(Class).
[中]返回与属性对应的节点,该属性的解析值是clazz的实例。如果节点包含与上述条件匹配的多个属性,则返回第一个遇到的属性,而不保证顺序。对于符合此条件的所有节点,请使用#getAttributes(类)。

代码示例

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

public static CoordinateReferenceSystem crs(Node node) {
  if (node.getAttribute("srsName") != null) {
    URI srs = null;
    Object raw = node.getAttributeValue("srsName");

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

String ts = " ";
if (node.getAttribute("decimal") != null) {
  decimal = (String) node.getAttribute("decimal").getValue();
if (node.getAttribute("cs") != null) {
  cs = (String) node.getAttribute("cs").getValue();
if (node.getAttribute("ts") != null) {
  ts = (String) node.getAttribute("ts").getValue();

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

grid.setDimension((BigInteger) node.getAttribute("dimension").getValue());

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

if (interval.getAttribute("atomic") != null)
  range.setAtomic((Boolean) interval.getAttributeValue("atomic"));
else range.setAtomic(false);

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

@Override
  public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
    Node attr = node.getAttribute("method");

    if (null != attr) {
      attr.setValue(MethodType.get((String) attr.getValue()));
    }

    return super.parse(instance, node, value);
  }
}

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

public Object parse(ElementInstance instance, Node node, Object value) throws Exception {

    ElementSetNameType result = (ElementSetNameType) createEObject(value);
    result.setValue(ElementSetType.get((String) value));
    Node typeNames = node.getAttribute("typeNames");
    if (typeNames != null) {
      result.setTypeNames((List<QName>) typeNames.getValue());
    }

    return result;
  }
}

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

@Override
public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
  SimpleLiteral sl = Csw20Factory.eINSTANCE.createSimpleLiteral();
  sl.setName(instance.getName());
  sl.setValue(value);
  Node scheme = node.getAttribute("scheme");
  if (scheme != null) {
    sl.setScheme((URI) scheme.getValue());
  }
  return sl;
}

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

/**
 * Returns the number of dimensions for the specified node, eventually recursing up to find the
 * parent node that has the indication of the dimensions (normally the top-most geometry element
 * has it, not the posList). If no srsDimension can be found, check the srsName the same way and
 * return the srsDimensions instead. Returns 2 if no srsDimension or srsName attribute could be
 * found.
 *
 * @param node
 * @return
 */
public static int dimensions(Node node) {
  Node current = node;
  while (current != null) {
    Node dimensions = current.getAttribute("srsDimension");
    if (dimensions != null) {
      return ((Number) dimensions.getValue()).intValue();
    }
    current = current.getParent();
  }
  current = node;
  while (current != null) {
    CoordinateReferenceSystem crs = crs(current);
    if (crs != null) {
      return crs.getCoordinateSystem().getDimension();
    }
    current = current.getParent();
  }
  return 2;
}

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

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

相关文章