Exemplo n.º 1
0
 void MainMap_MouseUp(object sender, GUI.MouseEventArgs e)
 {
     if (e.Button == GUI.MouseButtons.Left)
     {
         isMouseDown = false;
     }
 }
Exemplo n.º 2
0
        // On mouse click - notify user if blob was clicked
        protected override void OnMouseClick(GUI.MouseEventArgs e)
        {
            base.OnMouseClick(e);

            UpdateDrawOffset();

#if !SILVERLIGHT && !UNITY_WEBPLAYER
            int x = e.X - m_DrawOffset.X - 1;
            int y = e.Y - m_DrawOffset.Y - 1;

            if ((image != null) && (x >= 0) && (y >= 0) &&
                (x < imageWidth) && (y < imageHeight))
            {
                int blobID = blobCounter.ObjectLabels[y * imageWidth + x];

                if (blobID != 0)
                {
                    selectedBlobID = blobID;

                    Refresh();// Invalidate();

                    if (BlobSelected != null)
                    {
                        for (int i = 0; i < blobs.Length; i++)
                        {
                            if (blobs[i].ID == blobID)
                            {
                                BlobSelected(this, blobs[i]);
                            }
                        }
                    }
                }
            }
#endif
        }
Exemplo n.º 3
0
        // AGV's terrain drawing
        void pbTerrain_MouseMove(object sender, GUI.MouseEventArgs e)
        {
            Brush brush = null;

            if (e.Button == GUI.MouseButtons.Left)
            {
                brush = Brushes.White;
            }
            else if (e.Button == GUI.MouseButtons.Right)
            {
                brush = Brushes.Black;
            }
            else
            {
                return;
            }

            using (Graphics g = Graphics.FromImage(pbTerrain.Image))
            {
                g.FillRectangle(brush, e.X - 40, e.Y - 40, 80, 80);
            }

            //LastX = e.X;
            //LastY = e.Y;

            OriginalMap = CopyImage(pbTerrain.Image as Bitmap);
            pbTerrain.Refresh();
        }
Exemplo n.º 4
0
 void panel2_MouseMove(object sender, GUI.MouseEventArgs e)
 {
     if (e.Button == GUI.MouseButtons.Left)
     {
         m_X = e.X;
         m_Y = e.Y;
     }
 }
Exemplo n.º 5
0
        void DrawingPanel_MouseDown(object sender, GUI.MouseEventArgs e)
        {
            double scale = m_ScaleSlider.Value;

            m_dx = e.X - m_x * scale;
            m_dy = e.Y - m_y * scale;

            m_DragFlag = true;
        }
Exemplo n.º 6
0
            protected override void OnMouseUp(GUI.MouseEventArgs e)
            {
                base.OnMouseUp(e);

                if (e.Button == GUI.MouseButtons.Left)
                {
                    test.MouseUp(e, test.ConvertScreenToWorld(e.X, e.Y));
                }
                else if (e.Button == GUI.MouseButtons.Right)
                {
                    rMouseDown = false;
                }
            }
Exemplo n.º 7
0
        protected override void OnMouseWheel(GUI.MouseEventArgs e)
        {
            base.OnMouseWheel(e);

            m_Scale += 0.0005f * e.Delta;

            if (m_Scale < 0.1)
            {
                m_Scale = 0.1;
            }

            NeedRefresh();
        }
Exemplo n.º 8
0
            protected override void OnMouseMove(GUI.MouseEventArgs e)
            {
                base.OnMouseMove(e);

                if (rMouseDown)
                {
                    Vector2 diff = e.Location - lastp;
                    m_OffsetX += diff.X;
                    m_OffsetY += diff.Y;
                }
                lastp = e.Location;

                test.MouseMove(ConvertScreenToWorld(e.X, e.Y));
            }
Exemplo n.º 9
0
            protected override void OnMouseDown(GUI.MouseEventArgs e)
            {
                base.OnMouseDown(e);

                if (e.Button == GUI.MouseButtons.Left)
                {
                    test.MouseDown(e, test.ConvertScreenToWorld(e.X, e.Y));
                }
                else if (e.Button == GUI.MouseButtons.Right)
                {
                    lastp      = e.Location;
                    rMouseDown = true;
                }
            }
