Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ScaledNoder"/> class.
 /// </summary>
 /// <param name="noder">The noder to use</param>
 /// <param name="scaleFactor">The scale factor to use</param>
 public ScaledNoder(INoder noder, double scaleFactor)
 {
     _noder       = noder;
     _scaleFactor = scaleFactor;
     // no need to scale if input precision is already integral
     _isScaled = !IsIntegerPrecision;
 }
Exemple #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="noder"></param>
 /// <param name="scaleFactor"></param>
 /// <param name="offsetX"></param>
 /// <param name="offsetY"></param>
 public ScaledNoder(INoder noder, double scaleFactor, double offsetX, double offsetY)
 {
     this.noder       = noder;
     this.scaleFactor = scaleFactor;
     // no need to scale if input precision is already integral
     isScaled = !isIntegerPrecision;
 }
Exemple #3
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="noder"></param>
 /// <param name="scaleFactor"></param>
 /// <param name="offsetX"></param>
 /// <param name="offsetY"></param>
 public ScaledNoder(INoder noder, double scaleFactor, double offsetX, double offsetY) 
 {
     this.noder = noder;
     this.scaleFactor = scaleFactor;
     // no need to scale if input precision is already integral
     isScaled = ! isIntegerPrecision;
 }
Exemple #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="noder"></param>
 /// <param name="scaleFactor"></param>
 /// <param name="offsetX"></param>
 /// <param name="offsetY"></param>
 public ScaledNoder(INoder noder, double scaleFactor, double offsetX, double offsetY)
 {
     _offsetX = offsetX;
     _offsetY = offsetY;
     _noder = noder;
     _scaleFactor = scaleFactor;
     // no need to scale if input precision is already integral
     _isScaled = !IsIntegerPrecision;
 }
Exemple #5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="noder"></param>
 /// <param name="scaleFactor"></param>
 /// <param name="offsetX"></param>
 /// <param name="offsetY"></param>
 public ScaledNoder(INoder noder, double scaleFactor, double offsetX, double offsetY)
 {
     _offsetX     = offsetX;
     _offsetY     = offsetY;
     _noder       = noder;
     _scaleFactor = scaleFactor;
     // no need to scale if input precision is already integral
     _isScaled = !IsIntegerPrecision;
 }
Exemple #6
0
        /// <summary>
        /// Computes a union of a single geometry using a custom noder.
        /// <para/>
        /// The primary use of this is to support coverage union.
        /// Because of this the overlay is performed using strict mode.
        /// </summary>
        /// <param name="geom">The geometry to union</param>
        /// <param name="pm">The precision model to use (maybe be <c>null</c>)</param>
        /// <param name="noder">The noder to use</param>
        /// <returns>the result geometry</returns>
        /// <seealso cref="CoverageUnion"/>
        internal static Geometry Union(Geometry geom, PrecisionModel pm, INoder noder)
        {
            var ov = new OverlayNG(geom, null, pm, SpatialFunction.Union);

            ov.Noder      = noder;
            ov.StrictMode = true;
            var geomOv = ov.GetResult();

            return(geomOv);
        }
Exemple #7
0
        /// <summary>
        /// Computes an overlay operation on the given geometry operands,
        /// using a supplied <see cref="INoder"/>.
        /// </summary>
        /// <param name="geom0">The first geometry argument</param>
        /// <param name="geom1">The second geometry argument</param>
        /// <param name="opCode">The code for the desired overlay operation</param>
        /// <param name="noder">The noder to use</param>
        /// <returns>The result of the overlay operation</returns>
        public static Geometry Overlay(Geometry geom0, Geometry geom1,
                                       SpatialFunction opCode, INoder noder)
        {
            var ov = new OverlayNG(geom0, geom1, null, opCode);

            ov.Noder = noder;
            var geomOv = ov.GetResult();

            return(geomOv);
        }
