using System;
using System.Collections.Generic;
using System.Text;
using OSGeo.MapGuide;
using System.Drawing;
using System.ComponentModel;
namespace OSGeo.MapGuide.Viewer
{
///
/// A callback for circle digitization
///
/// The X coordinate of the circle's center
/// The Y coordinate of the circle's center
/// The circle's radius
public delegate void CircleDigitizationCallback(double x, double y, double radius);
///
/// A callback for line digitization
///
/// The X coordinate of the line's first point
/// The Y coordinate of the line's first point
/// The X coordinate of the line's second point
/// The Y coordinate of the line's second point
public delegate void LineDigitizationCallback(double x1, double y1, double x2, double y2);
///
/// A callback for point digitization
///
/// The X coordinate of the point
/// The Y coordinate of the point
public delegate void PointDigitizationCallback(double x, double y);
///
/// A callback for polygon digitization
///
/// A n by 2 array of polygon coordinates, where n is the number of vertices
public delegate void PolygonDigitizationCallback(double[,] coordinates);
///
/// A callback for line string digitization
///
/// A n by 2 array of line string coordinates, where n is the number of vertices
public delegate void LineStringDigitizationCallback(double[,] coordinates);
///
/// A callback for rectangle digitization
///
/// The X coordinate of the rectangle's lower left point
/// The Y coordinate of the rectangle's lower left point
/// The X coordinate of the rectangle's upper right point
/// The Y coordinate of the rectangle's upper right point
public delegate void RectangleDigitizationCallback(double llx, double lly, double urx, double ury);
///
/// A map viewer component
///
public interface IMapViewer : IMapViewerComponent, INotifyPropertyChanged
{
///
/// Clears the current selection
///
void ClearSelection();
///
/// Starts the digitization process for a circle
///
/// The callback to be invoked when the digitization process completes
void DigitizeCircle(CircleDigitizationCallback callback);
///
/// Starts the digitization process for a line
///
/// The callback to be invoked when the digitization process completes
void DigitizeLine(LineDigitizationCallback callback);
///
/// Starts the digitization process for a point
///
/// The callback to be invoked when the digitization process completes
void DigitizePoint(PointDigitizationCallback callback);
///
/// Starts the digitization process for a polygon
///
/// The callback to be invoked when the digitization process completes
void DigitizePolygon(PolygonDigitizationCallback callback);
///
/// Starts the digitization process for a line string (polyline)
///
/// The callback to be invoked when the digitization process completes
void DigitizeLineString(LineStringDigitizationCallback callback);
///
/// Starts the digitization process for a rectangle
///
/// The callback to be invoked when the digitization process completes
void DigitizeRectangle(RectangleDigitizationCallback callback);
///
/// Gets the current runtime map
///
///
MgMapBase GetMap();
///
/// Gets the selection set of the runtime map
///
///
MgSelectionBase GetSelection();
///
/// Gets the coordinate system of the runtime map
///
MgCoordinateSystem CoordinateSystem { get; }
///
/// Gets or sets the color used to render selected features
///
Color SelectionColor { get; set; }
///
/// Gets or sets the active tool
///
MapActiveTool ActiveTool { get; set; }
///
/// Gets the map viewer provider for this control
///
///
MgMapViewerProvider GetProvider();
///
/// Gets or sets the factor by which to multiply the scale to zoom in
///
double ZoomInFactor { get; set; }
///
/// Gets or sets the factor by which to multiply the scale to zoom out
///
double ZoomOutFactor { get; set; }
///
/// Gets or sets whether feature tooltips are enabled. If set to true, tooltip queries are
/// executed at the current mouse position if the active tool is Pan or Select
///
bool FeatureTooltipsEnabled { get; set; }
///
/// Gets whether the viewer has any active rendering operations
///
bool IsBusy { get; }
///
/// Gets the type of object being currently digitized. If the digitization type is None, then
/// the viewer is not currently digitizing
///
MapDigitizationType DigitizingType { get; }
///
/// Copies the image of the current map to the clipboard
///
void CopyMap();
///
/// Refreshes the current map view
///
void RefreshMap();
///
/// Raised when the map has been refreshed
///
event EventHandler MapRefreshed;
///
/// Pans the view left by a pre-defined distance
///
///
void PanLeft(bool refresh);
///
/// Pans the view up by a pre-defined distance
///
///
void PanUp(bool refresh);
///
/// Pans the view right by a pre-defined distance
///
///
void PanRight(bool refresh);
///
/// Pans the view down by a pre-defined distance
///
///
void PanDown(bool refresh);
///
/// Updates the rendered selection. Call this method if you have manipulated the selection
/// set outside of the viewer
///
void UpdateSelection();
///
/// Selects features from all selectable layers that intersects the given geometry
///
///
void SelectByGeometry(MgGeometry geom);
///
/// Zooms to the initial map view
///
void InitialMapView();
///
/// Zooms to the specified map view
///
///
///
///
///
void ZoomToView(double x, double y, double scale, bool refresh);
///
/// Raised when the scale of the current runtime map has changed
///
event EventHandler MapScaleChanged;
///
/// Raised when the selection has changed. Note that programmatic selection modifications
/// will not raise this event.
///
event EventHandler SelectionChanged;
///
/// Raised when the viewer has been initialized
///
event EventHandler ViewerInitialized;
///
/// Raised when the map cursor position has changed
///
event EventHandler MouseMapPositionChanged;
///
/// Zooms to the view defined by the specified extent
///
///
///
///
///
void ZoomToExtents(double llx, double lly, double urx, double ury);
}
///
/// Contains data of a MouseMapPositionChanged event
///
public class MapPointEventArgs : EventArgs
{
///
/// Gets the X coordinate
///
public readonly double X;
///
/// Gets the Y coordinate
///
public readonly double Y;
///
///
///
///
///
public MapPointEventArgs(double x, double y)
{
this.X = x;
this.Y = y;
}
}
///
/// The type of digitization in progress
///
public enum MapDigitizationType
{
///
/// No digitization in progress
///
None,
///
/// A point digitization is in progress
///
Point,
///
/// A line digitization is in progress
///
Line,
///
/// A line string digitization is in progress
///
LineString,
///
/// A rectangle digitization is in progress
///
Rectangle,
///
/// A polygon digitization is in progress
///
Polygon,
///
/// A circle digitization is in progress
///
Circle
}
///
/// The active viewer tool
///
public enum MapActiveTool
{
///
/// Zoom In command
///
ZoomIn,
///
/// Zoom Out command
///
ZoomOut,
///
/// Pan command
///
Pan,
///
/// Select command
///
Select,
///
/// No active command
///
None
}
}