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


C# Polygon.SetMetaDataElement方法代码示例

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


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

示例1: Add2DPolygon

        public static void Add2DPolygon(LocalVectorDataSource source, Projection projection)
        {
            LineStyleBuilder lineBuilder = new LineStyleBuilder();
            lineBuilder.Color = new Color(0, 0, 0, 255); // Black
            lineBuilder.Width = 1.0f;

            // Create polygon style and poses
            PolygonStyleBuilder polygonBuilder = new PolygonStyleBuilder();
            polygonBuilder.Color = new Color(255, 0, 0, 255); // Red
            polygonBuilder.LineStyle = lineBuilder.BuildStyle();

            MapPosVector polygonPoses = new MapPosVector();
            polygonPoses.Add(projection.FromWgs84(new MapPos(24.650930, 59.421659)));
            polygonPoses.Add(projection.FromWgs84(new MapPos(24.657453, 59.416354)));
            polygonPoses.Add(projection.FromWgs84(new MapPos(24.661187, 59.414607)));
            polygonPoses.Add(projection.FromWgs84(new MapPos(24.667667, 59.418123)));
            polygonPoses.Add(projection.FromWgs84(new MapPos(24.665736, 59.421703)));
            polygonPoses.Add(projection.FromWgs84(new MapPos(24.661444, 59.421245)));
            polygonPoses.Add(projection.FromWgs84(new MapPos(24.660199, 59.420677)));
            polygonPoses.Add(projection.FromWgs84(new MapPos(24.656552, 59.420175)));
            polygonPoses.Add(projection.FromWgs84(new MapPos(24.654010, 59.421472)));

            // Create 2 polygon holes
            MapPosVector holePoses1 = new MapPosVector();
            holePoses1.Add(projection.FromWgs84(new MapPos(24.658409, 59.420522)));
            holePoses1.Add(projection.FromWgs84(new MapPos(24.662207, 59.418896)));
            holePoses1.Add(projection.FromWgs84(new MapPos(24.662207, 59.417411)));
            holePoses1.Add(projection.FromWgs84(new MapPos(24.659524, 59.417171)));
            holePoses1.Add(projection.FromWgs84(new MapPos(24.657615, 59.419834)));

            MapPosVector holePoses2 = new MapPosVector();
            holePoses2.Add(projection.FromWgs84(new MapPos(24.665640, 59.421243)));
            holePoses2.Add(projection.FromWgs84(new MapPos(24.668923, 59.419463)));
            holePoses2.Add(projection.FromWgs84(new MapPos(24.662893, 59.419365)));

            MapPosVectorVector polygonHoles = new MapPosVectorVector();
            polygonHoles.Add(holePoses1);
            polygonHoles.Add(holePoses2);

            // Add polygon
            Polygon polygon = new Polygon(polygonPoses, polygonHoles, polygonBuilder.BuildStyle());
            polygon.SetMetaDataElement("ClickText", new Variant("Polygon"));
            source.Add(polygon);
        }
开发者ID:CartoDB,项目名称:mobile-dotnet-samples,代码行数:44,代码来源:Overlays.cs


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