Exemplo n.º 10
0
        void DrawingPanel_MouseMove(object sender, GUI.MouseEventArgs e)
        {
            if (e.Button != GUI.MouseButtons.Left)
            {
                m_DragFlag = false;
            }

            if (m_DragFlag)
            {
                m_x = e.X - m_dx;
                m_y = e.Y - m_dy;

                m_DrawingPanel.Refresh();
            }
        }
Exemplo n.º 11
0
            protected override void OnMouseWheel(GUI.MouseEventArgs e)
            {
                base.OnMouseWheel(e);

                var direction = e.Delta;

                if (direction < 0)
                {
                    viewZoom /= 1.1;
                }
                else
                {
                    viewZoom *= 1.1;
                }
            }
Exemplo n.º 12
0
            protected override void OnMouseMove(GUI.MouseEventArgs e)
            {
                base.OnMouseMove(e);

                Vector2 wdiff = test.ConvertScreenToWorld(e.X, e.Y) - test.ConvertScreenToWorld(lastp.X, lastp.Y);

                if (rMouseDown)
                {
                    test.m_OffsetX += wdiff.X;
                    test.m_OffsetY -= wdiff.Y;
                }
                lastp = e.Location;

                test.MouseMove(e, test.ConvertScreenToWorld(e.X, e.Y), wdiff);
            }
Exemplo n.º 13
0
        protected override void OnMouseDown(GUI.MouseEventArgs e)
        {
            base.OnMouseDown(e);

            if (e.Button == GUI.MouseButtons.Left &&
                (ModifierKeys & GUI.Keys.Control) != 0)
            {
                m_dx       = e.X - m_x;
                m_dy       = e.Y - m_y;
                m_DragFlag = true;
            }
            else
            {
                Move(e);
            }
        }
Exemplo n.º 14
0
        void DrawingPanel_MouseMove(object sender, GUI.MouseEventArgs e)
        {
            if (e.Button != GUI.MouseButtons.Left)
            {
                m_DragFlag = false;
            }

            if (m_DragFlag)
            {
                double scale = m_ScaleSlider.Value;

                m_x = (e.X - m_dx) / scale;
                m_y = (e.Y - m_dy) / scale;

                m_DrawingPanel.Refresh();
            }
        }
Exemplo n.º 15
0
        void MainMap_MouseDown(object sender, GUI.MouseEventArgs e)
        {
            if (e.Button == GUI.MouseButtons.Left)
            {
                isMouseDown = true;

                if (currentMarker != null &&
                    currentMarker.IsVisible)
                {
                    currentMarker.Position = MainMap.FromLocalToLatLng(e.X, e.Y);

                    var px   = MainMap.MapProvider.Projection.FromLatLngToPixel(currentMarker.Position.Lat, currentMarker.Position.Lng, (int)MainMap.Zoom);
                    var tile = MainMap.MapProvider.Projection.FromPixelToTileXY(px);

                    Debug.WriteLine("MouseDown: geo: " + currentMarker.Position + " | px: " + px + " | tile: " + tile);
                }
            }
        }
Exemplo n.º 16
0
        void DrawingPanel_MouseWheel(object sender, GUI.MouseEventArgs e)
        {
            float offset =
#if WINDOWS_PHONE_7 || WINDOWS_PHONE_71
                1;
#else
                0.5f;
#endif

            if (e.Delta > 0 && nudOffset.Value < 10)
            {
                nudOffset.Value += offset;
            }
            else if (e.Delta < 0 && nudOffset.Value > -10)
            {
                nudOffset.Value -= offset;
            }
        }
Exemplo n.º 17
0
        // move current marker with left holding
        void MainMap_MouseMove(object sender, GUI.MouseEventArgs e)
        {
            if (e.Button == GUI.MouseButtons.Left && isMouseDown)
            {
                if (CurentRectMarker == null)
                {
                    if (currentMarker != null &&
                        currentMarker.IsVisible)
                    {
                        currentMarker.Position = MainMap.FromLocalToLatLng(e.X, e.Y);
                    }
                }
                else // move rect marker
                {
                    PointLatLng pnew = MainMap.FromLocalToLatLng(e.X, e.Y);

                    int?pIndex = (int?)CurentRectMarker.Tag;
                    if (pIndex.HasValue)
                    {
                        if (pIndex < polygon.Points.Count)
                        {
                            polygon.Points[pIndex.Value] = pnew;
                            MainMap.UpdatePolygonLocalPosition(polygon);
                        }
                    }

                    if (currentMarker.IsVisible)
                    {
                        currentMarker.Position = pnew;
                    }
                    CurentRectMarker.Position = pnew;

                    if (CurentRectMarker.InnerMarker != null)
                    {
                        CurentRectMarker.InnerMarker.Position = pnew;
                    }
                }

                MainMap.Refresh(); // force instant invalidation
            }
        }
