void map_MouseClick(object sender, Map.MouseEventArgs e)
        {
            if (e.Handled)
            {
                return;
            }

            if (!doubleClickTimer.IsEnabled) // First click
            {
                doubleClickTimer.Start();

                Dispatcher.BeginInvoke(() =>
                {
                    if (e.Handled)
                    {
                        doubleClickTimer.Stop();
                        if (Map.Layers.Contains(busyLayer))
                        {
                            removeBusyIndicator();
                        }
                        return;
                    }

                    doNotShowResults     = false;
                    identifyTaskResults  = null;
                    waitedForDoubleClick = false;
                    initiatedByTouch     = false;

                    clickPoint = e.MapPoint;

                    DoIdentify();
                });
            }
        }
Exemple #2
0
        /// <summary>
        /// 地图单击
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void mainMap_MouseClick(object sender, Map.MouseEventArgs e)
        {
            //tbPosition.Text = string.Format("{0},{1}", Math.Round(e.MapPoint.X, 6), Math.Round(e.MapPoint.Y, 6));
            //LogHelper.WriteLog(PublicParams.type, string.Format("{0},{1}", Math.Round(e.MapPoint.X, 6), Math.Round(e.MapPoint.Y, 6)));

            ShowInfoWinByClickOrTouch(mainMap.MapToScreen(e.MapPoint));
        }
        private void MyMap_MouseClick(object sender, Map.MouseEventArgs e)
        {
            if (FindResultLocationsGraphicsLayer.Graphics.Count == 0)
            {
                return;
            }

            // This will create new routes to the search results
            MyLocationGraphicsLayer.Graphics.Clear();
            MyRoutesGraphicsLayer.Graphics.Clear();

            var myLocation = new Graphic()
            {
                Geometry = e.MapPoint,
                Symbol   = new PictureMarkerSymbol()
                {
                    Source  = new BitmapImage(new System.Uri("http://static.arcgis.com/images/Symbols/Basic/CrossHair.png")),
                    Width   = 48,
                    Height  = 48,
                    OffsetX = 24,
                    OffsetY = 24
                }
            };

            MyLocationGraphicsLayer.Graphics.Add(myLocation);

            // For each of the search results - find a route to them
            foreach (var item in FindResultLocationsGraphicsLayer.Graphics)
            {
                SolveRoute(e.MapPoint, item.Geometry as MapPoint);
            }
        }
Exemple #4
0
 private void MapMouseClickHandler(object sender, Map.MouseEventArgs e)
 {
     if (MouseMapClick != null)
     {
         MouseMapClick(e.MapPoint.ToMapCoord());
     }
 }
