コード例 #1
0
        protected internal override bool MouseMoveCore(MapMouseMoveEventArgs e)
        {
            // This is for the MiniMap:
            // Inform the MiniMap that the selected village changed so that
            // the minimap still pinpoints what we hover while the main map
            // keeps track of just the AttackPlans
            if (e.Village != null)
            {
                if (_hoverVillage != e.Village)
                {
                    _map.EventPublisher.SelectVillages(this, e.Village, VillageTools.SelectVillage);

                    _hoverVillage = e.Village;
                    return(true);
                }
            }
            if (e.Village == null && _hoverVillage != null)
            {
                _map.EventPublisher.Deselect(this);

                _hoverVillage = null;
                return(true);
            }
            return(false);
        }
コード例 #2
0
        /// <summary>
        /// Make the ActiveRectangle move with the mouse.
        /// Display informative tooltip.
        /// </summary>
        protected internal override bool MouseMoveCore(MapMouseMoveEventArgs e)
        {
            if (_showHelpTooltip && _lastTooltipLocation != e.Location)
            {
                _lastTooltipLocation = e.Location;
                _map.ShowTooltip(ControlsRes.ActiveRectangleManipulator_HelpTitle, ControlsRes.ActiveRectangleManipulator_Help);
            }

            CalculateActiveRectanglePosition(e.Location.X, e.Location.Y);
            return(true);
        }
コード例 #3
0
 /// <summary>
 /// Add points to the polygon
 /// </summary>
 protected internal override bool MouseMoveCore(MapMouseMoveEventArgs e)
 {
     if (e.MouseEventArgs.Button == MouseButtons.Left && _isDragging)
     {
         Point currentMap = CreateGamePoint(e.MouseEventArgs.Location);
         if (_lastPosition != currentMap)
         {
             _lastPosition = currentMap;
             SetMapCenter();
         }
     }
     return(false);
 }
コード例 #4
0
        protected internal override bool MouseMoveCore(MapMouseMoveEventArgs e)
        {
            // Draw a rectangle around what would be seen on MouseDown on the mainmap
            Rectangle mainMapGameRectangle = _mainMap.Display.GetGameRectangle();

            _currentLocationMainMapRectangle = _map.Display.GetMapRectangle(mainMapGameRectangle);

            _currentLocationMainMapRectangle = new Rectangle(
                e.Location.X - _currentLocationMainMapRectangle.Value.Width / 2,
                e.Location.Y - _currentLocationMainMapRectangle.Value.Height / 2,
                _currentLocationMainMapRectangle.Value.Width,
                _currentLocationMainMapRectangle.Value.Height);

            return(true);
        }
コード例 #5
0
 public bool MouseMoveCore(MapMouseMoveEventArgs e)
 {
     if (_fullControllManipulator != null)
     {
         return(_fullControllManipulator.MouseMoveCore(e));
     }
     else
     {
         bool redraw = false;
         foreach (ManipulatorBase m in _manipulators)
         {
             redraw |= m.MouseMoveCore(e);
         }
         return(redraw);
     }
 }
コード例 #6
0
        protected internal override bool MouseMoveCore(MapMouseMoveEventArgs e)
        {
            if (e.Village != null && _pinPointedVillage == null && _unpinpointedVillage != e.Village)
            {
                if (_selectedVillage != e.Village)
                {
                    _map.EventPublisher.SelectVillages(this, e.Village, VillageTools.SelectVillage);

                    _selectedVillage     = e.Village;
                    _unpinpointedVillage = null;
                    return(true);
                }
            }
            if (e.Village == null && _pinPointedVillage == null && _selectedVillage != null)
            {
                _selectedVillage = null;
                _map.EventPublisher.Deselect(this);
                return(true);
            }
            return(false);
        }
コード例 #7
0
        private void FindClosestPoint(MapMouseMoveEventArgs e)
        {
            MemoryLayer closetPointLayer = Map1.FindLayer <MemoryLayer>("ClosetPointLayer");

            if (closetPointLayer == null)
            {
                closetPointLayer = new MemoryLayer {
                    Name = "ClosetPointLayer"
                };
                closetPointLayer.Styles.Add(new SymbolStyle(SymbolType.Circle, GeoColor.FromHtml("#AA3F8CB4"), GeoColors.White));
                Map1.AddDynamicLayers("ClosestPointOverlay", closetPointLayer);
            }

            GeoPoint closestPoint = highlightFeature.Geometry.GetClosestPointTo(new GeoPoint(e.WorldCoordinate));

            closetPointLayer.Features.Clear();
            if (closestPoint != null)
            {
                closetPointLayer.Features.Add(new Feature(closestPoint));
                Map1.Refresh("ClosestPointOverlay");
            }
        }
コード例 #8
0
        /// <summary>
        /// Add points to the polygon
        /// </summary>
        protected internal override bool MouseMoveCore(MapMouseMoveEventArgs e)
        {
            if (e.MouseEventArgs.Button == MouseButtons.Left)
            {
                Point currentMap = e.MouseEventArgs.Location;
                if (Control.ModifierKeys.HasFlag(Keys.Control))
                {
                    currentMap.X = _lastAddedMapLocation.X;
                }
                if (Control.ModifierKeys.HasFlag(Keys.Shift))
                {
                    currentMap.Y = _lastAddedMapLocation.Y;
                }

                if (_activePolygon != null && _activePolygon.Drawing && CanAddPointToPolygon(_lastAddedMapLocation, currentMap))
                {
                    // Add extra point to the polygon
                    _activePolygon.Add(currentMap);
                    _lastAddedMapLocation = currentMap;
                    return(true);
                }
            }
            return(false);
        }
コード例 #9
0
 internal protected virtual bool MouseMoveCore(MapMouseMoveEventArgs e)
 {
     return(false);
 }