Exemple #8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="bufferSegStrList"></param>
        /// <param name="precisionModel"></param>
        private void ComputeNodedEdges(IList bufferSegStrList, IPrecisionModel precisionModel)
        {
            INoder noder = GetNoder(precisionModel);

            noder.ComputeNodes(bufferSegStrList);
            IList nodedSegStrings = noder.GetNodedSubstrings();

            foreach (object obj in nodedSegStrings)
            {
                SegmentString segStr   = (SegmentString)obj;
                Label         oldLabel = (Label)segStr.Data;
                Edge          edge     = new Edge(segStr.Coordinates, new Label(oldLabel));
                InsertEdge(edge);
            }
        }
Exemple #9
0
        private static INoder CreateFloatingPrecisionNoder(bool doValidation)
        {
            var mcNoder = new MCIndexNoder();
            var li      = new RobustLineIntersector();

            mcNoder.SegmentIntersector = new IntersectionAdder(li);

            INoder noder = mcNoder;

            if (doValidation)
            {
                noder = new ValidatingNoder(mcNoder);
            }
            return(noder);
        }
Exemple #10
0
		private void ComputeNodedEdges(IList bufferSegStrList, PrecisionModel precisionModel)
		{
            INoder noder = CreateNoder(precisionModel);
            noder.ComputeNodes(bufferSegStrList);

            IList nodedSegStrings = noder.NodedSubstrings;
	
            int nCount = nodedSegStrings.Count;
			for (int i = 0; i < nCount; i++)
			{
				SegmentString segStr = (SegmentString)nodedSegStrings[i];
                Label oldLabel       = (Label)segStr.Data;
                Edge edge = new Edge(segStr.Coordinates, new Label(oldLabel));

				InsertEdge(edge);
			}
		}
Exemple #11
0
        /**
         * Runs a noder on one or two sets of input geometries
         * and validates that the result is fully noded.
         *
         * @param geom1 a geometry
         * @param geom2 a geometry, which may be null
         * @param noder the noder to use
         * @return the fully noded linework
         *
         * @throws TopologyException
         */
        public static Geometry NodeValidated(Geometry geom1, Geometry geom2, INoder noder)
        {
            var lines = new List <Geometry>(LineStringExtracter.GetLines(geom1));

            if (geom2 != null)
            {
                lines.AddRange(LineStringExtracter.GetLines(geom2));
            }
            var ssList = ToSegmentStrings(lines);

            var noderValid = new ValidatingNoder(noder);

            noderValid.ComputeNodes(ssList);
            var nodedList = noder.GetNodedSubstrings();

            var result = ToLines(nodedList, geom1.Factory);

            return(result);
        }
Exemple #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ScaledNoder"/> class.
 /// </summary>
 /// <param name="noder"></param>
 /// <param name="scaleFactor"></param>
 public ScaledNoder(INoder noder, double scaleFactor)
     : this(noder, scaleFactor, 0, 0)
 {
 }
Exemple #13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ScaledNoder"/> class.
 /// </summary>
 /// <param name="noder"></param>
 /// <param name="scaleFactor"></param>
 public ScaledNoder(INoder noder, double scaleFactor) 
     : this(noder, scaleFactor, 0, 0) { }      
 /// <summary>
 /// Creates a noding validator wrapping the given <paramref name="noder"/>
 /// </summary>
 /// <param name="noder">The noder to validate</param>
 public ValidatingNoder(INoder noder)
 {
     this._noder = noder;
 }
Exemple #15
0
 /// <summary>
 /// Creates a new builder, with an optional custom noder.
 /// If the noder is not provided, a suitable one will
 /// be used based on the supplied precision model.
 /// </summary>
 /// <param name="pm">The precision model to use</param>
 /// <param name="noder">An optional noder to use (may be null)</param>
 public EdgeNodingBuilder(PrecisionModel pm, INoder noder)
 {
     _pm          = pm;
     _customNoder = noder;
 }