Exemplo n.º 18
0
        protected void Move(GUI.MouseEventArgs e)
        {
            double x = e.X;
            double y = e.Y;

            if (e.Button == GUI.MouseButtons.Left)
            {
                int width  = (int)Width;
                int height = (int)Height;
                UpdateTransform(width, height, x, y);

                NeedRefresh();
            }
            else if (e.Button == GUI.MouseButtons.Right)
            {
                m_SkewX = x - m_x;
                m_SkewY = y - m_y;

                NeedRefresh();
            }
        }
Exemplo n.º 19
0
        // On mouse moving - update cursor
        protected override void OnMouseMove(GUI.MouseEventArgs e)
        {
            base.OnMouseMove(e);

            UpdateDrawOffset();

#if !SILVERLIGHT && !UNITY_WEBPLAYER
            int x = e.X - m_DrawOffset.X - 1;
            int y = e.Y - m_DrawOffset.Y - 1;

            if ((image != null) && (x >= 0) && (y >= 0) &&
                (x < imageWidth) && (y < imageHeight) &&
                (blobCounter.ObjectLabels[y * imageWidth + x] != 0))
            {
                this.Cursor = GUI.Cursors.Hand;
            }
            else
            {
                this.Cursor = GUI.Cursors.Default;
            }
#endif
        }
Exemplo n.º 20
0
        protected override void OnMouseMove(GUI.MouseEventArgs e)
        {
            base.OnMouseMove(e);

            if (e.Button != GUI.MouseButtons.Left ||
                (ModifierKeys & GUI.Keys.Control) == 0)
            {
                m_DragFlag = false;
            }

            if (m_DragFlag)
            {
                m_x = e.X - m_dx;
                m_y = e.Y - m_dy;

                NeedRefresh();
            }
            else
            {
                Move(e);
            }
        }
Exemplo n.º 21
0
            protected override void OnMouseDown(GUI.MouseEventArgs e)
            {
                base.OnMouseDown(e);

                if (e.Button == GUI.MouseButtons.Left)
                {
                    Vector2 p = ConvertScreenToWorld(e.X, e.Y);

                    if (InputHandler.IsShiftDown)
                    {
                        test.ShiftMouseDown(p);
                    }
                    else
                    {
                        test.MouseDown(p);
                    }
                }
                else if (e.Button == GUI.MouseButtons.Right)
                {
                    lastp      = e.Location;
                    rMouseDown = true;
                }
            }
Exemplo n.º 22
0
        // add demo circle
        void MainMap_MouseDoubleClick(object sender, GUI.MouseEventArgs e)
        {
            var cc = new GMapMarkerCircle(MainMap.FromLocalToLatLng(e.X, e.Y));

            objects.Markers.Add(cc);
        }
Exemplo n.º 23
0
 void DrawingPanel_MouseWheel(object sender, GUI.MouseEventArgs e)
 {
     m_ScaleSlider.Value += 0.001f * e.Delta;
 }
Exemplo n.º 24
0
 void DrawingPanel_MouseUp(object sender, GUI.MouseEventArgs e)
 {
     m_DragFlag = false;
 }
Exemplo n.º 25
0
 // AGV's terrain drawing
 void pbTerrain_MouseDown(object sender, GUI.MouseEventArgs e)
 {
     pbTerrain.Image = CopyImage(OriginalMap);
     //LastX = e.X;
     //LastY = e.Y;
 }
Exemplo n.º 26
0
        protected override void OnMouseUp(GUI.MouseEventArgs e)
        {
            base.OnMouseUp(e);

            m_DragFlag = false;
        }
Exemplo n.º 27
0
 void DrawingPanel_MouseDown(object sender, GUI.MouseEventArgs e)
 {
     m_dx       = e.X - m_x;
     m_dy       = e.Y - m_y;
     m_DragFlag = true;
 }