/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { Mark[] marks = null; ExternalGraphic[] graphics = null; if (node.getChild("Mark") != null) { List l = node.getChildValues("Mark"); marks = (Mark[]) l.toArray(new Mark[l.size()]); } else { List l = node.getChildValues("ExternalGraphic"); graphics = (ExternalGraphic[]) l.toArray(new ExternalGraphic[l.size()]); } Expression opacity = (Expression) node.getChildValue("Opacity"); Expression size = (Expression) node.getChildValue("Size"); Expression rotation = (Expression) node.getChildValue("Rotation"); return styleFactory.createGraphic(graphics, marks, null, opacity, size, rotation); } }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { if (node.getChild("coord") != null) { Coordinate c = (Coordinate) node.getChild("coord").getValue(); return gFactory.createPoint(c); } if (node.getChild("coordinates") != null) { CoordinateSequence seq = (CoordinateSequence) node.getChild("coordinates").getValue(); return gFactory.createPoint(seq); } throw new RuntimeException("Could not find a coordinate"); }
/** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { if ((node.getChild("RedChannel") == null) || (node.getChild("BlueChannel") == null) || (node.getChild("GreenChannel") == null) || (node.getChild("GrayChannel") == null)) { String msg = "All of Red,Blue,Green,Gray must be specified"; throw new RuntimeException(msg); } SelectedChannelType[] rgb = new SelectedChannelType[] { (SelectedChannelType) node.getChildValue("RedChannel"), (SelectedChannelType) node.getChildValue("GreenChannel"), (SelectedChannelType) node.getChildValue("BlueChannel") }; SelectedChannelType gray = (SelectedChannelType) node.getChildValue("GrayChannel"); ChannelSelection cs = styleFactory.createChannelSelection(null); cs.setGrayChannel(gray); cs.setRGBChannels(rgb); return cs; } }
/** * <!-- begin-user-doc --> * Returns a coordinate sequence with a single coordinate in it. * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { int dimension = 1; double x; double y; double z; x = y = z = Double.NaN; x = ((BigDecimal) node.getChild("X").getValue()).doubleValue(); if (!node.getChildren("Y").isEmpty()) { dimension++; y = ((BigDecimal) node.getChild("Y").getValue()).doubleValue(); } if (!node.getChildren("Z").isEmpty()) { dimension++; z = ((BigDecimal) node.getChild("Z").getValue()).doubleValue(); } return new Coordinate(x, y, z); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { Expression[] operands = OGCUtils.spatial(node, filterFactory, geometryFactory); double distance = ((Double) node.getChildValue(Double.class)).doubleValue(); String units = (String) node.getChild("Distance").getAttributeValue("units"); return filterFactory.beyond(operands[0], operands[1], distance, units); } }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { Mark[] marks = null; ExternalGraphic[] graphics = null; if (node.getChild("Mark") != null) { List l = node.getChildValues("Mark"); marks = (Mark[]) l.toArray(new Mark[l.size()]); } else { List l = node.getChildValues("ExternalGraphic"); graphics = (ExternalGraphic[]) l.toArray(new ExternalGraphic[l.size()]); } Expression opacity = (Expression) node.getChildValue("Opacity"); Expression size = (Expression) node.getChildValue("Size"); Expression rotation = (Expression) node.getChildValue("Rotation"); return styleFactory.createGraphic(graphics, marks, null, opacity, size, rotation); } }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { LinearRing shell = (LinearRing) node.getChild("outerBoundaryIs").getValue(); List innerRings = node.getChildren("innerBoundaryIs"); LinearRing[] holes = new LinearRing[innerRings.size()]; for (int i = 0; i < innerRings.size(); i++) { Node inode = (Node) innerRings.get(i); holes[i] = (LinearRing) inode.getValue(); } return gFactory.createPolygon(shell, holes); }
@SuppressWarnings("unchecked") private void addParameter(Node node, Ows10Factory ows10Factory, OperationType operationType, String parameterName) { Node paramParentNode = node.getChild(parameterName); List<String> paramValues = childNames(paramParentNode); DomainType domain = ows10Factory.createDomainType(); domain.setName(parameterName); for (String paramValue : paramValues) { domain.getValue().add(paramValue); } operationType.getParameter().add(domain); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { //do the null check if (node.getChild("null") != null) { //ignore the description as to why its null Envelope e = new Envelope(); e.setToNull(); return e; } //has to be a valid bounding box return (Envelope) node.getChildValue(0); }
@SuppressWarnings("unchecked") @Override public Object parse(ElementInstance instance, Node node, Object value) throws Exception { Ows10Factory ows10Factory = Ows10Factory.eINSTANCE; DCPType dcpType = ows10Factory.createDCPType(); HTTPType httpType = ows10Factory.createHTTPType(); dcpType.setHTTP(httpType); List<Node> httpChildren = node.getChildren("HTTP"); for (Node http : httpChildren) { Node get = http.getChild("Get"); if (get != null) { RequestMethodType methodType = createRequestMethodType(ows10Factory, get); httpType.getGet().add(methodType); } Node post = http.getChild("Post"); if (post != null) { RequestMethodType methodType = createRequestMethodType(ows10Factory, post); httpType.getPost().add(methodType); } } return dcpType; }
@Override public Object parse(ElementInstance instance, Node node, Object value) throws Exception { Ows10Factory ows10Factory = Ows10Factory.eINSTANCE; OperationsMetadataType om = ows10Factory.createOperationsMetadataType(); Node request = node.getChild("Request"); OperationType operation; operation = getCapabilities(request.getChild("GetCapabilities"), ows10Factory); addOperation(om, operation); operation = dft(request.getChild("DescribeFeatureType"), ows10Factory); addOperation(om, operation); operation = getFeature(request.getChild("GetFeature"), ows10Factory); addOperation(om, operation); operation = createOperation("Transaction", node, ows10Factory); addOperation(om, operation); operation = createOperation("LockFeature", node, ows10Factory); addOperation(om, operation); operation = createOperation("GetFeatureWithLock", node, ows10Factory); addOperation(om, operation); operation = createOperation("Transaction", node, ows10Factory); addOperation(om, operation); return om; }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { //TODO: units Expression[] operands = OGCUtils.spatial(node, filterFactory, geometryFactory); double distance = ((Double) node.getChildValue("Distance")).doubleValue(); String units = (String) node.getChild("Distance").getAttributeValue("units"); return filterFactory.dwithin(operands[0], operands[1], distance, units); } }
Node boundedByNode = node.getChild("boundedBy");
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { ContrastEnhancement ce = styleFactory.createContrastEnhancement(); if (node.getChildValue("GammaValue") != null) { Double gamma = (Double) node.getChildValue("GammaValue"); ce.setGammaValue(filterFactory.createLiteralExpression(gamma.doubleValue())); } if (node.getChild("Normalize") != null) { ce.setNormalize(); } else { if (node.getChild("Histogram") != null) { ce.setHistogram(); } } return ce; } }
/** * <!-- begin-user-doc --> * This method returns an object of type * @link com.vividsolutions.jts.geom.Envelope. * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { List coordinates = node.getChildren("coord"); if (!coordinates.isEmpty() && (coordinates.size() == 2)) { Node n1 = (Node) coordinates.get(0); Node n2 = (Node) coordinates.get(1); Coordinate c1 = (Coordinate) n1.getValue(); Coordinate c2 = (Coordinate) n2.getValue(); return new Envelope(c1.x, c2.x, c1.y, c2.y); } if (!coordinates.isEmpty()) { throw new RuntimeException("Envelope can have only two coordinates"); } if (node.getChild("coordinates") != null) { CoordinateSequence cs = (CoordinateSequence) node.getChild("coordinates").getValue(); if (cs.size() != 2) { throw new RuntimeException("Envelope can have only two coordinates"); } return new Envelope(cs.getX(0), cs.getX(1), cs.getY(0), cs.getY(1)); } throw new RuntimeException("Could not find coordinates for envelope"); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { ContrastEnhancement ce = styleFactory.createContrastEnhancement(); if (node.getChildValue("GammaValue") != null) { Double gamma = (Double) node.getChildValue("GammaValue"); ce.setGammaValue(filterFactory.literal(gamma.doubleValue())); } if (node.getChild("Normalize") != null) { ce.setNormalize(); } else { if (node.getChild("Histogram") != null) { ce.setHistogram(); } } return ce; } }
Node n = node.getChild(Expression.class); Name opName = new NameImpl(n.getComponent().getNamespace(), n.getComponent().getName());
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { //TODO: crs PropertyName propertyName = (PropertyName) node.getChildValue(PropertyName.class); Envelope box = (Envelope) node.getChildValue(Envelope.class); Node srsNode = node.getChild(Envelope.class).getAttribute("srsName"); String srs = (srsNode != null) ? srsNode.getValue().toString() : null; if ((srs == null) && (crs != null)) { srs = GML2EncodingUtils.crs(crs); } return factory.bbox(propertyName.getPropertyName(), box.getMinX(), box.getMinY(), box.getMaxX(), box.getMaxY(), srs); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { //TODO: crs PropertyName propertyName = (PropertyName) node.getChildValue(PropertyName.class); Envelope box = (Envelope) node.getChildValue(Envelope.class); Node srsNode = node.getChild(Envelope.class).getAttribute("srsName"); String srs = (srsNode != null) ? srsNode.getValue().toString() : null; if ((srs == null) && (crs != null)) { srs = GML2EncodingUtils.crs(crs); } String name = null; if ( propertyName != null ) { name = propertyName.getPropertyName(); } //JD: this is a bit hackish, we know that "" means default geometry // in SimpleFeaturePropertyAccessor, so instead of dying here set // to empty string to mean defualt geometry // TODO: come up with something a bit more concrete if ( name == null ) { name = ""; } return factory.bbox(name, box.getMinX(), box.getMinY(), box.getMaxX(), box.getMaxY(), srs); }