/** * * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { SpatialSubsetType spatialSubset = Wcs10Factory.eINSTANCE.createSpatialSubsetType(); List<Node> envelopes = node.getChildren("Envelope"); for (Node envelopeNode : envelopes) { ReferencedEnvelope envelope = (ReferencedEnvelope) envelopeNode.getValue(); EnvelopeType env = Gml4wcsFactory.eINSTANCE.createEnvelopeType(); env.setSrsName(CRS.lookupIdentifier(envelope.getCoordinateReferenceSystem(), true)); DirectPositionType pos1 = Gml4wcsFactory.eINSTANCE.createDirectPositionType(); DirectPositionType pos2 = Gml4wcsFactory.eINSTANCE.createDirectPositionType(); pos1.setDimension(BigInteger.valueOf(2)); pos2.setDimension(BigInteger.valueOf(2)); pos1.setValue(Arrays.asList(envelope.getMinX(), envelope.getMinY())); pos2.setValue(Arrays.asList(envelope.getMaxX(), envelope.getMaxY())); env.getPos().add(pos1); env.getPos().add(pos2); spatialSubset.getEnvelope().add(envelope); } List<Node> gridsNode = node.getChildren("Grid"); for (Node grid : gridsNode) spatialSubset.getGrid().add(grid.getValue()); return spatialSubset; }
public EnvelopeType marshalEnvelope(Envelope src) { EnvelopeType dest = gml.createEnvelopeType(); if (src.isSetLowerCorner()) dest.setLowerCorner(marshalDirectPosition(src.getLowerCorner())); if (src.isSetUpperCorner()) dest.setUpperCorner(marshalDirectPosition(src.getUpperCorner())); if (src.isSetCoord()) { for (Coord coord : src.getCoord()) dest.getCoord().add(marshalCoord(coord)); } if (src.isSetPos()) { for (DirectPosition pos : src.getPos()) dest.getPos().add(marshalDirectPosition(pos)); } if (src.isSetCoordinates()) dest.setCoordinates(marshalCoordinates(src.getCoordinates())); if (src.isSetSrsName()) dest.setSrsName(src.getSrsName()); if (src.isSetSrsDimension()) dest.setSrsDimension(BigInteger.valueOf(src.getSrsDimension())); if (src.isSetAxisLabels()) dest.setAxisLabels(src.getAxisLabels()); if (src.isSetUomLabels()) dest.setUomLabels(src.getUomLabels()); return dest; }
public Envelope unmarshalEnvelope(EnvelopeType src) { Envelope dest = new Envelope(); if (src.isSetLowerCorner()) dest.setLowerCorner(unmarshalDirectPosition(src.getLowerCorner())); if (src.isSetUpperCorner()) dest.setUpperCorner(unmarshalDirectPosition(src.getUpperCorner())); if (src.isSetCoord()) { for (CoordType coord : src.getCoord()) dest.addCoord(unmarshalCoord(coord)); } if (src.isSetPos()) { for (DirectPositionType pos : src.getPos()) dest.addPos(unmarshalDirectPosition(pos)); } if (src.isSetCoordinates()) dest.setCoordinates(unmarshalCoordinates(src.getCoordinates())); if (src.isSetSrsName()) dest.setSrsName(src.getSrsName()); if (src.isSetSrsDimension()) dest.setSrsDimension(src.getSrsDimension().intValue()); if (src.isSetAxisLabels()) dest.setAxisLabels(src.getAxisLabels()); if (src.isSetUomLabels()) dest.setUomLabels(src.getUomLabels()); return dest; }