Exemple #5
0
 private void map_MouseClick(object sender, Map.MouseEventArgs e)
 {
     origin             = e.MapPoint;
     midMarker.Geometry = origin;
     (straightLine.Geometry as Polyline).Paths[0][0] = origin;
     (straightLine.Geometry as Polyline).Paths[0][1] = origin;
     textSymb.Text            = "";
     greatCircleLine.Geometry = null;
     radiusLine.Geometry      = null;
     radiusFill.Geometry      = null;
 }
 void Map_MouseClick(object sender, Map.MouseEventArgs e)
 {
     if (rbCalculateDistance.IsChecked == true)
     {
         CalculateDistance(e.MapPoint);
     }
     else if (rbCalculateDriveTime.IsChecked == true)
     {
         CalculateDriveTime(e.MapPoint);
     }
 }
 private void map_MouseClick(object sender, Map.MouseEventArgs e)
 {
     Dispatcher.BeginInvoke(() =>
     {
         if (e.Handled)
         {
             return;
         }
         _wasDoubleClick = false;
         _doubleClickTimer.Start();
     }
                            );
 }
        // Handle the map's click event.  Used to query dynamic map service layers.
        private void Map_MouseClick(object sender, Map.MouseEventArgs e)
        {
            // Mark the event as handled so other actions do not occur
            e.Handled = true;

            // Clear error
            Error = null;

            // Set busy state
            IsBusy = true;

            if (AssociatedObject is GraphicsLayer)
            {
                // If the target is a GraphicsLayer, the click-detection timer will be enabled if
                // a graphic from the layer was clicked
                if (!_clickTimer.IsEnabled)
                {
                    OnFailed(new Exception(Strings.NoFeaturesFound)); // None found - raise failure
                }
            }
            else if (AssociatedObject is ArcGISDynamicMapServiceLayer && SubLayer != null)
            {
                string layerUrl = null;
                // Construct the URL to the sublayer - we need this to query against
                ArcGISDynamicMapServiceLayer dynLayer = (ArcGISDynamicMapServiceLayer)AssociatedObject;
                layerUrl = string.Format("{0}/{1}", dynLayer.Url, SubLayer.ID.ToString());

                // Initialize query task if necessary
                if (_queryTask == null)
                {
                    _queryTask = new QueryTask();
                    _queryTask.ExecuteCompleted += QueryTask_ExecuteCompleted;
                    _queryTask.Failed           += QueryTask_Failed;

                    // Instantiate query and initialize properties that won't change regardless of
                    // object state
                    _query = new Query()
                    {
                        ReturnGeometry      = true,
                        SpatialRelationship = SpatialRelationship.esriSpatialRelIntersects
                    };
                }

                _query.OutSpatialReference = Map.SpatialReference;
                _queryTask.Url             = layerUrl;

                // get the click point in screen coords
                Point screenPt = Map.MapToScreen(e.MapPoint);

                // Create two rectangle corner points, offset from the click point by a tolerance.
                // Do this on the screen point so the tolerance is always applied in screen pixels.
                int   searchTol        = 5;
                Point screenLowerLeft  = new Point(screenPt.X - searchTol, screenPt.Y - searchTol);
                Point screenUpperRight = new Point(screenPt.X + searchTol, screenPt.Y + searchTol);

                // convert to map points
                MapPoint mapLowerLeft  = Map.ScreenToMap(screenLowerLeft);
                MapPoint mapUpperRight = Map.ScreenToMap(screenUpperRight);

                // Create a search rectangle from the corner points and use it to set the query geometry
                _query.Geometry = new Envelope(mapLowerLeft, mapUpperRight)
                {
                    SpatialReference = e.MapPoint.SpatialReference
                };

                // If a previous query is still executing, cancel it
                if (_queryTask.IsBusy)
                {
                    _queryTask.CancelAsync();
                }

                // Do the query
                _queryTask.ExecuteAsync(_query);
            }
            else
            {
                OnFailed(new Exception(Strings.UnsupportedLayerType));
                return;
            }
        }
 void AssociatedObject_MouseClick(object sender, Map.MouseEventArgs e)
 {
 }
Exemple #10
0
 private void AssociatedObject_MouseClick(object sender, Map.MouseEventArgs e)
 {
     Messenger.Default.Send(new MapMouseLeftButtonDownMessenger {
         Latitude = e.MapPoint.Y, Longitude = e.MapPoint.X, Altitude = (int)e.MapPoint.Z
     });
 }
Exemple #11
0
 static void Map_MouseClick(object sender, Map.MouseEventArgs e)
 {
     StopPointEditing((Map)sender);
 }
 void AssociatedObject_MouseClick(object sender, Map.MouseEventArgs e)
 {
     IsValidGraphicChecked(null);
 }
