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


C# MapPoint类代码示例

本文整理汇总了C#中MapPoint的典型用法代码示例。如果您正苦于以下问题:C# MapPoint类的具体用法?C# MapPoint怎么用?C# MapPoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: BroadcastCoordinateValues

        private void BroadcastCoordinateValues(MapPoint mapPoint)
        {
            var dict = new Dictionary<CoordinateType, string>();
            if (mapPoint == null)
                return;

            var dd = new CoordinateDD(mapPoint.Y, mapPoint.X);

            try
            {
                dict.Add(CoordinateType.DD, dd.ToString("", new CoordinateDDFormatter()));
            }
            catch { }
            try
            {
                dict.Add(CoordinateType.DDM, new CoordinateDDM(dd).ToString("", new CoordinateDDMFormatter()));
            }
            catch { }
            try
            {
                dict.Add(CoordinateType.DMS, new CoordinateDMS(dd).ToString("", new CoordinateDMSFormatter()));
            }
            catch { }

            Mediator.NotifyColleagues(CoordinateToolLibrary.Constants.BroadcastCoordinateValues, dict);

        }
开发者ID:chinasio,项目名称:coordinate-tool-addin-dotnet,代码行数:27,代码来源:CoordinateToolDockpaneViewModel.cs

示例2: Initialize

        private void Initialize()
        {
            // Create new Map with basemap
            Map myMap = new Map(Basemap.CreateImagery());

            // Create initial map location and reuse the location for graphic
            MapPoint centralLocation = new MapPoint(-226773, 6550477, SpatialReferences.WebMercator);
            Viewpoint initialViewpoint = new Viewpoint(centralLocation, 7500);

            // Set initial viewpoint
            myMap.InitialViewpoint = initialViewpoint;

            // Provide used Map to the MapView
            _myMapView.Map = myMap;

            // Create overlay to where graphics are shown
            GraphicsOverlay overlay = new GraphicsOverlay();

            // Add created overlay to the MapView
            _myMapView.GraphicsOverlays.Add(overlay);

            // Create a simple marker symbol
            SimpleMarkerSymbol simpleSymbol = new SimpleMarkerSymbol()
            {
                Color = Color.Red,
                Size = 10,
                Style = SimpleMarkerSymbolStyle.Circle
            };

            // Add a new graphic with a central point that was created earlier
            Graphic graphicWithSymbol = new Graphic(centralLocation, simpleSymbol);
            overlay.Graphics.Add(graphicWithSymbol);
        }
开发者ID:Esri,项目名称:arcgis-runtime-samples-dotnet,代码行数:33,代码来源:RenderSimpleMarkers.cs

示例3: InstantiatePhantom

	void InstantiatePhantom(MapPoint p, bool isGreen)
	{
		Transform ph = Instantiate<Transform>(isGreen?Green:Red);
		ph.parent = transform;
		ph.localPosition = new Vector3(p.X+0.5f,p.Y+0.5f,0);
		phantoms.Add(p.toInt(),ph);
	}
开发者ID:PentagramPro,项目名称:HouseCraft,代码行数:7,代码来源:PhantomController.cs

示例4: Initialize

        private async void Initialize()
        {
            // Create new Map with basemap
            Map myMap = new Map(Basemap.CreateTopographic());

            // Create and set initial map location
            MapPoint initialLocation = new MapPoint(
                -13630484, 4545415, SpatialReferences.WebMercator);
            myMap.InitialViewpoint = new Viewpoint(initialLocation, 500000);

            // Create uri to the used feature service
            var serviceUri = new Uri(
               "http://sampleserver6.arcgisonline.com/arcgis/rest/services/SF311/FeatureServer/0");

            // Create feature table for the incident feature service
            _incidentsFeatureTable = new ServiceFeatureTable(serviceUri);

            // Define the request mode
            _incidentsFeatureTable.FeatureRequestMode = FeatureRequestMode.ManualCache;

            // When feature table is loaded, populate data
            _incidentsFeatureTable.LoadStatusChanged += OnLoadedPopulateData;

            // Create FeatureLayer that uses the created table
            FeatureLayer incidentsFeatureLayer = new FeatureLayer(_incidentsFeatureTable);

            // Add created layer to the map
            myMap.OperationalLayers.Add(incidentsFeatureLayer);

            // Assign the map to the MapView
            _myMapView.Map = myMap;
        }
