private DefaultDomConverter createDomConverter() { return new DefaultDomConverter(operatorType, descriptorFactory, propertySetDescriptor); } }
private DefaultDomConverter createDomConverter() { return new DefaultDomConverter(operatorType, descriptorFactory, propertySetDescriptor); } }
@Override public Object convertDomToValue(DomElement parentElement, Object value) throws ConversionException, ValidationException { com.vividsolutions.jts.geom.GeometryFactory gf = new com.vividsolutions.jts.geom.GeometryFactory(); final DefaultDomConverter domConverter = new DefaultDomConverter(Coordinate.class); final DomElement[] children = parentElement.getChildren("coordinate"); List<Coordinate> coordList = new ArrayList<Coordinate>(); for (DomElement child : children) { final Coordinate coordinate = (Coordinate) domConverter.convertDomToValue(child, null); coordList.add(coordinate); } return gf.createPolygon(gf.createLinearRing(coordList.toArray(new Coordinate[coordList.size()])), null); }
@Override public Object convertDomToValue(DomElement parentElement, Object value) throws ConversionException, ValidationException { com.vividsolutions.jts.geom.GeometryFactory gf = new com.vividsolutions.jts.geom.GeometryFactory(); final DefaultDomConverter domConverter = new DefaultDomConverter(Coordinate.class); final DomElement[] children = parentElement.getChildren("coordinate"); List<Coordinate> coordList = new ArrayList<Coordinate>(); for (DomElement child : children) { final Coordinate coordinate = (Coordinate) domConverter.convertDomToValue(child, null); coordList.add(coordinate); } return gf.createPolygon(gf.createLinearRing(coordList.toArray(new Coordinate[coordList.size()])), null); }
private Shape convertDomToShape(DomElement parentElement) throws ConversionException, ValidationException { final DomElement shapeChild = parentElement.getChild("shape"); final DefaultDomConverter domConverter = new DefaultDomConverter(Shape.class); return (Shape) domConverter.convertDomToValue(shapeChild, null); }
private void convertShapeToDom(Shape figureShape, DomElement parentElement) throws ConversionException { final DomElement shapeChild = parentElement.createChild("shape"); shapeChild.setAttribute("class", figureShape.getClass().getName()); final DefaultDomConverter domConverter = new DefaultDomConverter(Shape.class); domConverter.convertValueToDom(figureShape, shapeChild); }
private DomConverter createChildConverter(Class<?> actualConfigType) { return new DefaultDomConverter(actualConfigType, new ParameterDescriptorFactory()); }
public String convertObjectToXml(Object object) throws ConversionException { DefaultDomConverter domConverter = new DefaultDomConverter(object.getClass(), parameterDescriptorFactory); DomElement parametersDom = new XppDomElement(parameterElementName); domConverter.convertValueToDom(object, parametersDom); return parametersDom.toXml(); }
@Override public void convertValueToDom(Object value, DomElement parentElement) throws ConversionException { Geometry geom = (Geometry) value; final Coordinate[] coordinates = geom.getCoordinates(); final DefaultDomConverter domConverter = new DefaultDomConverter(Coordinate.class); for (Coordinate coordinate : coordinates) { final DomElement child = parentElement.createChild("coordinate"); domConverter.convertValueToDom(coordinate, child); } }
private void convertXmlToPropertySet(String xml, Class<? extends Object> schema, PropertySet propertySet) throws ValidationException, ConversionException { propertySet.setDefaultValues(); DefaultDomConverter domConverter = new DefaultDomConverter(schema, parameterDescriptorFactory); DomElement domElement = convertXmlToDomElement(xml); domConverter.convertDomToValue(domElement, propertySet); } }
@Override public void convertValueToDom(Object value, DomElement parentElement) throws ConversionException { Geometry geom = (Geometry) value; final Coordinate[] coordinates = geom.getCoordinates(); final DefaultDomConverter domConverter = new DefaultDomConverter(Coordinate.class); for (Coordinate coordinate : coordinates) { final DomElement child = parentElement.createChild("coordinate"); domConverter.convertValueToDom(coordinate, child); } }
OperatorSpi operatorSpi = operatorSpiRegistry.getOperatorSpi(operatorName); Class<? extends Operator> operatorClass = operatorSpi.getOperatorDescriptor().getOperatorClass(); DefaultDomConverter domConverter = new DefaultDomConverter(operatorClass, new ParameterDescriptorFactory());
private void configureOperator(OperatorConfiguration operatorConfiguration) throws ValidationException, ConversionException { OperatorDescriptor operatorDescriptor = getOperatorSpi().getOperatorDescriptor(); ParameterDescriptorFactory descriptorFactory = new ParameterDescriptorFactory(sourceProductMap); PropertySetDescriptor propertySetDescriptor = PropertySetDescriptorFactory.createForOperator(operatorDescriptor, descriptorFactory.getSourceProductMap()); Class<? extends Operator> operatorType = operatorDescriptor.getOperatorClass(); DefaultDomConverter domConverter = new DefaultDomConverter(operatorType, descriptorFactory, propertySetDescriptor); domConverter.convertDomToValue(operatorConfiguration.getConfiguration(), getParameterSet()); Set<Reference> referenceSet = operatorConfiguration.getReferenceSet(); for (Reference reference : referenceSet) { Property property = getParameterSet().getProperty(reference.getParameterName()); property.setValue(reference.getValue()); } }
final DefaultDomConverter domConverter = new DefaultDomConverter(operatorClass, new ParameterDescriptorFactory(sourceProductMap)); final XppDomElement parametersDom = new XppDomElement("parameters");
final DefaultDomConverter dc = new DefaultDomConverter(PropertyContainer.class); final DomElement domElement1 = new DefaultDomElement("configuration"); dc.convertValueToDom(configuration1, domElement1);
assertNull(parameterSet.getProperty("variables").getValue()); DefaultDomConverter domConverter = new DefaultDomConverter(opType, parameterDescriptorFactory); domConverter.convertDomToValue(configurationDomElement, parameterSet); assertNotNull(parameterSet.getProperty("targetBands"));