Exemple #13
0
        void MyMap_MouseClick(object sender, Map.MouseEventArgs e)
        {
            /*
             * Add a graphic at the user input location
             */
            MyMap.MouseClick -= MyMap_MouseClick;

            if (inputGraphicsLayer == null)
            {
                inputGraphicsLayer = new GraphicsLayer();
                MyMap.Layers.Add(inputGraphicsLayer);
            }

            // Add a Graphic at the click point
            Graphic graphic = new Graphic()
            {
                Symbol   = MainGrid.Resources["IncidentMarkerSymbol"] as Symbol,
                Geometry = e.MapPoint
            };

            inputGraphicsLayer.Graphics.Add(graphic);

            /*
             * Reproject the mouseclick into the GP coordinate system
             */
            // Declare the ProjectCompleted Handler
            EventHandler <GraphicsEventArgs> ProjectCompletedHandler = null;

            // Handle the event
            ProjectCompletedHandler = (sender2, graphicsEventArgs) =>
            {
                // Unregister the handler
                geometryTask.ProjectCompleted -= ProjectCompletedHandler;

                // Cancel any existing Jobs
                geoprocessorTask.CancelAsync();

                // Handle the JobCompleted
                geoprocessorTask.JobCompleted += (sender3, jobInfoEventArgs) =>
                {
                    // Check whether it succeeded
                    if (jobInfoEventArgs.JobInfo.JobStatus != esriJobStatus.esriJobSucceeded)
                    {
                        //Do Something
                    }
                    ;

                    /*
                     * Create two new Geoprocessor Tasks to fetch the result data (thereby allowing them to run concurrently)
                     * Each will use the same event handler and we'll choose based on the Parameter Name.
                     * Alternatively could use the overload which takes an object (userToken).
                     */
                    Geoprocessor gpTaskSysvalves_Layer =
                        new Geoprocessor(traceNetworkLocalGpService.Tasks[0].Url);

                    gpTaskSysvalves_Layer.GetResultDataCompleted
                        += geoprocessorTask_GetResultDataCompleted;

                    gpTaskSysvalves_Layer.GetResultDataAsync(
                        jobInfoEventArgs.JobInfo.JobId, "Sysvalves_Layer");

                    Geoprocessor gpTaskDistribMains_Layer =
                        new Geoprocessor(traceNetworkLocalGpService.Tasks[0].Url);

                    gpTaskDistribMains_Layer.GetResultDataCompleted
                        += geoprocessorTask_GetResultDataCompleted;

                    gpTaskDistribMains_Layer.GetResultDataAsync(
                        jobInfoEventArgs.JobInfo.JobId, "DistribMains_Layer");
                };

                // Create the GP Parameter List
                List <GPParameter> parameters = new List <GPParameter>();
                parameters.Add(new GPFeatureRecordSetLayer("Flags", graphicsEventArgs.Results[0].Geometry));
                geoprocessorTask.SubmitJobAsync(parameters);
            };
            // Register the handler for the ProjectCompleted event.
            geometryTask.ProjectCompleted += ProjectCompletedHandler;

            // Project the input point into the coordinate system of the data
            geometryTask.ProjectAsync(new List <Graphic>()
            {
                new Graphic()
                {
                    Geometry = e.MapPoint
                }
            },
                                      waterNetworkLocalMapService.SpatialReference);
        }
Exemple #14
0
        private void MyMap_MouseClick(object sender, Map.MouseEventArgs e)
        {
            if (_isbegin == true)
            {
                //BaseGeometry bg = GetItemByID("routing", "beginNum");

                //if (bg != null)
                //{
                //    LayerReset();
                //}

                var graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer;
                var cg            = new CarGraphic()
                {
                    Geometry = e.MapPoint,
                    Name     = "起点",
                    Symbol   = BeginPictureSymbol
                };


                if (graphicsLayer != null)
                {
                    graphicsLayer.Graphics.Add(cg);
                }

                _isbegin = false;
            }

            if (_islast == true)
            {
                var graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer;
                var cg            = new CarGraphic()
                {
                    Geometry = e.MapPoint,
                    Name     = "终点",
                    Symbol   = EndPictureSymbol
                };

                if (graphicsLayer != null)
                {
                    graphicsLayer.Graphics.Add(cg);
                }

                CarBeginRun();
                //Ltimer.Begin();
                _islast = false;
            }

            if (_isbarrier == true)
            {
                //初始化一个图标

                var graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer;
                var cg            = new CarGraphic()
                {
                    Geometry = e.MapPoint,
                    Name     = "障碍" + _barriarNum.ToString(),
                    Symbol   = BarriarPictureSymbol
                };

                if (graphicsLayer != null)
                {
                    graphicsLayer.Graphics.Add(cg);
                }

                _isbarrier = false;
                _barriarNum++;
            }
        }
Exemple #15
0
 private void mainmap_MouseClick(object sender, Map.MouseEventArgs e)
 {
     //MessageBox.Show(e.MapPoint.X.ToString());
 }
 private void MyMap_OnMouseClick(object sender, Map.MouseEventArgs e)
 {
     MessageBox.Show("坐标为:" + e.MapPoint.X + ";" + e.MapPoint.Y);
     Clipboard.SetText(e.MapPoint.X + ";" + e.MapPoint.Y);
 }