当前位置: 首页>>代码示例>>Java>>正文


Java QuantityDocument类代码示例

本文整理汇总了Java中net.opengis.swe.x101.QuantityDocument的典型用法代码示例。如果您正苦于以下问题:Java QuantityDocument类的具体用法?Java QuantityDocument怎么用?Java QuantityDocument使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


QuantityDocument类属于net.opengis.swe.x101包,在下文中一共展示了QuantityDocument类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setNamedCoordinate

import net.opengis.swe.x101.QuantityDocument; //导入依赖的package包/类
private void setNamedCoordinate(double value, String name, VectorType vector) {
    QuantityDocument quantityDoc = QuantityDocument.Factory.newInstance();
    Quantity quantity = quantityDoc.addNewQuantity();
    quantity.setValue(value);

    Coordinate coordiante = vector.addNewCoordinate();
    coordiante.setQuantity(quantity);
    coordiante.setName(name);
}
 
开发者ID:52North,项目名称:SensorWebClient,代码行数:10,代码来源:DescribeSensorParserTest.java

示例2: createQuantity

import net.opengis.swe.x101.QuantityDocument; //导入依赖的package包/类
protected QuantityDocument createQuantity(RuleFilter ruleFilter) {
    QuantityDocument quantityDoc = QuantityDocument.Factory.newInstance();
    Quantity quantity = quantityDoc.addNewQuantity();
    quantity.setValue(Double.parseDouble(ruleFilter.getValue()));
    if (isValidUom(ruleFilter.getUnit())) {
        quantity.addNewUom().setCode(ruleFilter.getUnit());
    }
    return quantityDoc;
}
 
开发者ID:52North,项目名称:SensorWebClient,代码行数:10,代码来源:BasicRule_4_Builder.java

示例3: replaceForExpression

import net.opengis.swe.x101.QuantityDocument; //导入依赖的package包/类
/**
 * helpermethod for replacePhenomenonStringsAndConvertUnits().
 * @throws Exception 
 */
public static void replaceForExpression(XmlObject et) throws Exception {
	QName etQn = et.newCursor().getName();
	if (et instanceof LiteralType) {
		LiteralType lt = (LiteralType) et;

		XmlObject xmlContent = XmlObject.Factory.parse(lt.toString());
		if (xmlContent instanceof QuantityDocument) {
			QuantityDocument sweQ = (QuantityDocument) xmlContent;
			if (sweQ.getQuantity() != null) {
				if (!sweQ.getQuantity().isSetValue()) {
					throw new Exception("There was" +
							" no Value specified in the swe:Quantity element");
				}
				Double value = sweQ.getQuantity().getValue();
				
				UomPropertyType uom = sweQ.getQuantity().getUom();
				String uomCode = "";
				if (uom != null) {
					uomCode = uom.getCode();
				}
				else {
					//no ucum-code, just return without converting
					return;
				}
				
				try {
					NumberWithUOM result = UCUMTools.convert(uomCode, value);
					sweQ.getQuantity().setValue(result.getValue());
					sweQ.getQuantity().getUom().setCode(result.getUom());
					et.set(sweQ);		
				}
				catch (Exception t) {
					logger.warn("Could not convert uom '" + uom.xmlText(new XmlOptions().setSaveOuter()) +
							"' to base unit, reason: " + t.getMessage());
					if (t instanceof RuntimeException) throw (RuntimeException) t;
					throw new RuntimeException(t);
				}

			}
		}
	
	} 

	else if (VALUE_REFERENCE_QNAME.equals(etQn)) {
		String urn = XmlUtil.stripText(et);
		urn = urn.replaceAll(":", "__").replaceAll("\\.", "_");
		XmlUtil.setTextContent(et, urn);
	}

}
 
开发者ID:52North,项目名称:epos,代码行数:55,代码来源:EMLHelper.java

示例4: replaceForExpression

import net.opengis.swe.x101.QuantityDocument; //导入依赖的package包/类
/**
 * helpermethod for replacePhenomenonStringsAndConvertUnits().
 * @throws Exception 
 */
public static void replaceForExpression(XmlObject et, IUnitConverter converter) throws Exception {
	QName etQn = et.newCursor().getName();
	if (et instanceof LiteralType) {
		LiteralType lt = (LiteralType) et;

		XmlObject xmlContent = XmlObject.Factory.parse(lt.toString());
		if (xmlContent instanceof QuantityDocument) {
			QuantityDocument sweQ = (QuantityDocument) xmlContent;
			if (sweQ.getQuantity() != null) {
				if (!sweQ.getQuantity().isSetValue()) {
					throw new SubscribeCreationFailedFault("There was" +
							" no Value specified in the swe:Quantity element");
				}
				Double value = sweQ.getQuantity().getValue();
				
				UomPropertyType uom = sweQ.getQuantity().getUom();
				String uomCode = "";
				if (uom != null) {
					uomCode = uom.getCode();
				}
				else {
					//no ucum-code, just return without converting
					return;
				}
				
				try {
					NumberWithUOM result = converter.convert(uomCode, value);
					sweQ.getQuantity().setValue(result.getValue());
					sweQ.getQuantity().getUom().setCode(result.getUom());
					et.set(sweQ);		
				}
				catch (Throwable t) {
					logger.warn("Could not convert uom '" + uom.xmlText(new XmlOptions().setSaveOuter()) +
							"' to base unit, reason: " + t.getMessage());
					if (t instanceof RuntimeException) throw (RuntimeException) t;
					throw new RuntimeException(t);
				}

			}
		}
	
	} 

	else if (VALUE_REFERENCE_QNAME.equals(etQn)) {
		Element elem = (Element) et.getDomNode();
		String urn = XmlUtils.toString(elem.getFirstChild()).trim();
		urn = urn.replaceAll(":", "__").replaceAll("\\.", "_");
		XmlUtils.setElementText(elem, urn);
		
		
	}

}
 
开发者ID:52North,项目名称:SES,代码行数:58,代码来源:EMLHelper.java

示例5: getQuantityFrom

import net.opengis.swe.x101.QuantityDocument; //导入依赖的package包/类
private Quantity getQuantityFrom(BinaryComparisonOpType comparisonType) throws XmlException {
    Node literalNode = getXmlAnyNodeFrom(comparisonType, "Literal").getDomNode();
    LiteralDocument literal = LiteralDocument.Factory.parse(literalNode);
    return ((QuantityDocument) getXmlAnyNodeFrom(literal.getLiteral(), "Quantity")).getQuantity();
}
 
开发者ID:52North,项目名称:SensorWebClient,代码行数:6,代码来源:BasicRule_4_Builder.java


注:本文中的net.opengis.swe.x101.QuantityDocument类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。