开发者ID:Esri,项目名称:arcgis-runtime-samples-xamarin,代码行数:32,代码来源:ServiceFeatureTableManualCache.cs

示例5: WorldFileLoaded

        private void WorldFileLoaded(object sender, DownloadStringCompletedEventArgs e)
        {
            //Checks to see if there was an error
            if (e.Error == null)
            {
                //grab the data from the world file
                string myData = e.Result;
                //split string into an array based on new line characters
                string[] lines = myData.Split(new string[] { "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries);
                //convert the strings into doubles
                double[] coordValues = new double[6];
                for(int i = 0; i < 6; i++) {
                    coordValues[i] = Convert.ToDouble(lines[i]);
                }
                //calculate the pixel height and width in real world coordinates
                double pixelWidth = Math.Sqrt(Math.Pow(coordValues[0], 2) + Math.Pow(coordValues[1], 2));
                double pixelHeight = Math.Sqrt(Math.Pow(coordValues[2], 2) + Math.Pow(coordValues[3], 2));

                //Create a map point for the top left and bottom right
                MapPoint topLeft = new MapPoint(coordValues[4], coordValues[5]);
                MapPoint bottomRight = new MapPoint(coordValues[4] + (pixelWidth * imageWidth), coordValues[5] + (pixelHeight * imageHeight));
                //create an envelope for the elmently layer
                Envelope extent = new Envelope(topLeft.X, topLeft.Y, bottomRight.X, bottomRight.Y);
                ElementLayer.SetEnvelope(image, extent);
                //Zoom to the extent of the image
                MyMap.Extent = extent;
            }
        }
开发者ID:ApexGIS,项目名称:developer-support,代码行数:28,代码来源:MainPage.xaml.cs

示例6: WriteCEXML

        static string _doubleFormat = "F6"; // XML precision

        #endregion Fields

        #region Methods

        public static bool WriteCEXML(ref ParcelData parcelData, string xmlFileName, ref Configuration configuration, ESRI.ArcGIS.Client.Geometry.SpatialReference spatialReference, ref PointDictionary pointDictionary, ref MapPoint projectedStartPoint, double scale, double rotation)
        {
            DocumentEntry documentType = parcelData.DocumentEntries.CurrentItem as DocumentEntry; ;

              XmlWriterSettings settings = new XmlWriterSettings();
              settings.Indent = true;
              settings.IndentChars = "  ";
              settings.NewLineChars = "\r\n";
              settings.NewLineHandling = NewLineHandling.Replace;

              XmlWriter writer = XmlWriter.Create(xmlFileName, settings);
              if (writer == null)
            return false;

              writer.WriteStartDocument();
              writer.WriteStartElement("geodata", "GeoSurveyPacketData", @"http://www.geodata.com.au/schemas/GeoSurvey/ESRI/1.0/");
              writer.WriteElementString("schemaVersion", "2.0");

              WriteUnits(ref writer, ref spatialReference, ref configuration);
              WriteJobParameters(ref writer, ref configuration);
              WritePlans(ref writer, ref parcelData, ref pointDictionary, ref projectedStartPoint, scale, rotation, ref configuration, ref documentType);
              WritePoints(ref writer);
              WriteControl(ref writer);

              writer.WriteEndElement();
              writer.WriteEndDocument();
              writer.Dispose();             // force write of item.

              return true;
        }
开发者ID:Esri,项目名称:deed-drafter,代码行数:36,代码来源:ParcelXML.cs

示例7: Modify

        private void Modify(MapPoint center)
        {
            var sw = new Stopwatch();
            sw.Start();

            var mesh = gameObject.GetComponent<MeshFilter>().mesh;
            var vertices = mesh.vertices;
            var radius = 5;
            _meshIndex.Query(center, radius, vertices, (i, distance, direction) =>
            {
                var vertex = vertices[i];
                vertices[i] = new Vector3(
                    vertex.x + direction.x*(distance - radius)/2,
                    vertex.y,
                    vertex.z + direction.y*(distance - radius)/2);
            });

            mesh.vertices = vertices;
            mesh.RecalculateNormals();

            DestroyImmediate(gameObject.GetComponent<MeshCollider>());
            gameObject.AddComponent<MeshCollider>();

            sw.Stop();

            Debug.Log(String.Format("Processed in {0}ms (incl. collider)", sw.ElapsedMilliseconds));
        }
开发者ID:jorik041,项目名称:demo,代码行数:27,代码来源:ModifyableFacadeBehaviour.cs

示例8: ZoomToLevel

        void ZoomToLevel(int level, MapPoint point)
        {
            bool zoomentry = false;
            double resolution;
            if (level == -1)
                resolution = map.Resolution;
            else
                resolution = (this.map.Layers["basemap"] as TiledLayer).TileInfo.Lods[level].Resolution;


            if (Math.Abs(map.Resolution - resolution) < 0.05)
            {
                this.map.PanTo(point);
                return;
            }
            zoomentry = false;
            this.map.ZoomToResolution(resolution);

            map.ExtentChanged += (s, a) =>
            {
                if (!zoomentry)
                    this.map.PanTo(point);

                zoomentry = true;

                //   SwitchLayerVisibility();
            };



        }
开发者ID:ufjl0683,项目名称:LedControlPanel,代码行数:31,代码来源:MainWindow.xaml.cs

示例9: GetBoundingBoxMiles

        public static BoundingBox GetBoundingBoxMiles(MapPoint point, double halfSideInMiles)
        {
            // Bounding box surrounding the point at given coordinates,
            // assuming local approximation of Earth surface as a sphere
            // of radius given by WGS84
            var lat = Deg2rad(point.Latitude);
            var lon = Deg2rad(point.Longitude);
            var halfSide = 1609.344 * halfSideInMiles;

            // Radius of Earth at given latitude
            var radius = WGS84EarthRadius(lat);
            // Radius of the parallel at given latitude
            var pradius = radius * Math.Cos(lat);

            var latMin = lat - halfSide / radius;
            var latMax = lat + halfSide / radius;
            var lonMin = lon - halfSide / pradius;
            var lonMax = lon + halfSide / pradius;

            return new BoundingBox
            {
                MinPoint = new MapPoint { Latitude = Rad2deg(latMin), Longitude = Rad2deg(lonMin) },
                MaxPoint = new MapPoint { Latitude = Rad2deg(latMax), Longitude = Rad2deg(lonMax) }
            };
        }
开发者ID:ThinkBiscuit,项目名称:GeoTest,代码行数:25,代码来源:GeoCalculations.cs

示例10: GetRoute

		public async Task<RouteResult> GetRoute(string address, MapPoint from, CancellationToken cancellationToken)
		{
			var to = await Geocode(address, cancellationToken).ConfigureAwait(false);
			if (to == null)
				throw new ArgumentException("Address not found");
			return await GetRoute(from, to, cancellationToken);
		}
开发者ID:Gue2014,项目名称:DS2014-GettingStarted,代码行数:7,代码来源:RouteService.cs

示例11: QueryElevation

		private async Task QueryElevation(MapPoint location)
		{
			if (MySceneView.GetCurrentViewpoint(ViewpointType.BoundingGeometry) == null)
				return;

			if (!_isSceneReady)
				return;

			try
			{
				_isSceneReady = false;

				double elevation = await _fileElevationSource.GetElevationAsync(location);

				if (elevation.ToString() == "NaN")
				{
					mapTip.Visibility = System.Windows.Visibility.Hidden;
					return;
				}

				MapView.SetViewOverlayAnchor(mapTip, location);
				mapTip.Visibility = System.Windows.Visibility.Visible;
				txtElevation.Text = String.Format("Elevation: {0} meters", elevation.ToString());

			}
			catch (Exception ex)
			{
				MessageBox.Show("Error retrieving elevation values: " + ex.Message, "Sample Error");
			}
			finally
			{
				_isSceneReady = true;
			}
		}
开发者ID:MagicWang,项目名称:arcgis-runtime-samples-dotnet,代码行数:34,代码来源:QueryElevation3d.xaml.cs

示例12: AddTree

 /// <summary> Adds tree with default properties. </summary>
 public void AddTree(MapPoint point)
 {
     _tileModelEditor.AddTree(new Tree()
     {
         Point = point
     });
 }
开发者ID:jorik041,项目名称:demo,代码行数:8,代码来源:EditorController.cs

示例13: Initialize

        private async void Initialize()
        {
            // Create new Map with basemap
            Map myMap = new Map(Basemap.CreateTopographic());

            // Create a MapPoint the map should zoom to
            MapPoint mapPoint = new MapPoint(
                -13630484, 4545415, SpatialReferences.WebMercator);

            // Set the initial viewpoint for map
            myMap.InitialViewpoint = new Viewpoint(mapPoint, 90000);

            // Provide used Map to the MapView
            MyMapView.Map = myMap;

            // Create the uri for the feature service
            Uri featureServiceUri = new Uri(
                "https://sampleserver6.arcgisonline.com/arcgis/rest/services/SF311/FeatureServer/0");

            // Initialize feature table using a url to feature server url
            ServiceFeatureTable featureTable = new ServiceFeatureTable(featureServiceUri);

            // Initialize a new feature layer based on the feature table
            _featureLayer = new FeatureLayer(featureTable);

            //Add the feature layer to the map
            myMap.OperationalLayers.Add(_featureLayer);

            // TODO: https://github.com/Esri/arcgis-runtime-samples-xamarin/issues/96
            if (Device.OS == TargetPlatform.iOS || Device.OS == TargetPlatform.Other)
            {
                await _featureLayer.RetryLoadAsync();
            }
        }
开发者ID:Esri,项目名称:arcgis-runtime-samples-dotnet,代码行数:34,代码来源:FeatureLayerDefinitionExpression.xaml.cs

示例14: Initialize

        private async void Initialize()
        {
            // Create new Map with basemap
            Map myMap = new Map(Basemap.CreateTopographic());

            // Create a mappoint the map should zoom to
            MapPoint mapPoint = new MapPoint(-13630484, 4545415, SpatialReferences.WebMercator);

            // Set the initial viewpoint for map
            myMap.InitialViewpoint = new Viewpoint(mapPoint, 90000);

            // Provide used Map to the MapView
            _myMapView.Map = myMap;

            // Create the uri for the feature service
            Uri featureServiceUri = new Uri("http://sampleserver6.arcgisonline.com/arcgis/rest/services/SF311/FeatureServer/0");

            // Initialize feature table using a url to feature server url
            ServiceFeatureTable featureTable = new ServiceFeatureTable(featureServiceUri);

            // Initialize a new feature layer based on the feature table
            _featureLayer = new FeatureLayer(featureTable);

            //Add the feature layer to the map
            myMap.OperationalLayers.Add(_featureLayer);
        }
开发者ID:Esri,项目名称:arcgis-runtime-samples-xamarin,代码行数:26,代码来源:FeatureLayerDefinitionExpression.cs

示例15: OnCreateGraphic

        protected override Graphic OnCreateGraphic(GraphicCollection cluster, MapPoint point, int maxClusterCount)
        {
            if (cluster.Count == 1) return cluster[0];

            double sum = 0;

            foreach (var g in cluster) {
                if (!g.Attributes.ContainsKey("Poi")) continue;
                try {
                    var poi = g.Attributes["Poi"] as PoI;
                    if (poi == null) continue;
                    if (poi.Labels.ContainsKey(AggregateLabel))
                        sum += Convert.ToDouble(poi.Labels[AggregateLabel]);
                }
                catch { }
            }
            //double size = (sum + 450) / 30;
            var size = (Math.Log(sum * SymbolScale / 10) * 10 + 20);
            if (size < 12) size = 12;
            var graphic = new Graphic
            {
                Symbol = new ClusterSymbol { Size = size },
                Geometry = point
            };
            graphic.Attributes.Add("Count", sum);
            graphic.Attributes.Add("Size", size);
            graphic.Attributes.Add("Color", InterpolateColor(size - 12, 100));
            return graphic;
        }
开发者ID:TNOCS,项目名称:csTouch,代码行数:29,代码来源:SumClusterer.cs


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