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


C# GeometryFactory.CreatePoint方法代码示例

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


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

示例1: test_ApplyCoordinateFilter

        public void test_ApplyCoordinateFilter()
        {
            //create a new point
            GeometryFactory gf = new GeometryFactory(_precMod, _sRID);
            Point point = gf.CreatePoint(_coor);
            //CoordinateFilter filter = new CoordinateFilter();

            //todo(Ronda): Apply
            //point.Apply(filter);
        }
开发者ID:vmoll,项目名称:geotools,代码行数:10,代码来源:PointTest.cs

示例2: test_constructor

		public void test_constructor()
		{
			GeometryFactory gf = new GeometryFactory(_precMod, _sRID);

			//create a new point
			Point point = gf.CreatePoint(_coor);

			//Make sure the values
			Assertion.AssertEquals("Const-x: ", 1.0, point.X);
			Assertion.AssertEquals("Const-y: ", 2.0, point.Y);
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:11,代码来源:PointTest.cs

示例3: test_IsSimple

        public void test_IsSimple()
        {
            //create a new point
            GeometryFactory gf = new GeometryFactory(_precMod, _sRID);
            Point point = gf.CreatePoint(_coor);

            //check for true - IsSimple always returns true for a point
            Assertion.AssertEquals("IsSimple: ", true, point.IsSimple());
        }
开发者ID:vmoll,项目名称:geotools,代码行数:9,代码来源:PointTest.cs

示例4: test_NumPoints

        public void test_NumPoints()
        {
            //create a new point
            GeometryFactory gf = new GeometryFactory(_precMod, _sRID);
            Point point = gf.CreatePoint(_coor);

            Assertion.AssertEquals("NumPoints1: ", 1, point.GetNumPoints());

            //Create a null coordinate to test with
            Coordinate testCoord = new Coordinate();
            testCoord = null;

            //create a point with a null coordinate to test else case
            Point point2 = gf.CreatePoint(testCoord);

            Assertion.AssertEquals("NumPoints2: ", 0, point2.GetNumPoints());
        }
开发者ID:vmoll,项目名称:geotools,代码行数:17,代码来源:PointTest.cs

示例5: test_CompareTo

		public void test_CompareTo()
		{
			//create a coordinate (the z value is not used so there is no need to create it)
			Coordinate coord = new Coordinate(testX, testY);
			//create an equal coordinate
			Coordinate coord2 = new Coordinate(1.0, 2.0);
			//create a coordinate where X is greater & Y is equal
			Coordinate coord3 = new Coordinate(2.0, 2.0);
			//create a coordinate where Y is greater & x is equal
			Coordinate coord4 = new Coordinate(1.0, 3.0);
			//create a coordinate where both X & Y are greater
			Coordinate coord5 = new Coordinate(2.0, 3.0);
			//create a coordinate where X is less & Y is equal
			Coordinate coord6 = new Coordinate(0.0, 2.0);
			//create a coordinate where Y is less & X is equal
			Coordinate coord7 = new Coordinate(1.0, 1.0);
			//create a coordinate where both are less
			Coordinate coord8 = new Coordinate(0.0, 0.0);

			//create a point to send to throw the exception
			_gf = new GeometryFactory(_pm, _srid);
			Point point = _gf.CreatePoint(coord);

			Assertion.AssertEquals("CompareTo1: ", 0, coord.CompareTo(coord2));
			Assertion.AssertEquals("CompareTo2: ", -1, coord.CompareTo(coord3));
			Assertion.AssertEquals("CompareTo3: ", -1, coord.CompareTo(coord4));
			Assertion.AssertEquals("CompareTo4: ", -1, coord.CompareTo(coord5));
			Assertion.AssertEquals("CompareTo5: ", 1, coord.CompareTo(coord6));
			Assertion.AssertEquals("CompareTo6: ", 1, coord.CompareTo(coord7));
			Assertion.AssertEquals("CompareTo7: ", 1, coord.CompareTo(coord8));

			try
			{
				coord.CompareTo(point);
				Assertion.Fail("ArgumentException should have been thrown");
			}
			catch(ArgumentException)
			{
			}
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:40,代码来源:CoordinateTest.cs

示例6: test_IsEmpty

        public void test_IsEmpty()
        {
            //create a new point
            GeometryFactory gf = new GeometryFactory(_precMod, _sRID);
            Point point = gf.CreatePoint(_coor);

            Assertion.AssertEquals("IsEmpty1: ", false, point.IsEmpty());

            //Set point to be empty to test the else
            Coordinate testCoord = null;
            Point point2 = gf.CreatePoint(testCoord);

            Assertion.AssertEquals("IsEmpty2: ", true, point2.IsEmpty());
        }
开发者ID:vmoll,项目名称:geotools,代码行数:14,代码来源:PointTest.cs

示例7: test_Constructor

        public void test_Constructor()
        {
            //create a new collection
            GeometryCollection geoColl = CreateCollection();

            //make sure the geometrycollection isn't empty
            Assertion.AssertEquals("Constructor-1: ", false, geoColl.IsEmpty());
            //it should have ten elements
            Assertion.AssertEquals("Constructor-2: ", 10, geoColl.Count);

            //make sure all the elements are not empty
            for(int i = 0; i < geoColl.Count; i++)
            {
                Assertion.AssertEquals("Constructor-3: ", false, geoColl.GetGeometryN(i).IsEmpty());
            }

            Coordinate coord = new Coordinate();
            GeometryFactory gf = new GeometryFactory(_precMod, _sRID);
            Point point = gf.CreatePoint(coord);
            //check that the contents are as expected
            for(int i = 0; i < geoColl.Count; i++)
            {
                point = geoColl.GetGeometryN(i) as Point;
                Assertion.AssertEquals("Constructor-4: ", true, point.X.Equals((double)i));
                Assertion.AssertEquals("Constructor-5: ", true, point.Y.Equals((double)i+10));
            }
        }
开发者ID:vmoll,项目名称:geotools,代码行数:27,代码来源:GeometryCollectionTest.cs

示例8: 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

示例9: CreateTester1

        /// <summary>
        /// Method to create a MultiPoint for testing purposes
        /// </summary>
        /// <returns>A MultiPoint</returns>
        private MultiPoint CreateTester1()
        {
            GeometryFactory gf = new GeometryFactory(_precMod, _sRID);

            Point[] points = new Point[23];

            for(int i = 0; i < 12; i++)
            {
                points[i] = gf.CreatePoint(new Coordinate(i, i));
            }
            points[12] = gf.CreatePoint(new Coordinate(11, 12));
            points[13] = gf.CreatePoint(new Coordinate(10, 13));
            points[14] = gf.CreatePoint(new Coordinate(9, 14));
            points[15] = gf.CreatePoint(new Coordinate(8, 15));
            points[16] = gf.CreatePoint(new Coordinate(9, 16));
            points[17] = gf.CreatePoint(new Coordinate(10, 17));
            points[18] = gf.CreatePoint(new Coordinate(11, 18));
            points[19] = gf.CreatePoint(new Coordinate(12, 19));
            points[20] = gf.CreatePoint(new Coordinate(11, 20));
            points[21] = gf.CreatePoint(new Coordinate(10, 21));
            points[22] = gf.CreatePoint(new Coordinate(9, 22));

            MultiPoint mp = gf.CreateMultiPoint(points);
            return mp;
        }
开发者ID:vmoll,项目名称:geotools,代码行数:29,代码来源:MultiPointTest.cs

示例10: test_PointN

		public void test_PointN()
		{
			LineString ls = SimpleOpen();

			Coordinate coord = new Coordinate(11.0, 12.0);
			Coordinate coord2 = new Coordinate(11.0, 20.0);
			Coordinate coord3 = new Coordinate(0.0, 0.0);
			
			GeometryFactory gf = new GeometryFactory(_precMod, _sRID);
			Point point = gf.CreatePoint(coord);
			Point point2 = gf.CreatePoint(coord2);
			Point point3 = gf.CreatePoint(coord);
	
			Point testPoint = ls.GetPointN(11) as Point;
			Assertion.AssertEquals("PointN: ", true, testPoint.Equals(point));
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:16,代码来源:LineStringTest.cs

示例11: test_Coords

        public void test_Coords()
        {
            PrecisionModel precisionModel = new PrecisionModel();

            //Set the coord to be empty
            Coordinate coord = new Coordinate();
            coord = null;
            //create a new point
            GeometryFactory gf = new GeometryFactory(_precMod, _sRID);
            Point point = gf.CreatePoint(coord);

            //test that true is returned because the coordinates are empty.
            Assertion.AssertEquals("Coords - true: ", true, point.IsEmpty());

            //Put something into the coordinates
            Coordinate coordinate = new Coordinate(1.0,2.0);

            //create a new point
            point = gf.CreatePoint(coordinate);

            //test that false is returned because the coordinates are not empty.
            Assertion.AssertEquals("Coords - false: ", false, point.IsEmpty());
        }
开发者ID:vmoll,项目名称:geotools,代码行数:23,代码来源:PointTest.cs

示例12: test_Dimension

        public void test_Dimension()
        {
            //create a new point
            GeometryFactory gf = new GeometryFactory(_precMod, _sRID);
            Point point = gf.CreatePoint(_coor);

            //check for zero - dimension always returns 0 for a point
            Assertion.AssertEquals("Dimension: ", 0, point.GetDimension());
        }
开发者ID:vmoll,项目名称:geotools,代码行数:9,代码来源:PointTest.cs

示例13: test_Coordinates

        public void test_Coordinates()
        {
            //create a new point
            GeometryFactory gf = new GeometryFactory(_precMod, _sRID);
            Point point = gf.CreatePoint(_coor);

            //returns a coordinates object
            Coordinates coordinates = point.GetCoordinates();

            //test to make sure only one coordinate is returned for a point
            Assertion.AssertEquals("Coordinates1: ", 1, coordinates.Count);

            foreach(Coordinate coord in coordinates)
            {
                //test to make sure that the coordinates returned are equal to the coordinates sent
                Assertion.AssertEquals("test :", true, coord.Equals(_coor));

                //testing each coordinate just to be sure
                Assertion.AssertEquals("Coordinates2: ", _coor.X, coord.X);
                Assertion.AssertEquals("Coordinates3: ", _coor.Y, coord.Y);
            }
        }
开发者ID:vmoll,项目名称:geotools,代码行数:22,代码来源:PointTest.cs

示例14: test_Clone

        public void test_Clone()
        {
            //create a new point
            GeometryFactory gf = new GeometryFactory(_precMod, _sRID);
            Point point = gf.CreatePoint(_coor);
            //clone that point
            Point point2 = point.Clone() as Point;

            //Test that they are not the same point
            Assertion.AssertEquals("Clone-1: ", false, point==point2);

            //Test that they have the same coordinates
            Assertion.AssertEquals("Clone-2: ", true, point.X==point2.X);
            Assertion.AssertEquals("Clone-3: ", true, point.Y==point2.Y);
        }
开发者ID:vmoll,项目名称:geotools,代码行数:15,代码来源:PointTest.cs

示例15: test_Equals

		public void test_Equals()
		{
			LineString ls1 = SimpleOpen();
			LineString ls2 = NonSimpleOpen();
			LineString ls3 = SimpleOpen();
			Coordinate coord = new Coordinate(5.0, 2.0);
			GeometryFactory gf = new GeometryFactory(_precMod, _sRID);
			Point point = gf.CreatePoint(coord);

			Assertion.AssertEquals("Equals-1: ", true, ls1.Equals(ls3));
			//todo(Ronda): fix when geometry.equals is working
			Assertion.AssertEquals("Equals-2: ", false, ls1.Equals(ls2));
			Assertion.AssertEquals("Equals-3: ", true, ls3.Equals(ls1));
			Assertion.AssertEquals("Equals-4: ", false, ls2.Equals(point));
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:15,代码来源:LineStringTest.cs


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