コード例 #1
0
		internal virtual void Run()
		{
			WKTReader rdr = new WKTReader();
			IList lines = new ArrayList();
			
			lines.Add(rdr.Read("LINESTRING (0 0 , 10 10)"));            // isolated edge
            lines.Add(rdr.Read("LINESTRING (185 221, 100 100)"));       //dangling edge
            lines.Add(rdr.Read("LINESTRING (185 221, 88 275, 180 316)"));
            lines.Add(rdr.Read("LINESTRING (185 221, 292 281, 180 316)"));
            lines.Add(rdr.Read("LINESTRING (189 98, 83 187, 185 221)"));
            lines.Add(rdr.Read("LINESTRING (189 98, 325 168, 185 221)"));
			
			Polygonizer polygonizer = new Polygonizer();
			polygonizer.Add(lines);
			
			ICollection polys = polygonizer.Polygons;
			
			Console.WriteLine("Polygons formed (" + polys.Count + "):");
            foreach(object obj in polys)
			    Console.WriteLine(obj);
		}
コード例 #2
0
ファイル: Polygonizer.cs プロジェクト: lishxi/_SharpMap
 /// <summary>
 /// 
 /// </summary>
 /// <param name="container"></param>
 public LineStringAdder(Polygonizer container)
 {
     this.container = container;
 }
コード例 #3
0
ファイル: IsValidTest.cs プロジェクト: ExRam/DotSpatial-PCL
        public void IsPointInRingTest()
        {
            const string wkt1 =
                @"LINESTRING(159084.138183715 215384.465334836,159085.255551952 
215382.299118879,159084.287081382 215380.125720536,159081.909029527 
215380.063184668,159080.685184241 215382.030015885,159081.870080819 
215384.260803017,159084.138183715 215384.465334836)";
            const string wkt2 =
                @"LINESTRING(159081.417 215432.901,159081.484 215412.286,159069.343 
215411.729,159063.929 215411.79,159063.765 215441.011,159055.84 
215440.909,159055.756 215439.794,159050.254 215439.759,159050.231 
215426.571,159029.91 215426.438,159029.894 215420.862,159028.749 
215420.841,159028.787 215412.904,159050.376 215412.995,159050.394 
215404.475,159051.839 215404.512,159051.721 215397.907,159050.448 
215397.876,159050.48 215385.756,159037.29 215385.669,159037.274 
215380.139,159036.129 215380.118,159036.18 215372.161,159050.58 
215372.256,159050.641 215357.846,159061.806 215357.884,159061.764 
215355.578,159063.703 215355.583,159063.834 215344.331,159062.797 
215344.264,159062.878 215338.481,159063.885 215338.48,159063.94 
215333.569,159062.002 215333.52,159062.061 215329.565,159063.973 
215329.565,159064.019 215324.529,159063.008 215324.569,159062.948 
215318.85,159064.078 215318.847,159064.229 215304.453,159074.999 
215304.543,159074.895 215315.988,159082.789 215316.117,159082.751291265 
215325.067329746,159076.257853729 215325.010585012,159076.145672787 
215330.246673065,159077.726943351 215330.292687136,159077.64265916 
215336.096838446,159075.46670601 215336.028874838,159075.17015073 
215349.460814847,159091.770139291 215349.583804507,159091.835913025 
215356.268745225,159114.649 215356.642,159114.529 215396.632,159109.671 
215396.625,159109.501 215398.902,159112.021 215398.92,159111.982 
215404.407,159112.999 215404.421,159113.001 215412.415,159095.019 
215412.366,159094.928 215434.091,159086.987 215433.984,159086.928 
215432.972,159081.417 215432.901)";
            const string wkt3 = @"LINESTRING(159063.929280482 215399.247659686,159103.333615111 
215398.947801304,159103.342074891 215397.380179598,159101.054815857 
215397.403687265,159101.283398228 215370.145108237,159064.458615271 
215370.009119945,159063.929280482 215399.247659686)";

            var reader = new WKTReader(GeometryFactory.Fixed);
            var wkts = new[] { wkt1, wkt2, wkt3,};            
            var polygonizer = new Polygonizer();
            foreach (var wkt in wkts)
            {
                var geom = (ILineString) reader.Read(wkt);
                Assert.IsNotNull(geom);
                Assert.IsTrue(geom.IsValid);
                Assert.AreEqual(geom.Factory.PrecisionModel, GeometryFactory.Fixed.PrecisionModel);
                polygonizer.Add(geom);
            }

            ICollection polys = polygonizer.Polygons;
            Console.WriteLine("Polygons formed (" + polys.Count + "):");
            foreach (var obj in polys)
            {
                Assert.IsNotNull(obj);
                Console.WriteLine(obj);
            }
        }
コード例 #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="container"></param>
 public LineStringAdder(Polygonizer container)
 {
     this.container = container;
 }