public XmlTestFactory(PrecisionModel pm, IGeometryOperation geometryOperation, IResultMatcher resultMatcher)
 {
     ObjGeometryFactory = new GeometryFactory(pm);
     _geometryOperation = geometryOperation;
     _resultMatcher = resultMatcher;
     _objReader = new WKTOrWKBReader(ObjGeometryFactory);
 }
        public void TestMakePrecise()
        {
            var pm10 = new PrecisionModel(0.1);

            PreciseCoordinateTester(pm10, 1200.4, 1240.4, 1200, 1240);
            PreciseCoordinateTester(pm10, 1209.4, 1240.4, 1210, 1240);
        }
        public static IGeometry ReducePrecisionPointwise(IGeometry geom, double scaleFactor)
        {
            var pm = new PrecisionModel(scaleFactor);

            var reducedGeom = GeometryPrecisionReducer.Reduce(geom, pm);

            return reducedGeom;
        }
 /// <summary>Reduces precision pointwise, then snap-rounds.
 /// <para/>
 /// Note that output set may not contain non-unique linework
 /// (and thus cannot be used as input to Polygonizer directly).
 /// <c>UnaryUnion</c> is one way to make the linework unique.
 /// </summary>
 /// <param name="geom">A Geometry containing linework to node</param>
 /// <param name="scaleFactor">The precision model scale factor to use</param>
 /// <returns>The noded, snap-rounded linework</returns>
 public static IGeometry SnapRoundLines(
     IGeometry geom, double scaleFactor)
 {
     var pm = new PrecisionModel(scaleFactor);
     var gsr = new GeometrySnapRounder(pm);
     gsr.LineworkOnly =true;
     var snapped = gsr.Execute(geom);
     return snapped;
 }
        public void TestMakePreciseNegative()
        {
            var pm1 = new PrecisionModel(1);

            PreciseCoordinateTester(pm1, -10, -10, -10, -10);
            PreciseCoordinateTester(pm1, -9.9, -9.9, -10, -10);
            
            //We use "Asymmetric Arithmetic Rounding", that's is why this is true:
            PreciseCoordinateTester(pm1, -9.5, -9.5, -9, -9);
        }
        public static IGeometry MCIndexNodingWithPrecision(IGeometry geom, double scaleFactor)
        {
            IPrecisionModel fixedPM = new PrecisionModel(scaleFactor);

            LineIntersector li = new RobustLineIntersector();
            li.PrecisionModel = fixedPM;

            INoder noder = new MCIndexNoder(new IntersectionAdder(li));
            noder.ComputeNodes(SegmentStringUtil.ExtractNodedSegmentStrings(geom));
            return SegmentStringUtil.ToGeometry(noder.GetNodedSubstrings(), geom.Factory);
        }
        public void large_decimals_are_formatted_properly()
        {
            const string expected = "123456789012345680";
            const decimal m = 123456789012345680;

            IPrecisionModel precisionModel = new PrecisionModel(1E9);
            NumberFormatInfo formatter = CreateFormatter(precisionModel);
            string format = "0." + StringOfChar('#', formatter.NumberDecimalDigits);
            string actual = m.ToString(format, formatter);
            Assert.That(actual, Is.EqualTo(expected));
        }
        public GeometryPrecisionReducerTest()
        {
            pmFloat = new PrecisionModel();
            pmFixed1 = new PrecisionModel(1);
            reducer = new GeometryPrecisionReducer(pmFixed1);
            reducerKeepCollapse = new GeometryPrecisionReducer(pmFixed1);

            gfFloat = new GeometryFactory(pmFloat, 0);
            reader = new WKTReader(gfFloat);

            reducerKeepCollapse.RemoveCollapsedComponents = false;
        }
		public virtual void  Intersection(string wktA, string wktB, PrecisionModel pm)
		{
			Console.WriteLine("Running example using Precision Model = " + pm);
			GeometryFactory fact = new GeometryFactory(pm);
			WKTReader wktRdr = new WKTReader(fact);
			
			IGeometry A = wktRdr.Read(wktA);
			IGeometry B = wktRdr.Read(wktB);
			IGeometry C = A.Intersection(B);
			
			Console.WriteLine("A intersection B = " + C);
		}
        public static IGeometry NodeWithPointwisePrecision(IGeometry geom, double scaleFactor)
        {
            var pm = new PrecisionModel(scaleFactor);

            var roundedGeom = GeometryPrecisionReducer.Reduce(geom, pm);

            var geomList = new List<IGeometry>();
            geomList.Add(roundedGeom);

            var noder = new GeometryNoder(pm);
            var lines = noder.Node(geomList);

            return Utility.FunctionsUtil.getFactoryOrDefault(geom).BuildGeometry(CollectionUtil.Cast<IGeometry>((ICollection)lines));
        }
        public void large_doubles_arent_formatted_properly()
        {
            /*
             * http://stackoverflow.com/questions/2105096/why-is-tostring-rounding-my-double-value
             * 
             * By default, the return value only contains 15 digits of precision although a maximum of 17 digits is maintained internally. 
             */
            const string expected = "123456789012345680";
            const double d = 123456789012345680;

            IPrecisionModel precisionModel = new PrecisionModel(1E9);
            NumberFormatInfo formatter = CreateFormatter(precisionModel);
            string format = "0." + StringOfChar('#', formatter.NumberDecimalDigits);
            string actual = d.ToString(format, formatter);
            Assert.That(actual, Is.Not.EqualTo(expected));
        }
        /// <summary>
        /// Imports a shapefile into a database table.
        /// </summary>
        /// <remarks>
        /// This method assumes a table has already been crated in the database.
        /// Calling this method does not close the connection that is passed in.
        /// </remarks>
        /// <param name="filename"></param>
        /// <param name="connectionstring"></param>
        /// <param name="tableName"></param>
        /// <returns></returns>
        public static int ImportShapefile(string filename, string connectionstring, string tableName)
        {
            using (SqlConnection connection = new SqlConnection(connectionstring))
            {
                int rowsAdded = -1;
                PrecisionModel pm = new PrecisionModel();
                GeometryFactory geometryFactory = new GeometryFactory(pm, -1);

                DataTable shpDataTable = CreateDataTable(filename, tableName, geometryFactory);
                string createTableSql = CreateDbTable(shpDataTable, true);

                SqlCommand createTableCommand = new SqlCommand(createTableSql, connection);
                connection.Open();
                createTableCommand.ExecuteNonQuery();

                string sqlSelect = String.Format("select * from {0}", tableName);
                SqlDataAdapter selectCommand = new SqlDataAdapter(sqlSelect, connection);

                // use a data adaptor - saves donig the inserts ourselves
                SqlDataAdapter dataAdapter = new SqlDataAdapter();
                dataAdapter.SelectCommand = new SqlCommand(sqlSelect, connection);
                SqlCommandBuilder custCB = new SqlCommandBuilder(dataAdapter);
                DataSet ds = new DataSet();

                // fill dataset
                dataAdapter.Fill(ds, shpDataTable.TableName);

                // copy rows from our datatable to the empty table in the DataSet
                int i = 0;
                foreach (DataRow row in shpDataTable.Rows)
                {
                    DataRow newRow = ds.Tables[0].NewRow();
                    newRow.ItemArray = row.ItemArray;
                    //gotcha! - new row still needs to be added to the table.
                    //NewRow() just creates a new row with the same schema as the table. It does
                    //not add it to the table.
                    ds.Tables[0].Rows.Add(newRow);
                    i++;
                }

                // update all the rows in batch
                rowsAdded = dataAdapter.Update(ds, shpDataTable.TableName);
                int iRows = shpDataTable.Rows.Count;
                Debug.Assert(rowsAdded != iRows, String.Format("{0} of {1] rows were added to the database.", rowsAdded, shpDataTable.Rows.Count));
                return rowsAdded;
            }
        }
        public static IGeometry SnapRound(
            IGeometry geomA, IGeometry geomB,
            double scaleFactor)
        {
            var pm = new PrecisionModel(scaleFactor);

            var geom = geomA;

            if (geomB != null)
            {
                geom = geomA.Factory.CreateGeometryCollection(new IGeometry[] { geomA, geomB });
            }

            GeometrySnapRounder gsr = new GeometrySnapRounder(pm);
            var snapped = gsr.Execute(geom);
            return snapped;
        }
 public void TestWriteLargeNumbers3()
 {
     IPrecisionModel precisionModel = new PrecisionModel(1E9);
     IGeometryFactory geometryFactory = new GeometryFactory(precisionModel, 0);
     IPoint point1 = geometryFactory.CreatePoint(new Coordinate(123456789012345678000000E9d, 10E9));
     Assert.AreEqual(123456789012345690000000000000000d, point1.X);
     Assert.AreEqual(10000000000d, point1.Y);
     Assert.AreNotEqual("POINT (123456789012345690000000000000000 10000000000)", point1.AsText());
     Assert.AreEqual("POINT (123456789012346000000000000000000 10000000000)", point1.AsText());
 }
 public void TestParameterlessConstructor()
 {
     var p = new PrecisionModel();
     //Implicit precision model has scale 0
     Assert.AreEqual(0, p.Scale, 1E-10);
 }
 /// <summary>
 /// Copy constructor to create a new <c>PrecisionModel</c>
 /// from an existing one.
 /// </summary>
 /// <param name="pm"></param>
 public PrecisionModel(PrecisionModel pm)
 {
     _modelType = pm._modelType;
     _scale     = pm._scale;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="NtsProvider"/> class
 /// from another <see cref="IFeatureProvider" />.
 /// </summary>
 /// <param name="provider">
 /// The base <see cref="IFeatureProvider"/>
 /// from witch initialize the <see cref="NtsProvider"/> instance.
 /// </param>
 /// <param name="operation">
 /// The <see cref="GeometryOperationDelegate"/> to apply
 /// to all geometry elements in the <paramref name="provider"/>.
 /// </param>
 /// <param name="precisionModel">
 /// The <see cref="NetTopologySuite.Geometries.PrecisionModel"/>
 /// to use for define the precision of the geometry operations.
 /// </param>
 /// <seealso cref="PrecisionModels"/>
 /// <seealso cref="NetTopologySuite.Geometries.GeometryFactory"/>
 public NtsProvider(IFeatureProvider provider, GeometryOperationDelegate operation,
                    NetTopologySuite.Geometries.PrecisionModel precisionModel) : this(provider, precisionModel)
 {
     operation(features);
 }
Exemple #18
0
 /// <summary>
 /// Constructs a GeometryFactory that generates Geometries having the given
 /// <c>PrecisionModel</c> and spatial-reference ID, and the default CoordinateSequence
 /// implementation.
 /// </summary>
 /// <param name="precisionModel">The PrecisionModel to use.</param>
 /// <param name="srid">The SRID to use.</param>
 public GeometryFactory(PrecisionModel precisionModel, int srid) :
     this(precisionModel, srid, GetDefaultCoordinateSequenceFactory())
 {
 }
 public void TestWriteLargeNumbers2()
 {
     IPrecisionModel precisionModel = new PrecisionModel(1E9);
     IGeometryFactory geometryFactory = new GeometryFactory(precisionModel, 0);
     IPoint point1 = geometryFactory.CreatePoint(new Coordinate(1234d, 10E9));
     Assert.AreEqual("POINT (1234 10000000000)", point1.AsText());
 }
 ///<summary>
 /// Convenience method for doing precision reduction on a single geometry,
 /// with collapses removed and keeping the geometry precision model the same.
 ///</summary>
 /// <returns>The reduced geometry</returns>
 public static IGeometry Reduce(IGeometry g, PrecisionModel precModel)
 {
     var reducer = new SimpleGeometryPrecisionReducer(precModel);
     return reducer.Reduce(g);
 }
Exemple #21
0
 public NtsPrecisionModel(PrecisionModelType modelType, int scale)
 {
     WrappedPrecisionModel = new PrecisionModel(scale);
 }
        public void TestML()
        {
            {
                const double scale = 2.0E10;
                IPrecisionModel precisionModel = new PrecisionModel(scale);
                IGeometryFactory geometryFactory = new GeometryFactory(precisionModel);

                var reader = new WKTReader(geometryFactory);
                var lineStringA = (ILineString)
                    reader.Read("LINESTRING (-93.40178610435 -235.5437531975, -401.24229900825 403.69365857925)");
                var lineStringB = (ILineString)
                    reader.Read("LINESTRING (-50.0134121926 -145.44686640725, -357.8539250965 493.7905453695)");
                var lineStringC = (ILineString)
                    reader.Read("LINESTRING (-193.8964147753 -30.64653554935, -186.68866383205 -34.1176054623)");

                var middlePoint = (IPoint) reader.Read("POINT (-203.93366864454998 174.171839481125)");

                var lineStrings = new List<ILineString>();
                lineStrings.Add(lineStringA);
                lineStrings.Add(lineStringB);
                lineStrings.Add(lineStringC);

                var noder = new GeometryNoder(geometryFactory.PrecisionModel);
                var nodedLineStrings = noder.Node(lineStrings.ToArray());

                var shortestDistanceToPointBeforeNoding = double.MaxValue;

                foreach (var lineString in lineStrings)
                {
                    shortestDistanceToPointBeforeNoding = Math.Min(lineString.Distance(middlePoint),
                                                                   shortestDistanceToPointBeforeNoding);
                }

                var shortestDistanceToPointAfterNoding = Double.MaxValue;

                foreach (var lineString in nodedLineStrings)
                {
                    shortestDistanceToPointAfterNoding = Math.Min(lineString.Distance(middlePoint),
                                                                  shortestDistanceToPointAfterNoding);
                }

                var difference = Math.Abs(shortestDistanceToPointAfterNoding - shortestDistanceToPointBeforeNoding);


                Console.WriteLine("Scale: {0}", scale);
                Console.WriteLine("Distance to point before noding: {0}", shortestDistanceToPointBeforeNoding);
                Console.WriteLine("Distance to point after noding:  {0}", shortestDistanceToPointAfterNoding);
                Console.WriteLine("Difference is {0} and should be lesser than {1}", difference, 1.0/scale);

                const double roughTolerance = 10.0;
                Assert.IsTrue(difference < roughTolerance, "this difference should should be lesser than " + 1.0/scale);

            }
        }
        public bool LoadFile(string fileName)
        {
            if (!File.Exists(fileName))
            {
                throw new ArgumentException(fileName, 
                    "The file does not exits or the 'fileName' is not valid.");
            }

            try
            {
                XmlDocument xmldoc = new XmlDocument();

                xmldoc.Load(fileName);

                XmlElement root = xmldoc.DocumentElement;

                // Retrieve the "desc" tag, if any.
                XmlNode desc = root["desc"];
                string strTestDescription = String.Empty;
                if (desc != null && desc.InnerText.Length > 0)
                {
                    strTestDescription = desc.InnerText;
                }
                else
                {
                    strTestDescription = Path.GetFileNameWithoutExtension(fileName);
                }

                // Retrieve the "workspace", if any.
                XmlNode workspace = root["workspace"];
                if (workspace != null)
                {  
                    XmlAttributeCollection workspaceAttributes = workspace.Attributes;
                    if (workspaceAttributes != null && workspaceAttributes.Count > 0)
                    {
                        m_strTestWorkspace = workspaceAttributes["dir"].InnerText;
                    }
                }

                // Retrieve the "tolerance" attribute, if any.
                XmlNode tolerance = root["tolerance"];

                double dTolerance = 0.0;
                if (tolerance != null)
                {
                    string strTolerance = tolerance.InnerText;
                    try
                    {
                        dTolerance = Double.Parse(strTolerance, GetNumberFormatInfo());
                    }
                    catch (Exception ex)
                    {
                        XmlTestExceptionManager.Publish(ex);
                    }
                }

                // Retrieve the precisionName" tag, if any.
                PrecisionModel pm = null;
                XmlNode precision = root["precisionModel"];
                if (precision != null)
                {
                    XmlAttributeCollection precisionAttributes = precision.Attributes;
                    if (precisionAttributes != null && precisionAttributes.Count > 0)
                    {

                        XmlAttribute attribute = precisionAttributes["type"];
                        if (attribute != null)
                        {
                            string strPrecision = attribute.InnerText;

                            if (strPrecision == "FIXED" && precisionAttributes.Count == 4)
                            {
                                try
                                {
                                    double scale   =
                                        Double.Parse(precisionAttributes["scale"].InnerText, GetNumberFormatInfo());
                                    double offsetx =
                                        Double.Parse(precisionAttributes["offsetx"].InnerText, GetNumberFormatInfo());
                                    double offsety =
                                        Double.Parse(precisionAttributes["offsety"].InnerText, GetNumberFormatInfo());

                                    pm = new PrecisionModel(scale);
                                }
                                catch (Exception ex)
                                {
                                    XmlTestExceptionManager.Publish(ex);
                                }
                            }
                            else
                            {
                                pm = new PrecisionModel();
                            }
                        }
                        else
                        {
                            if (precisionAttributes.Count == 3)
                            {
                                double scale   =
                                    Double.Parse(precisionAttributes["scale"].InnerText, GetNumberFormatInfo());
                                double offsetx =
                                    Double.Parse(precisionAttributes["offsetx"].InnerText, GetNumberFormatInfo());
                                double offsety =
                                    Double.Parse(precisionAttributes["offsety"].InnerText, GetNumberFormatInfo());
 
                                pm = new PrecisionModel(scale);
                            }
                        }
                   }
                }

                if (pm == null)
                {
                    pm = new PrecisionModel();
                }

                IGeometryOperation geometryOperation = null;
                XmlNode go = root["geometryOperation"];
                if (go != null)
                {
                    go = go.FirstChild;
                    switch (go.Value)
                    {
                        case "com.vividsolutions.jtstest.geomop.PreparedGeometryOperation":
                            geometryOperation = new PreparedGeometryOperation();
                            break;
                        case "com.vividsolutions.jtstest.geomop.BufferValidatedGeometryOperation":
                            geometryOperation = new BufferValidatedGeometryOperation();
                            break;
                        case "com.vividsolutions.jtstest.geomop.OverlayValidatedGeometryOperation":
                            geometryOperation = new OverlayValidatedGeometryOperation();
                            break;
                            
                        default:
                            Console.WriteLine(string.Format("\n *** {0} *** \n", go.Value));
                            Console.ReadKey(true);
                            geometryOperation = new GeometryMethodOperation();
                            break;
                    }
                }

                IResultMatcher resultMatcher = null;
                XmlNode rm = root["resultMatcher"];
                if (rm != null)
                {
                    rm = rm.FirstChild;
                    if (rm.Value.EndsWith("BufferResultMatcher", StringComparison.InvariantCultureIgnoreCase))
                        resultMatcher = new BufferResultMatcher();
                    else
                    {
                        throw new NotSupportedException();
                    }
                }

                m_objFactory   = new XmlTestFactory(pm, geometryOperation, resultMatcher);
                m_listCurTests = new XmlTestCollection();

                m_listCurTests.Name = strTestDescription;

                // Now, handle the "case" nodes
                XmlNodeList elemList = xmldoc.GetElementsByTagName("case");
                for (int i = 0; i < elemList.Count; i++)
                {   
                    ParseCaseNode(elemList[i], dTolerance);
                }

                m_listarrTests.Add(m_listCurTests);

                return true;
            }
            catch (Exception ex)
            {
                XmlTestExceptionManager.Publish(ex);
                return false;
            }
        }
 public ConvexHullTest()
 {
     IPrecisionModel precisionModel = new PrecisionModel(1000);
     _geometryFactory = new GeometryFactory(precisionModel, 0);
     _reader = new WKTReader(_geometryFactory);
 }
 public void TestReadLargeNumbers()
 {
     var precisionModel = new PrecisionModel(1E9);
     var geometryFactory = new GeometryFactory(precisionModel, 0);
     var reader = new WKTReader(geometryFactory);
     var point1 = reader.Read("POINT (123456789.01234567890 10)");
     var point2 = geometryFactory.CreatePoint(new Coordinate(123456789.01234567890, 10));
     Assert.AreEqual(point1.Coordinate.X, point2.Coordinate.X, 1E-7);
     Assert.AreEqual(point1.Coordinate.Y, point2.Coordinate.Y, 1E-7);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="NtsProvider"/> class
 /// using the given <paramref name="precisionModel"/>.
 /// </summary>
 /// <param name="precisionModel">
 /// The <see cref="NetTopologySuite.Geometries.PrecisionModel"/>
 /// to use for define the precision of the geometry operations.
 /// </param>
 /// <seealso cref="PrecisionModels"/>
 /// <seealso cref="NetTopologySuite.Geometries.GeometryFactory"/>
 protected internal NtsProvider(NetTopologySuite.Geometries.PrecisionModel precisionModel)
 {
     geometryFactory = new NetTopologySuite.Geometries.GeometryFactory(precisionModel);
 }
        private static void DoPerformancesTest(int times)
        {
            const double d = 123456789;
            Stopwatch w = Stopwatch.StartNew();
            for (int i = 0; i < times; i++)
            {
                string s = DoubleConverter.ToExactString(d + i);
                Assert.IsNotNull(s);
            }
            w.Stop();
            TimeSpan usingDc = w.Elapsed;

            IPrecisionModel precisionModel = new PrecisionModel(1E9);
            NumberFormatInfo formatter = CreateFormatter(precisionModel);
            string format = "0." + StringOfChar('#', formatter.NumberDecimalDigits);
            w = Stopwatch.StartNew();
            for (int i = 0; i < times; i++)
            {
                string s = d.ToString(format, formatter);
                Assert.IsNotNull(s);
            }
            w.Stop();
            TimeSpan usingDef = w.Elapsed;

            if (usingDc <= usingDef)
                return;
            TimeSpan diff = usingDc - usingDef;
            Console.WriteLine("slower for {0}: {1} seconds", times, diff.TotalSeconds);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="SimpleSnapRounder"/> class.
 /// </summary>
 /// <param name="pm">The <see cref="PrecisionModel" /> to use.</param>
 public SimpleSnapRounder(PrecisionModel pm)
 {
     _li = new RobustLineIntersector { PrecisionModel = pm };
     _scaleFactor = pm.Scale;
 }
Exemple #29
0
 public OgcCompliantGeometryFactory(PrecisionModel pm, int srid)
     : base(pm, srid)
 {
 }
 /// <summary>
 ///
 /// </summary>
 /// <param name="pm"></param>
 public SimpleGeometryPrecisionReducer(PrecisionModel pm)
 {
     _newPrecisionModel = pm;
 }
Exemple #31
0
 public OgcCompliantGeometryFactory(PrecisionModel pm, int srid, CoordinateSequenceFactory factory)
     : base(pm, srid, factory)
 {
 }
Exemple #32
0
        private void BufferReducedPrecision(int precisionDigits)
        {
            double sizeBasedScaleFactor = PrecisionScaleFactor(_argGeom, _distance, precisionDigits);
            //    System.out.println("recomputing with precision scale factor = " + sizeBasedScaleFactor);

            var fixedPrecModel = new PrecisionModel(sizeBasedScaleFactor);
            BufferFixedPrecision(fixedPrecModel);
        }
 /// <summary>
 /// Runs a ScaledNoder on input.
 /// Input vertices should be rounded to precision model.
 /// </summary>
 /// <param name="geom"></param>
 /// <param name="scaleFactor"></param>
 /// <returns>The noded geometry</returns>
 public static IGeometry ScaledNoding(IGeometry geom, double scaleFactor)
 {
     var segs = CreateSegmentStrings(geom);
     var fixedPM = new PrecisionModel(scaleFactor);
     var noder = new ScaledNoder(new MCIndexSnapRounder(new PrecisionModel(1.0)),
         fixedPM.Scale);
     noder.ComputeNodes(segs);
     var nodedSegStrings = noder.GetNodedSubstrings();
     return SegmentStringUtil.ToGeometry(nodedSegStrings, geom.Factory);
 }
Exemple #34
0
 /// <summary>
 /// Constructs a GeometryFactory that generates Geometries having the given
 /// PrecisionModel, spatial-reference ID, and CoordinateSequence implementation.
 /// </summary>
 public GeometryFactory(PrecisionModel precisionModel, int srid, CoordinateSequenceFactory coordinateSequenceFactory)
 {
     _precisionModel            = precisionModel;
     _coordinateSequenceFactory = coordinateSequenceFactory;
     _srid = srid;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="NtsProvider"/> class
 /// from another <see cref="IFeatureProvider" />.
 /// </summary>
 /// <param name="provider">
 /// The base <see cref="IFeatureProvider"/>
 /// from witch initialize the <see cref="NtsProvider"/> instance.
 /// </param>
 /// <param name="precisionModel">
 /// The <see cref="NetTopologySuite.Geometries.PrecisionModel"/>
 /// to use for define the precision of the geometry operations.
 /// </param>
 /// <seealso cref="PrecisionModels"/>
 /// <seealso cref="NetTopologySuite.Geometries.GeometryFactory"/>
 public NtsProvider(IFeatureProvider provider,
                    NetTopologySuite.Geometries.PrecisionModel precisionModel) : this(precisionModel)
 {
     BuildFromProvider(provider);
 }
 /// <summary>
 /// Copy constructor to create a new <c>PrecisionModel</c>
 /// from an existing one.
 /// </summary>
 /// <param name="pm"></param>
 public PrecisionModel(PrecisionModel pm)
 {
     _modelType = pm._modelType;
     _scale = pm._scale;
 }
Exemple #37
0
 /// Creates an instance of this class using the default
 /// values for <see cref="GeometryFactory.SRID"/>,
 /// <see cref="GeometryFactory.CoordinateSequenceFactory"/> but the
 /// specified <paramref name="pm"/>.
 public OgcCompliantGeometryFactory(PrecisionModel pm)
     : base(pm)
 {
 }
        void RunRounding(string[] wkt)
        {
            var geoms = FromWKT(wkt);
            PrecisionModel pm = new PrecisionModel(SnapTolerance);
            GeometryNoder noder = new GeometryNoder(pm);
            noder.IsValidityChecked = true;
            var nodedLines = noder.Node(geoms);
            
            foreach ( var ls in nodedLines)
                Console.WriteLine(ls);

            Assert.IsTrue(IsSnapped(nodedLines, SnapTolerance));
            
        }
 public DistanceTest()
 {
     _precisionModel = new PrecisionModel(1);
     _geometryFactory = new GeometryFactory(_precisionModel, 0);
     _reader = new WKTReader(_geometryFactory);
 }