private void MapMouseDown(int Button, int Shift, int x, int y, ref bool Handled)
        {
            try
            {
                if (m_globals.CurrentMode == GlobalFunctions.Modes.MoveVertex)
                {
                    //get the projection coordinates
                    double projX = 0, projY = 0;
                    m_MapWin.View.PixelToProj((double)x, (double)y, ref projX, ref projY);

                    //get all the vertex points that are within tolerance
                    m_snapPoints = new System.Collections.ArrayList();
                    if (!m_snapClass.CanSnap(m_globals.CurrentTolerance, projX, projY, ref m_snapPoints))
                    {
                        return;
                    }

                    m_MapDraging = true;
                    Handled      = true;
                }
            }
            catch (System.Exception ex)
            {
                m_MapWin.ShowErrorDialog(ex);
            }
        }
예제 #2
0
        private void MapMouseDown(int Button, int Shift, int x, int y, ref bool Handled)
        {
            try
            {
                if (m_globals.CurrentMode == GlobalFunctions.Modes.RemoveVertex)
                {
                    if (m_globals.CurrentLayer == null)
                    {
                        return;
                    }
                    MapWinGIS.Shapefile shpFile = m_globals.CurrentLayer;

                    //get the projection coordinates
                    double projX = 0, projY = 0;
                    m_MapWin.View.PixelToProj((double)x, (double)y, ref projX, ref projY);

                    //get all the vertex points that are within tolerance
                    System.Collections.ArrayList snapPoints = new System.Collections.ArrayList();
                    if (m_snapClass.CanSnap(m_globals.CurrentTolerance, projX, projY, ref snapPoints))
                    {
                        RemoveSelectedVertex(snapPoints, shpFile);
                    }

                    //reload the snap class
                    m_snapClass = new SnapClass(m_MapWin);

                    Handled = true;
                }
            }
            catch (System.Exception ex)
            {
                m_MapWin.ShowErrorDialog(ex);
            }
        }
예제 #3
0
 private void MouseMoveEvent(int ScreenX, int ScreenY, ref bool Handled)
 {
     try
     {
         if ((m_globals.CurrentMode == GlobalFunctions.Modes.AddShape) && (this.Visible))
         {
             m_globals.MapWin.View.UserCursorHandle = m_cursor.Handle.ToInt32();
             double x = 0, y = 0;
             m_globals.MapWin.View.PixelToProj((double)ScreenX, (double)ScreenY, ref x, ref y);
             PointD snappedPoint = null;
             System.Collections.ArrayList bestPoints = null;
             if (m_snapper != null && m_snapper.CanSnap(m_globals.CurrentTolerance, x, y, m_Shape, ref bestPoints))
             {
                 snappedPoint   = ((SnapData)bestPoints[0]).point;
                 this.txtX.Text = snappedPoint.x.ToString();
                 this.txtY.Text = snappedPoint.y.ToString();
                 if (m_Shape.NumPoints > 0)
                 {
                     m_globals.MapWin.View.Draw.ClearDrawing(m_drawHandle);
                     m_drawHandle = m_globals.MapWin.View.Draw.NewDrawing(MapWinGIS.tkDrawReferenceList.dlSpatiallyReferencedList);
                     DrawShape();
                     MapWindow.Interfaces.Draw d = m_globals.MapWin.View.Draw;
                     if (m_globals.MapWin.Layers[m_globals.MapWin.Layers.CurrentLayer].LayerType == MapWindow.Interfaces.eLayerType.PolygonShapefile)
                     {
                         d.DrawLine(m_Shape[m_Shape.NumPoints - 1].x, m_Shape[m_Shape.NumPoints - 1].y, snappedPoint.x, snappedPoint.y, 2, m_globals.MapWin.Layers[m_globals.MapWin.Layers.CurrentLayer].OutlineColor);
                     }
                     else
                     {
                         d.DrawLine(m_Shape[m_Shape.NumPoints - 1].x, m_Shape[m_Shape.NumPoints - 1].y, snappedPoint.x, snappedPoint.y, 2, m_globals.MapWin.Layers[m_globals.MapWin.Layers.CurrentLayer].Color);
                     }
                 }
             }
             else
             {
                 this.txtX.Text = x.ToString();
                 this.txtY.Text = y.ToString();
                 if (m_Shape.NumPoints > 0)
                 {
                     m_globals.MapWin.View.Draw.ClearDrawing(m_drawHandle);
                     m_drawHandle = m_globals.MapWin.View.Draw.NewDrawing(MapWinGIS.tkDrawReferenceList.dlSpatiallyReferencedList);
                     DrawShape();
                     MapWindow.Interfaces.Draw d = m_globals.MapWin.View.Draw;
                     d.DrawLine(m_Shape[m_Shape.NumPoints - 1].x, m_Shape[m_Shape.NumPoints - 1].y, x, y, 2, System.Drawing.Color.Blue);
                 }
             }
         }
     }
     catch
     {
     }
 }
 public void MapMouseMoveEvent(int ScreenX, int ScreenY, ref bool Handled)
 {
     if (m_globals.CurrentMode == GlobalFunctions.Modes.RemoveVertex)
     {
         System.Collections.ArrayList lst = null;
         double px = 0, py = 0;
         m_globals.MapWin.View.PixelToProj((double)ScreenX, (double)ScreenY, ref px, ref py);
         m_globals.MapWin.View.Select(ScreenX, ScreenY, true);
         MarkAllVertices();
         if (m_snapper != null && m_snapper.CanSnap(m_globals.CurrentTolerance, px, py, ref lst))
         {
             MarkSelectedVertices(lst);
         }
     }
 }