using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Windows.Forms; using Core.Common.Utils.Collections; using Core.Gis.GeoApi.Geometries; using Core.GIS.SharpMap.Api.Layers; using Core.GIS.SharpMap.UI.Forms; namespace Core.GIS.SharpMap.UI.Tools { public interface IMapTool // TODO: IMapControlTool ? { IMapControl MapControl { get; set; } /// /// Indicates whether what the tool renders in world or screen coordinates. /// When tool renders in screen coordinates - results of render are unaffected by dragging, resize, etc. /// Otherwise results of rendering are related to world coordinates (e.g. specific features, like for selections, tooltips) /// bool RendersInScreenCoordinates { get; } /// /// Returns true if tool is currently busy (working). /// bool IsBusy { get; } /// /// True when tool is currently active (can be used). /// bool IsActive { get; set; } /// /// True when tool is currently enabled. /// bool Enabled { get; } /// /// Returns true if tool is always active, e.g. mouse wheel zoom,. fixed zoom in/out, zoom to map extent ... /// /// If tool is AlwaysActive - Execute() method should be used and not ActivateTool(). /// bool AlwaysActive { get; } /// /// User readable name of tool. /// string Name { get; set; } /// /// Map tool may be applied only to a set of layers. This property allows to define a filter for these layers. /// Then the layers can be obtained using property. /// Func LayerFilter { get; set; } /// /// Returns layers which satisfy . /// IEnumerable Layers { get; } Cursor Cursor { get; } void OnMouseDown(ICoordinate worldPosition, MouseEventArgs e); void OnBeforeMouseMove(ICoordinate worldPosition, MouseEventArgs e, ref bool handled); void OnMouseMove(ICoordinate worldPosition, MouseEventArgs e); void OnMouseUp(ICoordinate worldPosition, MouseEventArgs e); void OnMouseWheel(ICoordinate worldPosition, MouseEventArgs e); void OnMouseDoubleClick(object sender, MouseEventArgs e); void OnMouseHover(ICoordinate worldPosition, EventArgs e); void OnKeyDown(KeyEventArgs e); void OnKeyUp(KeyEventArgs e); /// /// TODO: remove, Render is probably enough ([bouvrie, r29936]: OnPaint is always called on refresh, whereas Render only when draggin) /// /// void OnPaint(PaintEventArgs e); /// /// Renders tool graphics for a given mapBox. /// /// /// void Render(Graphics graphics, Map.Map mapBox); void OnMapLayerRendered(Graphics g, ILayer layer); void OnMapPropertyChanged(object sender, PropertyChangedEventArgs e); void OnMapCollectionChanged(object sender, NotifyCollectionChangingEventArgs e); IEnumerable GetContextMenuItems(ICoordinate worldPosition); void OnDragEnter(DragEventArgs e); void OnDragDrop(DragEventArgs e); /// /// Used for AlwaysActive tools. /// void Execute(); /// /// Cancels the current operation. Map should revert to state before start tool /// void Cancel(); void ActiveToolChanged(IMapTool newTool); // TODO: remove, why tool should know about changes of active tool } }