private SegmentString FindMatching(OrientedCoordinateArray oca,
                                           SegmentString segString)
        {
            SegmentString matchSS = (SegmentString)ocaMap[oca];

            return(matchSS);
        }
Example #2
0
        /// <summary>
        /// Compares two {@link OrientedCoordinateArray}s for their relative order
        ///
        /// </summary>
        /// <returns> -1 this one is smaller
        /// </returns>
        /// <returns> 0 the two objects are equal
        /// </returns>
        /// <returns> 1 this one is greater
        /// </returns>
        public int CompareTo(System.Object o1)
        {
            OrientedCoordinateArray oca = (OrientedCoordinateArray)o1;
            int comp = CompareOriented(pts, orientation,
                                       oca.pts, oca.orientation);

            return(comp);
        }
        /// <summary> Dissolve the given <see cref="SegmentString"/>.
        ///
        /// </summary>
        /// <param name="segString">the string to dissolve
        /// </param>
        public void Dissolve(SegmentString segString)
        {
            OrientedCoordinateArray oca = new OrientedCoordinateArray(
                segString.Coordinates);
            SegmentString existing = FindMatching(oca, segString);

            if (existing == null)
            {
                Add(oca, segString);
            }
            else
            {
                if (merger != null)
                {
                    bool isSameOrientation = Equals(existing.Coordinates,
                                                    segString.Coordinates);

                    merger.Merge(existing, segString, isSameOrientation);
                }
            }
        }
 private void Add(OrientedCoordinateArray oca,
                  SegmentString segString)
 {
     ocaMap[oca] = segString;
 }