Ejemplo n.º 1
0
        private void DrawRotationGrabberline(IDisplay display)
        {
            if (display == null || display.GraphicsContext == null)
            {
                return;
            }

            Envelope env = new Envelope(0, 0, 1, 1);

            Polyline pLine = new Polyline();
            Path     path  = new Path();

            pLine.AddPath(path);

            double tol = 25.0 * display.mapScale / (96 / 0.0254);  // [m]

            if (display.SpatialReference != null &&
                display.SpatialReference.SpatialParameters.IsGeographic)
            {
                tol = 180.0 * tol / Math.PI / 6370000.0;
            }

            if (_scaleY > 0)
            {
                path.AddPoint(new Point(env.UpperLeft.X + env.Width / 2, env.UpperLeft.Y));
                path.AddPoint(new Point(env.UpperLeft.X + env.Width / 2, env.UpperLeft.Y + tol / _scaleY));
            }
            else
            {
                path.AddPoint(new Point(env.LowerLeft.X + env.Width / 2, env.LowerLeft.Y));
                path.AddPoint(new Point(env.LowerLeft.X + env.Width / 2, env.LowerLeft.Y + tol / _scaleY));
            }

            SimpleLineSymbol lSym = new SimpleLineSymbol();

            ScaleGeometry(pLine, _scaleX, _scaleY);
            RotateGeometry(pLine, Math.Cos(_angle), Math.Sin(_angle));
            TranslateGeometry(pLine, _xOffset, _yOffset);
            display.Draw(lSym, pLine);
            lSym.Release();
        }
Ejemplo n.º 2
0
        virtual public void DrawGrabbers(IDisplay display)
        {
            IMultiPoint grabbers = Grabbers(display, true);

            if (grabbers == null)
            {
                return;
            }

            System.Drawing.Drawing2D.SmoothingMode smode = display.GraphicsContext.SmoothingMode;
            display.GraphicsContext.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;

            SimplePointSymbol pointSymbol = new SimplePointSymbol();

            pointSymbol.Color        = System.Drawing.Color.White;
            pointSymbol.OutlineColor = System.Drawing.Color.Black;
            pointSymbol.OutlineWidth = 1;
            pointSymbol.Size         = 8;

            if (display.GraphicsContainer.EditMode == GrabberMode.Pointer)
            {
                Ring ring = new Ring();
                for (int i = 0; i < Math.Min(grabbers.PointCount, 4); i++)
                {
                    ring.AddPoint(grabbers[i]);
                }
                Polygon polygon = new Polygon();
                polygon.AddRing(ring);

                SimpleLineSymbol lSymbol = new SimpleLineSymbol();
                lSymbol.Color     = System.Drawing.Color.Gray;
                lSymbol.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
                display.Draw(lSymbol, polygon);
                lSymbol.Release();

                for (int i = 0; i < grabbers.PointCount; i++)
                {
                    if (!UseGrabber((GrabberIDs)i))
                    {
                        continue;
                    }

                    if (i > 7 && pointSymbol.Color == System.Drawing.Color.White)
                    {
                        pointSymbol.Color = System.Drawing.Color.Yellow;
                        DrawRotationGrabberline(display);
                    }
                    display.Draw(pointSymbol, grabbers[i]);
                }
            }
            else if (display.GraphicsContainer.EditMode == GrabberMode.Vertex)
            {
                pointSymbol.Marker = SimplePointSymbol.MarkerType.Square;
                pointSymbol.Size   = 5;

                for (int i = 0; i < grabbers.PointCount; i++)
                {
                    display.Draw(pointSymbol, grabbers[i]);
                }
            }

            display.GraphicsContext.SmoothingMode = smode;
        }