コード例 #1
0
        public SymbolRotater(IAppContext context, SymbologyPlugin plugin)
        {
            _context = context ?? throw new ArgumentNullException("context");
            _plugin  = plugin ?? throw new ArgumentNullException("plugin");
            _map     = context.Map;

            _currentObject = new SymbolRotateData(_map, -1, -1);

            plugin.MouseDown += MapMouseDown;
            plugin.MouseUp   += MapMouseUp;
            plugin.MouseMove += MapMouseMove;
        }
コード例 #2
0
        public SymbolRotater(IAppContext context, SymbologyPlugin plugin)
        {
            _context = context ?? throw new ArgumentNullException("context");
            _map     = context.Map;

            SnapAngleDrawer = new SnapAngleDrawer(_map, _context.Config);

            CurrentObject = new SymbolRotateData(_map, -1, -1, 0, 0);

            plugin.MouseDown      += MapMouseDown;
            plugin.MouseUp        += MapMouseUp;
            plugin.MouseMove      += MapMouseMove;
            plugin.ExtentsChanged += MapExtentsChanged;
        }
コード例 #3
0
        private void DrawSnapAngle(ObjectRotateData currentObject, double angle)
        {
            double radAngle = angle * toRadiansFactor;

            Map.ProjToPixel(currentObject.X, currentObject.Y, out double x, out double y);

            x += Math.Cos(radAngle) * 25;
            y += Math.Sin(radAngle) * 25;

            double x2 = x + Math.Cos(radAngle) * 35;
            double y2 = y + Math.Sin(radAngle) * 35;

            Map.Drawing.DrawLine(layerHandle, x, y, x2, y2, 2, Config.MeasuringLineColor);
            Map.Drawing.DrawLine(layerHandle, x, y, x2, y2, 2, Config.MeasuringLineColor);
        }
コード例 #4
0
        /// <summary>
        /// Start the dragging operation.
        /// </summary>
        private void MapMouseDown(IMuteMap map, MouseEventArgs e)
        {
            if (!Active)
            {
                return;
            }

            var data = FindRotatebleItem(e.X, e.Y);

            if (data == null)
            {
                return;
            }

            _currentObject = data;
        }
コード例 #5
0
        public void DrawSnapAngles(ObjectRotateData currentObject, bool shiftDown, bool ctrlDown, bool force = false)
        {
            if ((!shiftDown && !ctrlDown) || currentObject.LayerHandle == -1)
            {
                ClearSnapAngleDrawings();
                return;
            }

            if (!force && lastSnapShiftDown == shiftDown && lastSnapCtrlDown == ctrlDown)
            {
                return;
            }

            if (shiftDown || ctrlDown)
            {
                ForceDrawSnapAngles(currentObject, shiftDown, ctrlDown);
            }
        }
コード例 #6
0
        private void ForceDrawSnapAngles(ObjectRotateData currentObject, bool shiftDown, bool ctrlDown)
        {
            ClearSnapAngleDrawings();

            lastSnapShiftDown = shiftDown;
            lastSnapCtrlDown  = ctrlDown;

            if (ctrlDown)
            {
                foreach (var angle in currentObject.CartesianAngles)
                {
                    DrawSnapAngle(currentObject, angle);
                }
            }

            if (shiftDown)
            {
                foreach (var angle in currentObject.SegmentAngles)
                {
                    DrawSnapAngle(currentObject, angle);
                }
            }
        }