Class MapPolyline

    • Constructor Detail

      • MapPolyline

        public MapPolyline()
        Create a new map element.
      • MapPolyline

        public MapPolyline​(AttributeCollection attributeSource)
        Create a new map element.
        Parameters:
        attributeSource - is the source of the attributes for this map element.
      • MapPolyline

        public MapPolyline​(UUID id)
        Create a new map element.
        Parameters:
        id - is the unique identifier of this element, or null if unknown.
        Since:
        4.0
      • MapPolyline

        public MapPolyline​(UUID id,
                           AttributeCollection attributeSource)
        Create a new map element.
        Parameters:
        id - is the unique identifier of this element, or null if unknown.
        attributeSource - is the source of the attributes for this map element.
        Since:
        4.0
    • Method Detail

      • setWidePolyline

        public void setWidePolyline​(boolean isWidePolyline)
        Set if this polyline must be drawn with a wide height.
        Parameters:
        isWidePolyline - is true if this polyline must have a wide height, otherwise false
      • isWidePolyline

        @Pure
        public boolean isWidePolyline()
        Replies if this polyline must be drawn with a wide height.
        Returns:
        true if this polyline must have a wide height, otherwise false
      • getDistance

        @Pure
        public final double getDistance​(Point2D<?,​?> point)
        Replies the distance between this MapElement and point.
        Specified by:
        getDistance in class MapElement
        Parameters:
        point - the point to compute the distance to.
        Returns:
        the distance. Should be negative depending of the MapElement type.
      • distance

        @Pure
        public double distance​(Point2D<?,​?> point,
                               double width)
        Replies the distance between this figure and the specified point.
        Parameters:
        point - is the x-coordinate of the point.
        width - is the width of the polyline.
        Returns:
        the computed distance; the distance could be negative if the point lies on the polyline shape (if the polyline has wide width).
      • distanceToEnd

        @Pure
        public final double distanceToEnd​(Point2D<?,​?> point)
        Replies the distance between the nearest end of this MapElement and the point.
        Parameters:
        point - the point.
        Returns:
        the distance. Should be negative depending of the MapElement type.
      • distanceToEnd

        @Pure
        public double distanceToEnd​(Point2D<?,​?> point,
                                    double width)
        Replies the distance between the nearest end of this MapElement and the point.
        Parameters:
        point - is the x-coordinate of the point.
        width - is the width of the polyline.
        Returns:
        the computed distance
      • getNearestEndIndex

        @Pure
        public final int getNearestEndIndex​(double x,
                                            double y)
        Replies the index of the nearest end of line according to the specified point.
        Parameters:
        x - x coordinate
        y - y coordinate
        Returns:
        index of the nearest end point.
      • getNearestEndIndex

        @Pure
        public final int getNearestEndIndex​(double x,
                                            double y,
                                            OutputParameter<Double> distance)
        Replies the index of the nearest end of line according to the specified point.
        Parameters:
        x - is the point coordinate from which the distance must be computed
        y - is the point coordinate from which the distance must be computed
        distance - is the distance value that will be set by this function (if the parameter is not null).
        Returns:
        index of the nearest end point.
      • getNearestPosition

        @Pure
        public Point1d getNearestPosition​(Point2D<?,​?> pos)
        Return the nearest point 1.5D from a 2D position.
        Parameters:
        pos - is the testing position.
        Returns:
        the nearest 1.5D position on the polyline.
        See Also:
        getNearestPosition(Point2D, double)
      • getNearestPosition

        @Pure
        public Point1d getNearestPosition​(Point2D<?,​?> pos,
                                          double lateralDistance)
        Return the nearest point 1.5D from a 2D position.
        Parameters:
        pos - is the testing position.
        lateralDistance - the lateral distance to put into the point. The sign of the given value is ignored. The replied point p will have a lateral distance such that abs(lateralDistance) == abs(p.getLateralDistance()).
        Returns:
        the nearest 1.5D position on the polyline.
        Since:
        16.0
        See Also:
        getNearestPosition(Point2D)
      • getLength

        @Pure
        public double getLength()
        Replies the length of this polyline. The length is the distance between first point and the last point of the polyline.

        The returned value is the sum of the lengths of the polyline' groups that compose this polyline.

        Returns:
        the length of the segment in meters.
      • getSubSegmentForDistance

        @Pure
        public Segment1D<?,​?> getSubSegmentForDistance​(double distance)
        Replies the subsegment which is corresponding to the given position.

        A subsegment is a pair if connected points in the polyline.

        Parameters:
        distance - is position on the polyline (in 0 to getLength()).
        Returns:
        the point pair, never null.
      • getWidth

        @Pure
        public double getWidth()
        Returns the poly-element width in the geo-located referencial. The width is the distance between the border lines of the polyline.

        The implementation provided by the MapPolyline class always replies 1 meter. The function getWidth() must be overrided to provide other way to compute the width the polyelements.

        Returns:
        the width of the poly-element in meters.
      • intersects

        @Pure
        public boolean intersects​(Shape2D<?,​?,​?,​?,​?,​? extends Rectangle2afp<?,​?,​?,​?,​?,​?>> rectangle)
        Replies if this element has an intersection with the specified rectangle.
        Specified by:
        intersects in class MapElement
        Parameters:
        rectangle - the rectangle
        Returns:
        true if this MapElement is intersecting the specified area, otherwise false
      • toPath2D

        @Pure
        public final Path2d toPath2D()
        Replies the Path2D that corresponds to this polyline.
        Returns:
        the 2D path.
      • toPath2D

        @Pure
        public final void toPath2D​(Path2d path)
        Replies the Path2D that corresponds to this polyline.
        Parameters:
        path - the 2D path to update.
      • toPath2D

        @Pure
        public final Path2d toPath2D​(double startPosition,
                                     double endPosition)
        Replies the Path2D that corresponds to this polyline. If startPosition is greater to zero, the replied path will be clipped to ignore the part of the polyline before the given value. If endPosition is lower to the length of the polyline, the replied path will be clipped to ignore the part of the polyline after the given value.
        Parameters:
        startPosition - is the curviline position from which the polyline is drawn.
        endPosition - is the curviline position to which the polyline is drawn.
        Returns:
        the clipped 2D path.
        Since:
        4.0
      • toPath2D

        @Pure
        public final void toPath2D​(Path2d path,
                                   double startPosition,
                                   double endPosition)
        Replies the Path2D that corresponds to this polyline. If startPosition is greater to zero, the replied path will be clipped to ignore the part of the polyline before the given value. If endPosition is lower to the length of the polyline, the replied path will be clipped to ignore the part of the polyline after the given value.
        Parameters:
        path - the path to fill out.
        startPosition - is the curviline position from which the polyline is drawn.
        endPosition - is the curviline position to which the polyline is drawn.
        Since:
        4.0
      • toSegment1D

        @Pure
        protected Segment1D<?,​?> toSegment1D()
        Replies the Segment1D representation of this object.
        Returns:
        the Segment1D, never null.
        Since:
        4.0
      • computeGeoLocationForDistance

        protected final void computeGeoLocationForDistance​(double desired_distance,
                                                           double shifting,
                                                           Point2D<?,​?> geoLocation,
                                                           Vector2D<?,​?> tangent)
        Replies the geo-location of the point described by the specified distance. The desired distance is 0 for the starting point and getLength() for the ending point.
        Parameters:
        desired_distance - is the distance for which the geo location must be computed.
        shifting - is the shifting distance.
        geoLocation - is the point to set with geo-localized coordinates.
        tangent - is the vector which will be set by the coordinates of the tangent at the replied point. If null the tangent will not be computed.