当前位置: 首页>>代码示例>>C#>>正文


C# GeometryFactory.CreateGeometryCollection方法代码示例

本文整理汇总了C#中Geotools.Geometries.GeometryFactory.CreateGeometryCollection方法的典型用法代码示例。如果您正苦于以下问题:C# GeometryFactory.CreateGeometryCollection方法的具体用法?C# GeometryFactory.CreateGeometryCollection怎么用?C# GeometryFactory.CreateGeometryCollection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Geotools.Geometries.GeometryFactory的用法示例。


在下文中一共展示了GeometryFactory.CreateGeometryCollection方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DisplayTest

		/// <summary>
		/// Writes three geometries to an svg file
		/// </summary>
		/// <param name="filename">The path of the svg file.</param>
		/// <param name="a">The A geometry</param>
		/// <param name="b">The B geometry</param>
		/// <param name="c">The C geometry</param>
		public void DisplayTest(string filename, Geometry a, Geometry b, Geometry c)
		{
			Geotools.Geometries.PrecisionModel pm = new Geotools.Geometries.PrecisionModel(1, 0, 0);
			GeometryFactory fact = new GeometryFactory(pm, 0);
			GeometrySVGWriter svgWriter = new GeometrySVGWriter(fact.PrecisionModel);
			StreamWriter sw = new StreamWriter(filename);
			GeometryCollection geomCollection= fact.CreateGeometryCollection(new Geometry[]{a,b,c});
			double minx, miny, maxx, maxy;
			geomCollection.Extent2D(out minx, out miny, out maxx, out maxy);
			sw.WriteLine(String.Format("<svg viewBox=\"{0} {1} {2} {3}\">",minx,miny,maxx,maxy*1.2));
			svgWriter.Write(a,sw,"fill-rule:evenodd;","fill:none;stroke:blue;stroke-width:1;fill-opacity:0.2");
			svgWriter.Write(b,sw,"fill-rule:evenodd;","fill:none;stroke:red;stroke-width:1;fill-opacity:0.2");
			svgWriter.Write(c,sw,"fill-rule:evenodd;","fill:yellow;stroke:green;stroke-width:2;fill-opacity:0.5;stroke-dasharray:2,2");
			sw.WriteLine("</svg>");
			sw.Close();
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:23,代码来源:SVGFileSaver.cs

示例2: CreateCollection4

        private GeometryCollection CreateCollection4()
        {
            //this is used to prevent having to rewrite this code over & over

            //create a new coordinate
            Coordinate coordinate = new Coordinate();
            //create a new point
            GeometryFactory gf = new GeometryFactory(_precMod, _sRID);
            Point point = gf.CreatePoint(coordinate);
            //create a new geometries array
            Geometry[] geom = new Geometry[10];
            int c = 0;
            //fill with points
            for(int i = 9; i < 19 ; i++)
            {
                //if this isn't here the coordinates for all the points are reset every time the coordinate is reset
                coordinate = new Coordinate();
                //make the x coordinate equal to the iterator
                coordinate.X = (double)i;
                //make the y coordinate equal to the iterator plus 10
                coordinate.Y = (double)i + 10;
                //create a new point to put in the geometry
                point = gf.CreatePoint(coordinate);
                //put the point in the geometies
                geom[c] = point;
                c++;
            }
            //put the geometries into a geometry collection
            GeometryCollection geoColl = gf.CreateGeometryCollection(geom);

            return geoColl;
        }
开发者ID:vmoll,项目名称:geotools,代码行数:32,代码来源:GeometryCollectionTest.cs

示例3: CreateCollection3

        private GeometryCollection CreateCollection3()
        {
            //create a new geometries array
            Geometry[] geom = new Geometry[10];

            Coordinate coordinate = new Coordinate();
            Coordinates coords = new Coordinates();
            GeometryFactory gf = new GeometryFactory(_precMod, _sRID);
            Point point = gf.CreatePoint(coordinate);

            LineString lineString = gf.CreateLineString(coords);

            for(int c = 0; c < 5; c++)
            {
                for(int i = c; i < c+5; i++)
                {
                    //if this isn't here the coordinates for all the points are reset every time the coordinate is reset
                    coordinate = new Coordinate();
                    //make the x coordinate equal to the iterator
                    coordinate.X = (double)i;
                    //make the y coordinate equal to the iterator plus 10
                    coordinate.Y = (double)i + 10;
                    coords.Add(coordinate);
                }
                lineString = gf.CreateLineString(coords);
                geom[c] = lineString;
            }
            for(int i = 5; i < 10; i++)
            {
                //if this isn't here the coordinates for all the points are reset every time the coordinate is reset
                coordinate = new Coordinate();
                //make the x coordinate equal to the iterator
                coordinate.X = (double)i;
                //make the y coordinate equal to the iterator plus 10
                coordinate.Y = (double)i + 10;
                //create a new point to put in the geometry
                point = gf.CreatePoint(coordinate);
                //put the point in the geometies
                geom[i] = point;
            }
            //put the geometries into a geometry collection
            GeometryCollection geoColl = gf.CreateGeometryCollection(geom);

            return geoColl;
        }
开发者ID:vmoll,项目名称:geotools,代码行数:45,代码来源:GeometryCollectionTest.cs

示例4: test_NumPoints

        public void test_NumPoints()
        {
            //create a geomerty collection
            GeometryCollection geoColl = CreateCollection();

            Assertion.AssertEquals("NumPoints-1: ", 10, geoColl.GetNumPoints());

            //now try it with a null geometry collection
            GeometryFactory gf = new GeometryFactory(_precMod, _sRID);
            geoColl = gf.CreateGeometryCollection(null);

            Assertion.AssertEquals("NumPoints-2: ", 0, geoColl.GetNumPoints());

            //now try it with a different geometry collection
            geoColl = CreateCollection2();

            Assertion.AssertEquals("NumPoints-3: ", 1000, geoColl.GetNumPoints());

            //now try it with a mixed geometry collection
            geoColl = CreateCollection3();

            Assertion.AssertEquals("NumPoints-4: ", 130, geoColl.GetNumPoints());
        }
开发者ID:vmoll,项目名称:geotools,代码行数:23,代码来源:GeometryCollectionTest.cs

示例5: test_IsEmpty

        public void test_IsEmpty()
        {
            //create a geomerty collection
            GeometryCollection geoColl = CreateCollection();

            Assertion.AssertEquals("IsEmpty()-1: ", false, geoColl.IsEmpty());

            //now try it with a null geometry collection
            GeometryFactory gf = new GeometryFactory(_precMod, _sRID);
            geoColl = gf.CreateGeometryCollection(null);

            Assertion.AssertEquals("IsEmpty()-2: ", true, geoColl.IsEmpty());

            //now try it with a different geometry collection
            geoColl = CreateCollection2();

            Assertion.AssertEquals("IsEmpty()-3: ", false, geoColl.IsEmpty());

            //now try it with a mixed geometry collection
            geoColl = CreateCollection3();

            Assertion.AssertEquals("IsEmpty()-4: ", false, geoColl.IsEmpty());
        }
开发者ID:vmoll,项目名称:geotools,代码行数:23,代码来源:GeometryCollectionTest.cs

示例6: test_GetBoundaryDimension

        public void test_GetBoundaryDimension()
        {
            //create a geomerty collection
            GeometryCollection geoColl = CreateCollection();

            Assertion.AssertEquals("GetBoundaryDimension-1: ", -1, geoColl.GetBoundaryDimension());

            //now try it with a null geometry collection
            GeometryFactory gf = new GeometryFactory(_precMod, _sRID);
            geoColl = gf.CreateGeometryCollection(null);

            Assertion.AssertEquals("GetBoundaryDimension-2: ", -1, geoColl.GetBoundaryDimension());

            //now try it with a different geometry collection
            geoColl = CreateCollection2();

            Assertion.AssertEquals("GetBoundaryDimension-3: ", 0, geoColl.GetBoundaryDimension());

            //now try it with a mixed geometry collection
            geoColl = CreateCollection3();

            Assertion.AssertEquals("GetBoundryDimension-4: ", 0, geoColl.GetBoundaryDimension());
        }
开发者ID:vmoll,项目名称:geotools,代码行数:23,代码来源:GeometryCollectionTest.cs

示例7: test_EqualExact

        public void test_EqualExact()
        {
            //create a geomerty collection
            GeometryCollection geoColl1 = CreateCollection();
            //create another geometry collection that is null
            GeometryFactory gf = new GeometryFactory(_precMod, _sRID);
            GeometryCollection geoColl2 = gf.CreateGeometryCollection(null);
            //create another geometry collection that is different
            GeometryCollection geoColl3 = CreateCollection2();
            //create another geometry collection that is different
            GeometryCollection geoColl4 = CreateCollection3();
            //create another geometry collection that is the same as the first
            GeometryCollection geoColl5 = CreateCollection();

            Assertion.AssertEquals("Equals-1: ", true , geoColl1.Equals(geoColl5));
            Assertion.AssertEquals("Equals-2: ", false, geoColl1.Equals(geoColl2));
            Assertion.AssertEquals("Equals-3: ", false, geoColl1.Equals(geoColl3));
            Assertion.AssertEquals("Equals-4: ", false, geoColl1.Equals(geoColl4));
        }
开发者ID:vmoll,项目名称:geotools,代码行数:19,代码来源:GeometryCollectionTest.cs

示例8: test_Dimension

        public void test_Dimension()
        {
            //create a geomerty collection
            GeometryCollection geoColl = CreateCollection();

            //returns 0 because a point has a dimension of 0 & that is the largest dimesion in the collection
            Assertion.AssertEquals("Dimension-1: ", 0, geoColl.GetDimension());

            //now try it with a null geometry collection
            GeometryFactory gf = new GeometryFactory(_precMod, _sRID);
            geoColl = gf.CreateGeometryCollection(null);

            //returns -1 because the collection is empty
            Assertion.AssertEquals("Dimension-2: ", -1, geoColl.GetDimension());

            //now try it with a different geometry collection
            geoColl = CreateCollection2();

            //returns 1 because linestring has a dimension of 1 & that is the largest dimension in the collection
            Assertion.AssertEquals("Dimension-3: ", 1, geoColl.GetDimension());

            //returns 1 because linestring has a dimension of 1 & that is the largest dimension in the collection
            geoColl = CreateCollection3();

            Assertion.AssertEquals("Dimension-4: ", 1, geoColl.GetDimension());
        }
开发者ID:vmoll,项目名称:geotools,代码行数:26,代码来源:GeometryCollectionTest.cs

示例9: test_Count

        public void test_Count()
        {
            //create a geomerty collection
            GeometryCollection geoColl = CreateCollection();

            Assertion.AssertEquals("Count-1: ", 10, geoColl.Count);

            //now try it with a null geometry collection
            GeometryFactory gf = new GeometryFactory(_precMod, _sRID);
            geoColl = gf.CreateGeometryCollection(null);

            Assertion.AssertEquals("Count-2: ", 0, geoColl.Count);

            //now try it with a different geometry collection
            geoColl = CreateCollection2();

            Assertion.AssertEquals("Count-3: ", 10, geoColl.Count);

            //now try it with a mixed geometry collection
            geoColl = CreateCollection3();

            Assertion.AssertEquals("Count-4: ", 10, geoColl.Count);
        }
开发者ID:vmoll,项目名称:geotools,代码行数:23,代码来源:GeometryCollectionTest.cs

示例10: test_Coordinates

        public void test_Coordinates()
        {
            //create a geomerty collection
            GeometryCollection geoColl = CreateCollection();

            //this geometry conatins 10 sets of coordinates
            Assertion.AssertEquals("Coordinates-1: ", 10, geoColl.GetCoordinates().Count);

            //now try it with a null geometry collection
            GeometryFactory gf = new GeometryFactory(_precMod, _sRID);
            geoColl = gf.CreateGeometryCollection(null);

            Assertion.AssertEquals("Coordinates-2: ", 0, geoColl.GetCoordinates().Count);

            //now try it with a different geometry collection
            geoColl = CreateCollection2();

            //1000 sets of coordinates
            Assertion.AssertEquals("Cordinates-3: ", 1000, geoColl.GetCoordinates().Count);

            //now try it with a mixed geometry collection
            geoColl = CreateCollection3();

            Assertion.AssertEquals("Coordinates-4: ", 130, geoColl.GetCoordinates().Count);
        }
开发者ID:vmoll,项目名称:geotools,代码行数:25,代码来源:GeometryCollectionTest.cs

示例11: test_CompareToSameClass

        public void test_CompareToSameClass()
        {
            //create a geometry collection
            GeometryCollection geoColl1 = CreateCollection();

            //create another geometry collection
            GeometryCollection geoColl2 = CreateCollection1();

            //create another geometry collection
            GeometryCollection geoColl3 = CreateCollection4();

            GeometryFactory gf = new GeometryFactory(_precMod, _sRID);
            GeometryCollection geoColl4 = gf.CreateGeometryCollection(null);

            Assertion.AssertEquals("CompareToSameClass1: ", 0, geoColl1.CompareToSameClass(geoColl1));
            Assertion.AssertEquals("CompareToSameClass2: ", -1, geoColl1.CompareToSameClass(geoColl3));
            Assertion.AssertEquals("CompareToSameClass3: ", 1, geoColl3.CompareToSameClass(geoColl1));
            Assertion.AssertEquals("CompareToSameClass4: ", -1, geoColl4.CompareToSameClass(geoColl1));
        }
开发者ID:vmoll,项目名称:geotools,代码行数:19,代码来源:GeometryCollectionTest.cs


注:本文中的Geotools.Geometries.GeometryFactory.CreateGeometryCollection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。