public String toText() { return point.toText(); }
/** * Converts a point to a WKT-based string. * * @param point Point to convert to WKT. * @return WKT String. */ public static String pointToWKT(org.opengis.geometry.primitive.Point point) { return JTS.toGeometry(point.getDirectPosition()).toText(); }
@Override protected void pointDone(Point point, MapContext mc, ToolManager tm) throws TransitionException { Graphics g = tm.getComponent().getGraphics(); if ((g != null) && (g instanceof Graphics2D)) { // flash make the GUI unresponsive during 1s.. //SymbolUtil.flashPoint(point, (Graphics2D) g, tm.getMapTransform()); GUI_LOGGER.info(i18n.tr("Coordinate : {0}", point.toText())); } }
/** * [Test] Verifies that a kml:Model element has a valid location (that * specifies the position of the model origin). */ @Test(description = "ATC-133, ATC-150") public void modelLocation() { JTSGeometryBuilder geomBuilder = new JTSGeometryBuilder(); Polygon crsPolygon = geomBuilder.buildPolygon(new Envelope(-180, 180, -90, 90)); for (int i = 0; i < targetElements.getLength(); i++) { Element model = (Element) targetElements.item(i); NodeList location = model.getElementsByTagNameNS(KML2.NS_NAME, "Location"); if (location.getLength() == 0) { throw new AssertionError(ErrorMessage.format( ErrorMessageKeys.MISSING_INFOSET_ITEM, "kml:Location", XMLUtils.buildXPointer(model))); } Point jtsPoint = geomBuilder .buildPointFromLocation((Element) location.item(0)); Assert.assertTrue( crsPolygon.covers(jtsPoint), ErrorMessage.format(ErrorMessageKeys.OUTSIDE_CRS, jtsPoint.toText())); } }
/** * [Test] Verifies that a kml:Point element has valid coordinates. It must * contain exactly one coordinate tuple in the default CRS. */ @Test(description = "ATC-103, ATC-114") public void validPointCoordinates() { JTSGeometryBuilder geomBuilder = new JTSGeometryBuilder(); Polygon crsPolygon = geomBuilder.buildPolygon(new Envelope(-180, 180, -90, 90)); for (int i = 0; i < targetElements.getLength(); i++) { Element point = (Element) targetElements.item(i); Assert.assertTrue(coordsValidator.isValid(point), coordsValidator.getErrorMessages()); Point jtsPoint = geomBuilder.buildPoint(point); Assert.assertTrue( crsPolygon.covers(jtsPoint), ErrorMessage.format(ErrorMessageKeys.OUTSIDE_CRS, jtsPoint.toText())); } }
public Map<String, Object> findEcoregion(Point point) throws EcoregionFinderException { lazyLoadStore(); try { SimpleFeatureSource featureSource = store.getFeatureSource(); return getFeatureProperties(point, featureSource.getFeatures()); } catch (IOException e) { throw new EcoregionFinderException("lookup feature for point [" + point.toText() + "] from shapefile at [" + config.getShapeFilePath() + "]", e); } }