org.n52.sos.ogc.om.values.Value.isSetValue()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(106)

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

Value.isSetValue介绍

暂无

代码示例

代码示例来源:origin: org.n52.sensorweb.sos/coding-uvf

private String encodeObservationValue(Value<?> value) throws CodedException {
  if (value == null || (value != null && !value.isSetValue())) {
    return UVFConstants.NO_DATA_STRING;
  }
  if (!(value instanceof SweQuantity) && !(value instanceof SweCount)) {
    String errorMessage = String.format("SweType '%s' not supported. Only '%s' and '%s'.",
        value.getClass().getName(),
        SweQuantity.class.getName(),
        SweCount.class.getName());
    LOGGER.error(errorMessage);
    throw new NoApplicableCodeException().withMessage(errorMessage);
  }
  String encodedValue = JavaHelper.asString(value.getValue());
  if (encodedValue.length()> UVFConstants.MAX_VALUE_LENGTH) {
    encodedValue = encodedValue.substring(0, UVFConstants.MAX_VALUE_LENGTH);
  }
  return encodedValue;
}

代码示例来源:origin: org.n52.sensorweb.sos/coding-uvf

private boolean checkForSingleObservationValue(ObservationValue<?> value) {
  return value instanceof SingleObservationValue<?> && value.getValue().isSetValue()
      && (value.getValue() instanceof CountValue || value.getValue() instanceof QuantityValue);
}

代码示例来源:origin: org.n52.sensorweb.sos/coding-wml-v20

/**
 * Get the {@link String} representation of {@link Value}
 * 
 * @param value
 *            {@link Value} to get {@link String} representation from
 * @return {@link String} representation of {@link Value}
 */
private String getValue(Value<?> value) {
  if (value != null && value.isSetValue()) {
    if (value instanceof QuantityValue) {
      QuantityValue quantityValue = (QuantityValue) value;
      return Double.toString(quantityValue.getValue().doubleValue());
    } else if (value instanceof ProfileValue) {
      ProfileValue gwglcValue = (ProfileValue)value;
      if (gwglcValue.isSetValue()) {
        return getValue(gwglcValue.getValue().iterator().next().getSimpleValue());
      }       
    } else if (value instanceof CountValue) {
      CountValue countValue = (CountValue) value;
      return Integer.toString(countValue.getValue().intValue());
    } else if (value instanceof TextValue) {
      TextValue textValue = (TextValue) value;
      String nonXmlEscapedText = textValue.getValue();
      return StringEscapeUtils.escapeXml(nonXmlEscapedText);
    }
  }
  return null;
}

代码示例来源:origin: org.n52.sensorweb.sos/coding-wml-v20

/**
 * Create a array from time values
 * 
 * @param sosObservationValues
 *            SOS multi value observation object
 * @return List with string representations of time values
 * @throws OwsExceptionReport
 *             If an error occurs
 */
private List<String> getTimeArray(MultiObservationValues<?> sosObservationValues) throws OwsExceptionReport {
  TVPValue tvpValue = (TVPValue) sosObservationValues.getValue();
  List<TimeValuePair> timeValuePairs = tvpValue.getValue();
  List<String> toList = Lists.newArrayListWithCapacity(timeValuePairs.size());
  for (TimeValuePair timeValuePair : timeValuePairs) {
    if (timeValuePair.getValue() != null
        && (timeValuePair.getValue() instanceof CountValue || timeValuePair.getValue() instanceof QuantityValue)
        && timeValuePair.getValue().isSetValue()) {
      toList.add(getTimeString(timeValuePair.getTime()));
    }
  }
  return toList;
}

代码示例来源:origin: org.n52.sensorweb.sos/coding-uvf

private boolean checkForMultiObservationValue(ObservationValue<?> value) {
  return value instanceof MultiObservationValues<?> && value.getValue().isSetValue()
      && value.getValue() instanceof TVPValue && ((TVPValue)value.getValue()).isSetValue()
      && (((TVPValue)value.getValue()).getValue().get(0).getValue() instanceof CountValue 
          || ((TVPValue)value.getValue()).getValue().get(0).getValue() instanceof QuantityValue);
}

代码示例来源:origin: org.n52.sensorweb.sos/coding-json

private JsonNode encodeTVPValue(OmObservation o) throws OwsExceptionReport {
  TVPValue tvpValue = (TVPValue) o.getValue().getValue();
  ObjectNode result = nodeFactory().objectNode();
  List<TimeValuePair> values = tvpValue.getValue();
  if (values != null && !values.isEmpty()) {
    String obsProp = o.getObservationConstellation().getObservableProperty().getIdentifier();
    SweTime timeDef = new SweTime();
    timeDef.setDefinition(OmConstants.PHENOMENON_TIME);
    timeDef.setUom(OmConstants.PHEN_UOM_ISO8601);
    SweField timeField = new SweField(OmConstants.PHENOMENON_TIME_NAME, timeDef);
    SweField valueField = getFieldForValue(obsProp, values.get(0).getValue());
    result.putArray(JSONConstants.FIELDS).add(encodeObjectToJson(timeField))
        .add(encodeObjectToJson(valueField));
    ArrayNode jvalues = result.putArray(JSONConstants.VALUES);
    for (TimeValuePair tvp : values) {
      if (tvp != null && tvp.getValue() != null && tvp.getValue().isSetValue()) {
        jvalues.addArray().add(encodeObjectToJson(tvp.getTime())).add(getTokenForValue(tvp.getValue()));
      }
    }
  }
  return result;
}

相关文章

微信公众号

最新文章

更多