use of org.n52.shetland.ogc.swe.SweAbstractDataComponent in project arctic-sea by 52North.
the class FieldDecoder method decodeCountRange.
protected SweAbstractDataComponent decodeCountRange(JsonNode node) {
SweCountRange swe = new SweCountRange();
if (node.hasNonNull(JSONConstants.VALUE)) {
int start = node.path(JSONConstants.VALUE).path(0).intValue();
int end = node.path(JSONConstants.VALUE).path(1).intValue();
swe.setValue(new RangeValue<Integer>(start, end));
}
return swe;
}
use of org.n52.shetland.ogc.swe.SweAbstractDataComponent in project arctic-sea by 52North.
the class SweAbstractDataComponent method setName.
public SweAbstractDataComponent setName(final String name) {
getNames().clear();
getNames().add(new CodeType(name));
return this;
}
use of org.n52.shetland.ogc.swe.SweAbstractDataComponent in project arctic-sea by 52North.
the class ProfileLevel method valueAsDataRecord.
public SweDataRecord valueAsDataRecord(SweDataRecord dataRecord) {
int counter = 0;
for (Value<?> v : getValue()) {
if (v instanceof SweAbstractDataComponent) {
SweAbstractDataComponent adc = (SweAbstractDataComponent) v;
String name;
if (adc.isSetName()) {
name = adc.getName().getValue();
} else if (adc.isSetDefinition()) {
name = adc.getDefinition();
} else {
name = "component_" + counter++;
}
dataRecord.addField(new SweField(name, adc));
}
}
return dataRecord;
}
use of org.n52.shetland.ogc.swe.SweAbstractDataComponent in project arctic-sea by 52North.
the class AbstractSmlDataComponentContainer method getDataRecord.
/**
* @return the dataRecord
*/
public DataRecord getDataRecord() {
if (!isSetDataRecord() && isSetDataComponents()) {
SweSimpleDataRecord sdr = new SweSimpleDataRecord();
int counter = 1;
for (SweAbstractDataComponent element : abstractDataComponents) {
String n = "field_" + counter++;
if (element.isSetName()) {
n = element.getName().getValue();
}
SweField field = new SweField(n, element);
sdr.addField(field);
}
return sdr;
}
return dataRecord;
}
use of org.n52.shetland.ogc.swe.SweAbstractDataComponent in project arctic-sea by 52North.
the class SmlCharacteristics method getCharacteristic.
/**
* @return the characteristics
*/
public List<SmlCharacteristic> getCharacteristic() {
if (!hasCharacteristics() && isSetAbstractDataComponents()) {
List<SmlCharacteristic> c = Lists.newArrayList();
for (SweAbstractDataComponent component : getAbstractDataComponents()) {
SmlCharacteristic smlCharacteristic = new SmlCharacteristic(component.getName().getValue());
smlCharacteristic.setAbstractDataComponent(component);
c.add(smlCharacteristic);
}
return c;
}
return this.characteristics;
}
Aggregations