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


C# Point.Project方法代码示例

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


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

示例1: ProjectTest1

        public void ProjectTest1()
        {
            var p1 = new Point (1, 1);
            var p2 = new Point (2, 1);

            var p3 = new Point (100, 0);

            var pp = p3.Project (p1, p2);

            Assert.AreEqual (pp.X, 100);
            Assert.AreEqual (pp.Y, 1);
        }
开发者ID:magerate,项目名称:Geometries,代码行数:12,代码来源:PointTests.cs

示例2: Handler

        /// <summary>
        ///     Handles the incoming rest requests
        /// </summary>
        /// <param name="boundVariables"> The bound variables. </param>
        /// <param name="operationInput"> The operation input. </param>
        /// <param name="outputFormat"> The output format. </param>
        /// <param name="requestProperties"> The request properties. </param>
        /// <param name="responseProperties"> The response properties. </param>
        /// <returns> </returns>
        /// <exception cref="System.ArgumentNullException"></exception>
        public static byte[] Handler(NameValueCollection boundVariables, JsonObject operationInput,
                                     string outputFormat, string requestProperties,
                                     out string responseProperties)
        {
            responseProperties = null;
            var errors = new ErrorContainer(400);
            var wkid = 26912;
            const string featureClass = "SGID10.TRANSPORTATION.UDOTRoutes_LRS";

            //pull out all the variables
            var x = operationInput.GetNumberValue("x");
            var y = operationInput.GetNumberValue("y");
            var wkidInput = operationInput.GetNumberValue("wkid", nullable: true);
            var bufferInput = operationInput.GetNumberValue("buffer", nullable: true);
            var includeRamps = operationInput.GetNumberValue("includeRamps", nullable: true);

            ISpatialReference newSpatialRefefence = null;
            ISpatialReferenceFactory srFactory = new SpatialReferenceEnvironment();

            if (wkidInput > 0)
            {
                wkid = Convert.ToInt32(wkidInput);
            }

            if (bufferInput < 1 || bufferInput > 200)
            {
                bufferInput = 100;
            }

            //reproject to our data's spatial reference
            if (wkid != 26912)
            {
                var isProjected = true;
                try
                {
                    newSpatialRefefence = srFactory.CreateProjectedCoordinateSystem(wkid);
                }
                catch (ArgumentException)
                {
                    isProjected = false;
                }

                if (!isProjected)
                {
                    newSpatialRefefence = srFactory.CreateGeographicCoordinateSystem(wkid);
                }
            }

            var utm = srFactory.CreateProjectedCoordinateSystem(26912);

            IPoint point = new Point
                {
                    X = x,
                    Y = y,
                    SpatialReference = utm
                };

            //input is in different projection - reproject it
            if (wkid != 26912)
            {
                point = new Point
                    {
                        X = x,
                        Y = y,
                        SpatialReference = newSpatialRefefence
                    };

                point.Project(utm);
            }

            var bufferGeometry = CommandExecutor.ExecuteCommand(
                new BufferGeometryCommand(new GeometryContainer
                    {
                        Geometry = point
                    }, bufferInput));

            var sdeConnector = SdeConnectorFactory.Create(featureClass);

            if (sdeConnector == null)
            {
                errors.Add("{0} was not found in our database. ".With(featureClass) +
                           "A valid example would be SGID10.BOUNDARIES.Counties.");
            }

            if (errors.HasErrors)
            {
                return Json(errors);
            }

// ReSharper disable PossibleNullReferenceException because of returning errors if null
//.........这里部分代码省略.........
开发者ID:agrc,项目名称:api.mapserv.utah.gov,代码行数:101,代码来源:ReverseMilepost.cs


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