public static LinearRing createRing(AbstractRingType abstractRing, String srs) { if (abstractRing instanceof LinearRingType) { LinearRingType linearRing = (LinearRingType) abstractRing; if (linearRing.isSetPosList()) { return new GeometryFactory().createLinearRing( createCoordinatesFromPosList(linearRing.getPosList(), srs)); } else if (linearRing.isSetCoordinates()) { return new GeometryFactory().createLinearRing( createCoordinatesFromCoordinates(linearRing.getCoordinates(), srs)); } } throw new UnsupportedOperationException("Only LinearRing supported currently."); }
/** * method parses the passed linearRing(generated thru XmlBEans) and returns a string containing the coordinate * values of the passed ring * * @param xbLinearRing linearRing(generated thru XmlBEans) * * @return Returns a string containing the coordinate values of the passed ring * * * @throws DecodingException * if parsing the linear Ring failed */ private String getCoordString4LinearRing(LinearRingType xbLinearRing) throws DecodingException { String result = ""; DirectPositionListType xbPosList = xbLinearRing.getPosList(); CoordinatesType xbCoordinates = xbLinearRing.getCoordinates(); DirectPositionType[] xbPosArray = xbLinearRing.getPosArray(); if (xbPosList != null && !(xbPosList.getStringValue().isEmpty())) { result = getString4PosList(xbPosList); } else if (xbCoordinates != null && !(xbCoordinates.getStringValue().isEmpty())) { result = getString4Coordinates(xbCoordinates); } else if (xbPosArray != null && xbPosArray.length > 0) { result = getString4PosArray(xbPosArray); } else { throw new DecodingException("The Polygon must contain the following elements " + "<gml:exterior><gml:LinearRing><gml:posList>, " + "<gml:exterior><gml:LinearRing><gml:coordinates> " + "or <gml:exterior><gml:LinearRing><gml:pos>{<gml:pos>}!"); } return result; }
if (lrt.isSetPosList()) { this.crs = lrt.getPosList().getSrsName(); if (lrt.getPointPropertyArray().length > 0) { if (lrt.getPointPropertyArray()[0].isSetPoint()) this.crs = lrt.getPointPropertyArray()[0].getPoint().getSrsName(); } else if (lrt.getPosArray().length > 0) { this.crs = lrt.getPosArray()[0].getSrsName(); } else if (lrt.getPointRepArray().length > 0) { if (lrt.getPointRepArray()[0].isSetPoint()) this.crs = lrt.getPointRepArray()[0].getPoint().getSrsName();
/** * Sets the "LinearRing" element */ public void setLinearRing(net.opengis.gml.x32.LinearRingType linearRing) { synchronized (monitor()) { check_orphaned(); net.opengis.gml.x32.LinearRingType target = null; target = (net.opengis.gml.x32.LinearRingType)get_store().find_element_user(LINEARRING$0, 0); if (target == null) { target = (net.opengis.gml.x32.LinearRingType)get_store().add_element_user(LINEARRING$0); } target.set(linearRing); } }
DirectPositionListType xbPosList = xbLrt.addNewPosList(); xbPosList = xbLrt.addNewPosList(); xbPosList.setSrsName(srsName); xbPosList.setStringValue(JTSHelper.getCoordinatesString(ring));
/** * Sets the "LinearRing" element */ public void setLinearRing(net.opengis.gml.x32.LinearRingType linearRing) { synchronized (monitor()) { check_orphaned(); net.opengis.gml.x32.LinearRingType target = null; target = (net.opengis.gml.x32.LinearRingType)get_store().find_element_user(LINEARRING$0, 0); if (target == null) { target = (net.opengis.gml.x32.LinearRingType)get_store().add_element_user(LINEARRING$0); } target.set(linearRing); } }