?? overviewtool.cs
字號:
using System;
using System.Drawing;
using MapInfo.Styles;
using MapInfo.Geometry;
using MapInfo.Web.UI.WebControls;
using MapInfo.Data;
using MapInfo.Mapping;
namespace OverviewSample
{
/// <summary>
/// Summary description for OverviewTool.
/// </summary>
public class OverviewTool :MapTool
{
private string _clientStopMethod;
private string _clientCodeSource = null;
private string _name;
public static readonly string Toolname = "OverviewTool";
private double px;
private double py;
private AreaStyle s;
private FeatureGeometry g;
private MapInfo.Geometry.DPoint centure;
public event System.EventHandler Overviewtoolend ;
public OverviewTool()
{
_name = Toolname;
// We use MapInfo's rectangle drawing client side code
ClientStartMethod = "MapInfoWebPointStart";
ClientStopMethod = "MapInfoWebPointStop";
}
private string _clientStartMethod;
/// <summary>
/// Name of the tool, by default it is ZoomInTool
/// </summary>
public override string Name
{
get { return _name; }
set { _name = value; }
}
/// <summary>
/// Name of the client side method to set up mouse event handlers for drawing
/// </summary>
public override string ClientStartMethod
{
get { return _clientStartMethod; }
set { _clientStartMethod = value; }
}
/// <summary>
/// Name of the client side method to cancel the mouse event handlers
/// </summary>
public override string ClientStopMethod
{
get { return _clientStopMethod; }
set { _clientStopMethod = value; }
}
/// <summary>
/// Source or url where the client drawing code is located
/// </summary>
public override string ClientCodeSource
{
get { return _clientCodeSource; }
set { _clientCodeSource = value; }
}
/// <summary>
/// Url of the cursor image when this tool is active
/// </summary>
public override string CursorUrl
{
get {return ""; }
set {; }
}
/// <summary>
/// This method sets the zoom value
/// </summary>
///
protected void OnOverviewtoolend(EventArgs e)
{
if(Overviewtoolend != null)
Overviewtoolend(this,e);
}
public double getpx()
{
return px;
}
public double getpy()
{
return py;
}
public DPoint getPoint()
{
return centure;
}
public override void Execute(string dataString, System.Collections.ArrayList arrayList, MapInfo.Mapping.Map map)
{
//ExtractPoints: 提取字符串中的點
System.Drawing.Point [] points = base.ExtractPoints(dataString);
px= points[0].X;
py=points[0].Y;
// // There will be two points, end of rectangle in screen coordinates, convert them to spatial
map.DisplayTransform.FromDisplay(points[0], out centure);
OnOverviewtoolend(EventArgs.Empty );
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -