Package com.vividsolutions.jts.algorithm

Examples of com.vividsolutions.jts.algorithm.InteriorPointArea


    Geometry geometry = feature.getGeometry();
    Coordinate labelPoint = null;
    if (geometry != null && !geometry.isEmpty() && geometry.isValid()) {
      if (geometry instanceof Polygon || geometry instanceof MultiPolygon) {
        try {
          InteriorPointArea ipa = new InteriorPointArea(geometry);
          labelPoint = ipa.getInteriorPoint();
        } catch (Throwable t) { // NOPMD
          // BUG in JTS for some valid geometries ? fall back to centroid
          log.warn("getInteriorPoint() failed", t);
        }
      } else if (geometry instanceof LineString || geometry instanceof MultiLineString) {
        InteriorPointLine ipa = new InteriorPointLine(geometry);
        labelPoint = ipa.getInteriorPoint();
      } else {
        labelPoint = geometry.getCentroid().getCoordinate();
      }
    }
    if (null == labelPoint && null != geometry) {
View Full Code Here

TOP

Related Classes of com.vividsolutions.jts.algorithm.InteriorPointArea

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.