Class InteriorPointFinder


  • public class InteriorPointFinder
    extends Object
    Find a reasonable point at which to label a Geometry.

    Algorithm is:

    • Find the intersections between the geometry and a line halfway down the envelope
    • Pick the midpoint of the largest intersection (the intersections will be lines and points)
    • Constructor Detail

      • InteriorPointFinder

        public InteriorPointFinder()
    • Method Detail

      • findPoint

        public org.locationtech.jts.geom.Coordinate findPoint​(org.locationtech.jts.geom.Geometry geometry)
        Finds a reasonable point at which to label a Geometry.
        Parameters:
        geometry - the geometry to analyze
        Returns:
        the midpoint of the largest intersection between the geometry and a line halfway down its envelope
      • widestGeometry

        protected org.locationtech.jts.geom.Geometry widestGeometry​(org.locationtech.jts.geom.Geometry geometry)
      • envelopeMiddle

        protected org.locationtech.jts.geom.Geometry envelopeMiddle​(org.locationtech.jts.geom.Geometry geometry)
      • centre

        public org.locationtech.jts.geom.Coordinate centre​(org.locationtech.jts.geom.Envelope envelope)
        Returns the centre-of-mass of the envelope.
        Parameters:
        envelope - the envelope to analyze
        Returns:
        the centre of the envelope