├── OpenPlot4AO ├── Docs │ └── 01 OpenPlot组件概述.md ├── OpenPlot4AO.suo ├── NovGIS.OpenPlot.Samples.Dev │ ├── app.config │ ├── Properties │ │ ├── Settings.settings │ │ ├── Settings.Designer.cs │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ └── Resources.resx │ ├── FrmMain.cs │ ├── Program.cs │ ├── FrmMain.Designer.cs │ └── NovGIS.OpenPlot.Samples.Dev.csproj ├── NovGIS.OpenPlot.Controls │ ├── SystemUI │ │ ├── Arrow │ │ │ ├── BaseLinerArrowTool.cs │ │ │ └── LinerLineHorizonArrowTool.cs │ │ ├── Linear │ │ │ └── BaseLinearPlotTool.cs │ │ ├── Marker │ │ │ └── BaseMarkerPlotTool.cs │ │ ├── CommandHost.cs │ │ └── ToolHost.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── NovGIS.OpenPlot.Controls.csproj ├── NovGIS.OpenPlot.Core │ ├── Element │ │ ├── IPlotProperties.cs │ │ ├── LabelAnchor.cs │ │ └── LinearPlotElement.cs │ ├── Geometry │ │ ├── IPlot.cs │ │ ├── Arrow │ │ │ ├── LinerLineHorizonArrow.cs │ │ │ └── AbsArrowPlot.cs │ │ ├── Marker │ │ │ └── MarkerPlot.cs │ │ ├── Linear │ │ │ └── LinearPlot.cs │ │ └── PlotType.cs │ ├── Utils │ │ ├── XmlUtil.cs │ │ └── MathUtil.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ └── NovGIS.OpenPlot.Core.csproj ├── OpenPlot4AO.sln.DotSettings.user └── OpenPlot4AO.sln ├── README.md └── LICENSE /OpenPlot4AO/Docs/01 OpenPlot组件概述.md: -------------------------------------------------------------------------------- 1 | # OpenPlot 2 | 3 | 一款开源的地理信息标绘组件, -------------------------------------------------------------------------------- /OpenPlot4AO/OpenPlot4AO.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/novgis/OpenPlot/HEAD/OpenPlot4AO/OpenPlot4AO.suo -------------------------------------------------------------------------------- /OpenPlot4AO/NovGIS.OpenPlot.Samples.Dev/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /OpenPlot4AO/NovGIS.OpenPlot.Controls/SystemUI/Arrow/BaseLinerArrowTool.cs: -------------------------------------------------------------------------------- 1 | using NovGIS.OpenPlot.SystemUI; 2 | 3 | namespace NovGIS.OpenPlot.SystemUI 4 | { 5 | public abstract class BaseLinerArrowTool : ToolHost 6 | { 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /OpenPlot4AO/NovGIS.OpenPlot.Controls/SystemUI/Arrow/LinerLineHorizonArrowTool.cs: -------------------------------------------------------------------------------- 1 | using NovGIS.OpenPlot.SystemUI; 2 | 3 | namespace NovGIS.OpenPlot.SystemUI 4 | { 5 | public class LinerLineHorizonArrowTool : ToolHost 6 | { 7 | 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /OpenPlot4AO/NovGIS.OpenPlot.Controls/SystemUI/Linear/BaseLinearPlotTool.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace NovGIS.OpenPlot.SystemUI 7 | { 8 | class BaseLinearPlotTool 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /OpenPlot4AO/NovGIS.OpenPlot.Controls/SystemUI/Marker/BaseMarkerPlotTool.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace NovGIS.OpenPlot.SystemUI 7 | { 8 | class BaseMarkerPlotTool 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /OpenPlot4AO/NovGIS.OpenPlot.Core/Element/IPlotProperties.cs: -------------------------------------------------------------------------------- 1 | namespace NovGIS.OpenPlot.Element 2 | { 3 | /// 4 | /// 标绘元素的标注 5 | /// 6 | public interface IPlotProperties 7 | { 8 | LabelAnchor LabelAnchor { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /OpenPlot4AO/NovGIS.OpenPlot.Core/Element/LabelAnchor.cs: -------------------------------------------------------------------------------- 1 | namespace NovGIS.OpenPlot.Element 2 | { 3 | public enum LabelAnchor 4 | { 5 | eEnvelopLeft, 6 | eEnvelopTop, 7 | eEnvelopRight, 8 | eEnvelopBottom, 9 | eEnvelopCenter, 10 | eCustom 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /OpenPlot4AO/NovGIS.OpenPlot.Samples.Dev/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /OpenPlot4AO/NovGIS.OpenPlot.Samples.Dev/FrmMain.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Text; 5 | using System.Windows.Forms; 6 | 7 | namespace NovGIS.OpenPlot.Samples.Dev 8 | { 9 | public partial class FrmMain : Form 10 | { 11 | public FrmMain() 12 | { 13 | InitializeComponent(); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /OpenPlot4AO/OpenPlot4AO.sln.DotSettings.user: -------------------------------------------------------------------------------- 1 | 2 | <AssemblyExplorer /> -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OpenPlot 2 | 一款开源的地理信息标绘组件 3 | 4 | # v1.0 5 | 实现了基于 ArcGIS Engine + DevExpress 的客户端地理信息标绘组件,目前主要运用在防火指挥业务中,包括火场态势标绘、扑火战术标绘、队伍和物资调度、阻隔调度等。支持各元素的动态标绘、编辑、序列化反序列以及标注业务 6 | 7 | 主要实现的功能: 8 | - 点:各类业务元素 9 | - 线:直线、折线、弧线、自由线 10 | - 面:多边形、自由面 11 | - 箭标:内向钳形箭标、外向钳形箭标、多方向钳形箭标、行进方向等 12 | - 标绘元素序列化与反序列化 13 | - 标注的集成 14 | 15 | ### 使用截图 16 | ![](http://7xteqg.com1.z0.glb.clouddn.com/plot/display.gif) 17 | 18 | # v2.0 19 | 实现不依赖于任何第三方库的标绘元素的生成,如钳形箭标等 20 | 21 | # v3.0 22 | 下一步集成 JavaScript API 的设计实现 23 | 24 | # v4.0 25 | 最终目标是完成多终端的协同标绘,主要考虑协议、消息的设计处理 -------------------------------------------------------------------------------- /OpenPlot4AO/NovGIS.OpenPlot.Samples.Dev/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Windows.Forms; 4 | 5 | namespace NovGIS.OpenPlot.Samples.Dev 6 | { 7 | static class Program 8 | { 9 | /// 10 | /// 应用程序的主入口点。 11 | /// 12 | [STAThread] 13 | static void Main() 14 | { 15 | Application.EnableVisualStyles(); 16 | Application.SetCompatibleTextRenderingDefault(false); 17 | Application.Run(new FrmMain()); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /OpenPlot4AO/NovGIS.OpenPlot.Core/Geometry/IPlot.cs: -------------------------------------------------------------------------------- 1 | using ESRI.ArcGIS.Geometry; 2 | 3 | namespace NovGIS.OpenPlot.Geometry 4 | { 5 | public interface IPlot 6 | { 7 | /// 8 | /// 标绘元素类型 9 | /// 10 | PlotType PlotType { get; } 11 | /// 12 | /// 标绘元素几何图形 13 | /// 14 | IGeometry Shape { get; } 15 | /// 16 | /// 标绘元素控制点 17 | /// 18 | IPoint[] ControlPoints { get; } 19 | /// 20 | /// 设值标绘元素的控制点 21 | /// 22 | /// 控制点 23 | void PutCoords(IPoint[] controlPoints); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /OpenPlot4AO/NovGIS.OpenPlot.Core/Geometry/Arrow/LinerLineHorizonArrow.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using ESRI.ArcGIS.Geometry; 4 | 5 | namespace NovGIS.OpenPlot.Geometry 6 | { 7 | public class LinerLineHorizonArrow : AbsArrowPlot 8 | { 9 | public override PlotType PlotType { get { return PlotType.eLinerLineHorizonArrow; } } 10 | 11 | protected override int ControlPointsCount { get { return 2; } } 12 | 13 | protected override List GetAnchorPoints() 14 | { 15 | throw new NotImplementedException(); 16 | } 17 | 18 | protected override IGeometry GetShape() 19 | { 20 | throw new NotImplementedException(); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /OpenPlot4AO/NovGIS.OpenPlot.Core/Geometry/Marker/MarkerPlot.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ESRI.ArcGIS.Geometry; 3 | 4 | namespace NovGIS.OpenPlot.Geometry 5 | { 6 | public class MarkerPlot : IPlot 7 | { 8 | public PlotType PlotType { get { return PlotType.eMarker; } } 9 | 10 | public IGeometry Shape { get; private set; } 11 | 12 | public IPoint[] ControlPoints { get; private set; } 13 | 14 | public void PutCoords(IPoint[] controlPoints) 15 | { 16 | if (controlPoints.Length != 1) 17 | throw new ArgumentException("传入的标绘元素控制点个数与元素最小控制点数不匹配"); 18 | //GetControlPoints() 19 | this.ControlPoints = controlPoints; 20 | //GetShape() 21 | this.Shape = controlPoints[0]; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /OpenPlot4AO/NovGIS.OpenPlot.Core/Utils/XmlUtil.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Xml.Serialization; 3 | 4 | namespace NovGIS.OpenPlot.Core 5 | { 6 | public static class XmlUtil 7 | { 8 | /// 9 | /// 泛型对象克隆 10 | /// 11 | /// 12 | /// 13 | /// 14 | public static T Clone(T realObject) 15 | { 16 | using (Stream stream = new MemoryStream()) 17 | { 18 | XmlSerializer serializer = new XmlSerializer(typeof(T)); 19 | serializer.Serialize(stream, realObject); 20 | stream.Seek(0, SeekOrigin.Begin); 21 | return (T)serializer.Deserialize(stream); 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /OpenPlot4AO/NovGIS.OpenPlot.Core/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的常规信息通过以下 5 | // 特性集控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("NovGIS.OpenPlot.Core")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("NovGIS.OpenPlot.Core")] 12 | [assembly: AssemblyCopyright("Copyright © 2016")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // 将 ComVisible 设置为 false 使此程序集中的类型 17 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, 18 | // 则将该类型上的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("1d99f94d-1b59-4d1d-a42e-2727c12eeae3")] 23 | 24 | // 程序集的版本信息由下面四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 内部版本号 29 | // 修订号 30 | // 31 | // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /OpenPlot4AO/NovGIS.OpenPlot.Samples.Dev/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本:4.0.30319.18408 5 | // 6 | // 对此文件的更改可能会导致不正确的行为,并且如果 7 | // 重新生成代码,这些更改将会丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace NovGIS.OpenPlot.Samples.Dev.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /OpenPlot4AO/NovGIS.OpenPlot.Controls/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("NovGIS.OpenPlot.Controls")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("NovGIS.OpenPlot.Controls")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("a11d96de-cae6-4247-b539-11da1b9a7066")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 内部版本号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /OpenPlot4AO/NovGIS.OpenPlot.Samples.Dev/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("NovGIS.OpenPlot.Samples.Dev")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("NovGIS.OpenPlot.Samples.Dev")] 13 | [assembly: AssemblyCopyright("Copyright © 2016")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("e75e9b0e-f35b-4434-a207-bf371a2ca813")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 内部版本号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /OpenPlot4AO/NovGIS.OpenPlot.Samples.Dev/FrmMain.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace NovGIS.OpenPlot.Samples.Dev 2 | { 3 | partial class FrmMain 4 | { 5 | /// 6 | /// 必需的设计器变量。 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// 清理所有正在使用的资源。 12 | /// 13 | /// 如果应释放托管资源,为 true;否则为 false。 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows 窗体设计器生成的代码 24 | 25 | /// 26 | /// 设计器支持所需的方法 - 不要 27 | /// 使用代码编辑器修改此方法的内容。 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.components = new System.ComponentModel.Container(); 32 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 33 | this.Text = "Form1"; 34 | } 35 | 36 | #endregion 37 | } 38 | } 39 | 40 | -------------------------------------------------------------------------------- /OpenPlot4AO/NovGIS.OpenPlot.Core/Geometry/Arrow/AbsArrowPlot.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using ESRI.ArcGIS.Geometry; 4 | 5 | namespace NovGIS.OpenPlot.Geometry 6 | { 7 | public abstract class AbsArrowPlot : IPlot 8 | { 9 | public abstract PlotType PlotType { get; } 10 | public IGeometry Shape { get; private set; } 11 | public IPoint[] ControlPoints { get; private set; } 12 | 13 | /// 14 | /// 箭标最小控制点数 15 | /// 用于校验传入的控制点集合 16 | /// 17 | protected abstract int ControlPointsCount { get; } 18 | /// 19 | /// 由计算得来的箭标箭身锚点 20 | /// 21 | protected List AnchorPoints { get; private set; } 22 | protected abstract List GetAnchorPoints(); 23 | protected abstract IGeometry GetShape(); 24 | 25 | public void PutCoords(IPoint[] controlPoints) 26 | { 27 | if (controlPoints.Length != this.ControlPointsCount) 28 | throw new ArgumentException(string.Format("箭标的控制点数必须为 {0} 个", ControlPointsCount)); 29 | this.ControlPoints = controlPoints; 30 | this.AnchorPoints = GetAnchorPoints(); 31 | this.Shape = GetShape(); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /OpenPlot4AO/NovGIS.OpenPlot.Controls/SystemUI/CommandHost.cs: -------------------------------------------------------------------------------- 1 | using ESRI.ArcGIS.SystemUI; 2 | 3 | namespace NovGIS.OpenPlot.SystemUI 4 | { 5 | public class CommandHost : ICommand 6 | { 7 | //ICommand 8 | protected int _bitmap = -1; 9 | protected string _caption = ""; 10 | protected string _category = ""; 11 | protected bool _checked = false; 12 | protected bool _enabled = true; 13 | protected int _helpContextID = -1; 14 | protected string _helpFile; 15 | protected string _message; 16 | protected string _name; 17 | protected string _tooltip; 18 | 19 | public virtual int Bitmap { get { return _bitmap; } } 20 | public virtual string Caption { get { return _caption; } } 21 | public virtual string Category { get { return _category; } } 22 | public virtual bool Checked { get { return _checked; } } 23 | public virtual bool Enabled { get { return _enabled; } } 24 | public virtual int HelpContextID { get { return _helpContextID; } } 25 | public virtual string HelpFile { get { return _helpFile; } } 26 | public virtual string Message { get { return _message; } } 27 | public virtual string Name { get { return _name; } } 28 | public virtual string Tooltip { get { return _tooltip; } } 29 | 30 | public virtual void OnClick() { } 31 | public virtual void OnCreate(object hook) { } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /OpenPlot4AO/NovGIS.OpenPlot.Core/Geometry/Linear/LinearPlot.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ESRI.ArcGIS.Geometry; 3 | 4 | namespace NovGIS.OpenPlot.Geometry 5 | { 6 | public class LinearPlot : IPlot 7 | { 8 | public PlotType PlotType { get { return PlotType.eLinear; } } 9 | 10 | public IGeometry Shape { get; private set; } 11 | 12 | public IPoint[] ControlPoints { get; private set; } 13 | 14 | public void PutCoords(IPoint[] controlPoints) 15 | { 16 | if (controlPoints.Length < 2) 17 | throw new ArgumentException("传入的标绘元素控制点个数与元素最小控制点数不匹配"); 18 | //GetControlPoints() 19 | this.ControlPoints = controlPoints; 20 | //GetShape() 21 | object objBefore = Type.Missing; 22 | object objAfter = Type.Missing; 23 | ISegmentCollection segment = new PathClass(); 24 | for (int i = 0; i < controlPoints.Length - 1; i++) 25 | { 26 | ILine line = new LineClass { FromPoint = controlPoints[i], ToPoint = controlPoints[i + 1] }; 27 | segment.AddSegment((ISegment)line, objBefore, objAfter); 28 | } 29 | IPath path = (IPath)segment; 30 | IGeometryCollection polyline = new PolylineClass(); 31 | polyline.AddGeometry(path, ref objBefore, ref objAfter); 32 | IGeometry geometry = (IGeometry)polyline; 33 | // ITopologicalOperator topo = polyline as ITopologicalOperator; 34 | // topo.Simplify(); 35 | this.Shape = geometry; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /OpenPlot4AO/NovGIS.OpenPlot.Controls/SystemUI/ToolHost.cs: -------------------------------------------------------------------------------- 1 | using ESRI.ArcGIS.SystemUI; 2 | 3 | namespace NovGIS.OpenPlot.SystemUI 4 | { 5 | public class ToolHost : CommandHost, ITool 6 | { 7 | private bool _mouseDown; 8 | private int _mouseDownX = -1; 9 | private int _mouseDownY = -1; 10 | 11 | public virtual int Cursor { get { return -1; } } 12 | 13 | public virtual void OnMouseDown(int button, int shift, int x, int y) 14 | { 15 | this._mouseDownX = x; 16 | this._mouseDownY = y; 17 | this._mouseDown = true; 18 | } 19 | public virtual void OnMouseUp(int button, int shift, int x, int y) 20 | { 21 | if (this._mouseDownX == x && this._mouseDownY == y) 22 | this.OnMouseClick(button, shift, x, y); 23 | this._mouseDownX = -1; 24 | this._mouseDownY = -1; 25 | this._mouseDown = false; 26 | } 27 | public virtual void OnMouseMove(int button, int shift, int x, int y) { } 28 | public virtual void OnDblClick() { } 29 | public virtual void OnKeyDown(int keyCode, int shift) { } 30 | public virtual void OnKeyUp(int keyCode, int shift) { } 31 | public virtual bool OnContextMenu(int x, int y) { return false; } 32 | public virtual void Refresh(int hdc) { } 33 | public virtual bool Deactivate() { return true; } 34 | //扩展OnMouseClick事件 35 | public virtual void OnMouseClick(int button, int shift, int x, int y) { } 36 | //public virtual void OnMouseHover(int button, int shift, int x, int y) { } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /OpenPlot4AO/NovGIS.OpenPlot.Core/Geometry/PlotType.cs: -------------------------------------------------------------------------------- 1 | namespace NovGIS.OpenPlot.Geometry 2 | { 3 | public enum PlotType 4 | { 5 | /// 6 | /// 空 7 | /// 8 | eNone = -1, 9 | /// 10 | /// 标记元素 11 | /// 12 | eMarker = 0, 13 | /// 14 | /// 线状元素 15 | /// 16 | eLinear, 17 | /// 18 | /// 外钳击面箭标 19 | /// 20 | ePliersOuterArrow, 21 | /// 22 | /// 外钳击线箭标 23 | /// 24 | ePliersLineOuterArrow, 25 | /// 26 | /// 内钳击面箭标 27 | /// 28 | ePliersInnerArrow, 29 | /// 30 | /// 内钳击线箭标 31 | /// 32 | ePliersLineInnerArrow, 33 | /// 34 | /// 直边燕尾面箭标 35 | /// 36 | eLinerPolygonTailedArrow, 37 | /// 38 | /// 直边平尾面箭标 39 | /// 40 | eLinerPolygonHorizonArrow, 41 | /// 42 | /// 直边平尾线箭标 43 | /// 44 | eLinerLineHorizonArrow, 45 | /// 46 | /// 直边燕尾线箭标 47 | /// 48 | eLinerLineTailedArrow, 49 | /// 50 | /// 直边无尾线箭标 51 | /// 52 | eLinerLineTaillessArrow, 53 | /// 54 | /// 弯边无尾线箭标 55 | /// 56 | eCubicLineTaillessArrow, 57 | /// 58 | /// 弯边燕尾线箭标 59 | /// 60 | eCubicLineTailedArrow, 61 | /// 62 | /// 弯边平尾线箭标 63 | /// 64 | eCubicLineHorizonArrow, 65 | /// 66 | /// 弯边燕尾面箭标 67 | /// 68 | eCubicPolygonTailedArrow, 69 | /// 70 | /// 弯边平尾面箭标 71 | /// 72 | eCubicPolygonHorizonArrow, 73 | /// 74 | /// 曲边燕尾面箭标 75 | /// 76 | eBezierPolygonTailedArrow, 77 | /// 78 | /// 曲边平尾面箭标 79 | /// 80 | eBezierPolygonHorizonArrow, 81 | /// 82 | /// 曲边燕尾线箭标 83 | /// 84 | eBezierLineTailedArrow, 85 | /// 86 | /// 曲边平尾线箭标 87 | /// 88 | eBezierLineHorizonArrow, 89 | /// 90 | /// 曲边无尾线箭标 91 | /// 92 | eBezierLineTaillessArrow 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /OpenPlot4AO/NovGIS.OpenPlot.Samples.Dev/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // 此代码由工具生成。 4 | // 运行时版本:4.0.30319.18408 5 | // 6 | // 对此文件的更改可能会导致不正确的行为,并且如果 7 | // 重新生成代码,这些更改将会丢失。 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace NovGIS.OpenPlot.Samples.Dev.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// 一个强类型的资源类,用于查找本地化的字符串等。 17 | /// 18 | // 此类是由 StronglyTypedResourceBuilder 19 | // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 20 | // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen 21 | // (以 /str 作为命令选项),或重新生成 VS 项目。 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// 返回此类使用的缓存的 ResourceManager 实例。 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("NovGIS.OpenPlot.Samples.Dev.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// 使用此强类型资源类,为所有资源查找 51 | /// 重写当前线程的 CurrentUICulture 属性。 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /OpenPlot4AO/NovGIS.OpenPlot.Controls/NovGIS.OpenPlot.Controls.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {A62D7EE6-F4D5-4858-96B5-A815EA4EB466} 9 | Library 10 | Properties 11 | NovGIS.OpenPlot.Controls 12 | NovGIS.OpenPlot.Controls 13 | v4.0 14 | 512 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | True 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | {27C208D1-5C30-4F0A-9E4B-942921394F53} 52 | NovGIS.OpenPlot.Core 53 | 54 | 55 | 56 | 57 | 64 | -------------------------------------------------------------------------------- /OpenPlot4AO/NovGIS.OpenPlot.Core/NovGIS.OpenPlot.Core.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {27C208D1-5C30-4F0A-9E4B-942921394F53} 9 | Library 10 | Properties 11 | NovGIS.OpenPlot.Core 12 | NovGIS.OpenPlot.Core 13 | v4.0 14 | 512 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | True 36 | 37 | 38 | True 39 | 40 | 41 | False 42 | 43 | 44 | False 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 73 | -------------------------------------------------------------------------------- /OpenPlot4AO/OpenPlot4AO.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NovGIS.OpenPlot.Core", "NovGIS.OpenPlot.Core\NovGIS.OpenPlot.Core.csproj", "{27C208D1-5C30-4F0A-9E4B-942921394F53}" 5 | EndProject 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NovGIS.OpenPlot.Controls", "NovGIS.OpenPlot.Controls\NovGIS.OpenPlot.Controls.csproj", "{A62D7EE6-F4D5-4858-96B5-A815EA4EB466}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NovGIS.OpenPlot.Samples.Dev", "NovGIS.OpenPlot.Samples.Dev\NovGIS.OpenPlot.Samples.Dev.csproj", "{DD228A35-2006-4692-8284-A8CCA68C22C1}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Debug|Mixed Platforms = Debug|Mixed Platforms 14 | Debug|x86 = Debug|x86 15 | Release|Any CPU = Release|Any CPU 16 | Release|Mixed Platforms = Release|Mixed Platforms 17 | Release|x86 = Release|x86 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {27C208D1-5C30-4F0A-9E4B-942921394F53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {27C208D1-5C30-4F0A-9E4B-942921394F53}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {27C208D1-5C30-4F0A-9E4B-942921394F53}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU 23 | {27C208D1-5C30-4F0A-9E4B-942921394F53}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU 24 | {27C208D1-5C30-4F0A-9E4B-942921394F53}.Debug|x86.ActiveCfg = Debug|Any CPU 25 | {27C208D1-5C30-4F0A-9E4B-942921394F53}.Release|Any CPU.ActiveCfg = Release|Any CPU 26 | {27C208D1-5C30-4F0A-9E4B-942921394F53}.Release|Any CPU.Build.0 = Release|Any CPU 27 | {27C208D1-5C30-4F0A-9E4B-942921394F53}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU 28 | {27C208D1-5C30-4F0A-9E4B-942921394F53}.Release|Mixed Platforms.Build.0 = Release|Any CPU 29 | {27C208D1-5C30-4F0A-9E4B-942921394F53}.Release|x86.ActiveCfg = Release|Any CPU 30 | {A62D7EE6-F4D5-4858-96B5-A815EA4EB466}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 31 | {A62D7EE6-F4D5-4858-96B5-A815EA4EB466}.Debug|Any CPU.Build.0 = Debug|Any CPU 32 | {A62D7EE6-F4D5-4858-96B5-A815EA4EB466}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU 33 | {A62D7EE6-F4D5-4858-96B5-A815EA4EB466}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU 34 | {A62D7EE6-F4D5-4858-96B5-A815EA4EB466}.Debug|x86.ActiveCfg = Debug|Any CPU 35 | {A62D7EE6-F4D5-4858-96B5-A815EA4EB466}.Release|Any CPU.ActiveCfg = Release|Any CPU 36 | {A62D7EE6-F4D5-4858-96B5-A815EA4EB466}.Release|Any CPU.Build.0 = Release|Any CPU 37 | {A62D7EE6-F4D5-4858-96B5-A815EA4EB466}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU 38 | {A62D7EE6-F4D5-4858-96B5-A815EA4EB466}.Release|Mixed Platforms.Build.0 = Release|Any CPU 39 | {A62D7EE6-F4D5-4858-96B5-A815EA4EB466}.Release|x86.ActiveCfg = Release|Any CPU 40 | {DD228A35-2006-4692-8284-A8CCA68C22C1}.Debug|Any CPU.ActiveCfg = Debug|x86 41 | {DD228A35-2006-4692-8284-A8CCA68C22C1}.Debug|Mixed Platforms.ActiveCfg = Debug|x86 42 | {DD228A35-2006-4692-8284-A8CCA68C22C1}.Debug|Mixed Platforms.Build.0 = Debug|x86 43 | {DD228A35-2006-4692-8284-A8CCA68C22C1}.Debug|x86.ActiveCfg = Debug|x86 44 | {DD228A35-2006-4692-8284-A8CCA68C22C1}.Debug|x86.Build.0 = Debug|x86 45 | {DD228A35-2006-4692-8284-A8CCA68C22C1}.Release|Any CPU.ActiveCfg = Release|x86 46 | {DD228A35-2006-4692-8284-A8CCA68C22C1}.Release|Mixed Platforms.ActiveCfg = Release|x86 47 | {DD228A35-2006-4692-8284-A8CCA68C22C1}.Release|Mixed Platforms.Build.0 = Release|x86 48 | {DD228A35-2006-4692-8284-A8CCA68C22C1}.Release|x86.ActiveCfg = Release|x86 49 | {DD228A35-2006-4692-8284-A8CCA68C22C1}.Release|x86.Build.0 = Release|x86 50 | EndGlobalSection 51 | GlobalSection(SolutionProperties) = preSolution 52 | HideSolutionNode = FALSE 53 | EndGlobalSection 54 | EndGlobal 55 | -------------------------------------------------------------------------------- /OpenPlot4AO/NovGIS.OpenPlot.Samples.Dev/NovGIS.OpenPlot.Samples.Dev.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | x86 6 | 8.0.30703 7 | 2.0 8 | {DD228A35-2006-4692-8284-A8CCA68C22C1} 9 | WinExe 10 | Properties 11 | NovGIS.OpenPlot.Samples.Dev 12 | NovGIS.OpenPlot.Samples.Dev 13 | v4.0 14 | 15 | 16 | 512 17 | 18 | 19 | x86 20 | true 21 | full 22 | false 23 | bin\Debug\ 24 | DEBUG;TRACE 25 | prompt 26 | 4 27 | 28 | 29 | x86 30 | pdbonly 31 | true 32 | bin\Release\ 33 | TRACE 34 | prompt 35 | 4 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | Form 45 | 46 | 47 | FrmMain.cs 48 | 49 | 50 | 51 | 52 | ResXFileCodeGenerator 53 | Resources.Designer.cs 54 | Designer 55 | 56 | 57 | True 58 | Resources.resx 59 | True 60 | 61 | 62 | 63 | SettingsSingleFileGenerator 64 | Settings.Designer.cs 65 | 66 | 67 | True 68 | Settings.settings 69 | True 70 | 71 | 72 | 73 | 74 | {A62D7EE6-F4D5-4858-96B5-A815EA4EB466} 75 | NovGIS.OpenPlot.Controls 76 | 77 | 78 | 79 | 86 | -------------------------------------------------------------------------------- /OpenPlot4AO/NovGIS.OpenPlot.Samples.Dev/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /OpenPlot4AO/NovGIS.OpenPlot.Core/Utils/MathUtil.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ESRI.ArcGIS.Geometry; 3 | 4 | namespace NovGIS.OpenPlot.Core 5 | { 6 | public static class MathUtil 7 | { 8 | /// 9 | /// 计算两点的平面弧度 10 | /// 11 | /// 起始点x坐标 12 | /// 起始点y坐标 13 | /// 终点x坐标 14 | /// 终点y坐标 15 | /// 两点平面夹角(弧度) 16 | public static double CalculateRadian(double x1, double y1, double x2, double y2) 17 | { 18 | //求得弧度(反正切函数) 19 | double radian = Math.Atan(Math.Abs((y2 - y1) / (x2 - x1))); 20 | //公式: 21 | //2π 弧度 = 360 度 22 | //1 弧度 = 180/π 度 23 | //角度=弧度*180/π 24 | // 25 | // double angle = radian * 180 / Math.PI; 26 | // 27 | if (x2 > x1 && y2 > y1) //1象限 28 | { 29 | 30 | } 31 | else if (x2 < x1 && y2 > y1) //2象限 32 | { 33 | radian = Math.PI - radian; 34 | } 35 | else if (x2 < x1 && y2 < y1) //3象限 36 | { 37 | radian = radian + Math.PI; 38 | } 39 | else if (x2 > x1 && y2 < y1) //4象限 40 | { 41 | radian = 2 * Math.PI - radian; 42 | } 43 | return Math.Round(radian, 2); 44 | } 45 | /// 46 | /// 计算两点的平面角度 47 | /// 48 | /// 起始点x坐标 49 | /// 起始点y坐标 50 | /// 终点x坐标 51 | /// 终点y坐标 52 | /// 两点平面夹角(角度) 53 | public static double CalculateAngle(double x1, double y1, double x2, double y2) 54 | { 55 | //求得弧度 56 | double radian = Math.Atan(Math.Abs((y2 - y1) / (x2 - x1))); 57 | double angle = radian * 180 / Math.PI; 58 | // 59 | if (x2 > x1 && y2 > y1) //1象限 60 | { 61 | 62 | } 63 | else if (x2 < x1 && y2 > y1) //2象限 64 | { 65 | angle = 180 - angle; 66 | } 67 | else if (x2 < x1 && y2 < y1) //3象限 68 | { 69 | angle = angle + 180; 70 | } 71 | else if (x2 > x1 && y2 < y1) //4象限 72 | { 73 | angle = 360 - angle; 74 | } 75 | return Math.Round(angle, 2); 76 | } 77 | /// 78 | /// 判断P点在AB有向线段的方位 79 | /// 80 | /// 81 | /// 82 | /// 83 | /// LEFT,RIGHT,ONLINE 84 | public static string CalculateAzimuth(IPoint pointA, IPoint pointB, IPoint pointP) 85 | { 86 | /* 87 | * 向量叉积算法 88 | * a×b = x1*y2 - x2*y1 89 | * 若 a × b < 0 , 则a在b的逆时针方向 90 | * 若 a × b > 0 , 则a在b的顺时针方向 91 | * 若 a × b = 0 , 则a与b共线,但可能同向也可能反 92 | */ 93 | string strResult = ""; 94 | //a向量坐标(AB) 95 | double ax = pointB.X - pointA.X; 96 | double ay = pointB.Y - pointA.Y; 97 | //b向量坐标(AP) 98 | double bx = pointP.X - pointA.X; 99 | double by = pointP.Y - pointA.Y; 100 | //a向量和b向量的叉积 101 | double value = ax * by - ay * bx; 102 | //判断规律 103 | if (value > 0) strResult = "LEFT"; 104 | else if (value < 0) strResult = "RIGHT"; 105 | else strResult = "ONLINE"; 106 | return strResult; 107 | } 108 | /// 109 | /// 计算点C关于AB连线的中垂线的对称点D 110 | /// 111 | /// 112 | /// 113 | /// 114 | /// 115 | public static IPoint GetSymmetryPoint(IPoint pointA, IPoint pointB, IPoint pointC) 116 | { 117 | string value = CalculateAzimuth(pointA, pointB, pointC); 118 | IPoint pointD = new PointClass(); 119 | ILine AB = new LineClass { FromPoint = pointB, ToPoint = pointA }; 120 | if (value == "LEFT") 121 | { 122 | AB = new LineClass { FromPoint = pointB, ToPoint = pointA }; 123 | } 124 | else 125 | { 126 | AB = new LineClass { FromPoint = pointA, ToPoint = pointB }; 127 | } 128 | IPoint pointS = new PointClass(); 129 | pointS.PutCoords((pointA.X + pointB.X) / 2, (pointA.Y + pointB.Y) / 2); 130 | ILine normalS = new LineClass(); 131 | AB.QueryNormal(esriSegmentExtension.esriNoExtension, 0.5, true, 100 * AB.Length, normalS); 132 | IPoint pointZ = new PointClass(); 133 | if (normalS.Angle.Equals(0))//平行x轴 134 | { 135 | pointZ.PutCoords(pointC.X, pointS.Y); 136 | } 137 | else if (normalS.Angle.Equals(1.0 / 4.0 * Math.PI))//垂直x轴 138 | { 139 | pointZ.PutCoords(pointS.X, pointC.Y); 140 | } 141 | else 142 | { 143 | double d = GetMinDistance(pointA, pointB, pointC); 144 | normalS.QueryPoint(esriSegmentExtension.esriNoExtension, d, false, pointZ); 145 | } 146 | pointD.PutCoords((2.0 * pointZ.X - pointC.X), (2.0 * pointZ.Y - pointC.Y)); 147 | return pointD; 148 | } 149 | /// 150 | /// 计算C点到AB连续的距离 151 | /// 152 | /// 153 | /// 154 | /// 155 | /// 156 | public static double GetMinDistance(IPoint pointA, IPoint pointB, IPoint pointC) 157 | { 158 | double distance; 159 | if (pointA.X.Equals(pointB.X)) 160 | { 161 | distance = Math.Abs(pointC.X - pointA.X); 162 | return distance; 163 | } 164 | double lineK = (pointB.Y - pointA.Y) / (pointB.X - pointA.X); 165 | double lineC = (pointB.X * pointA.Y - pointA.X * pointB.Y) / (pointB.X - pointA.X); 166 | distance = Math.Abs(lineK * pointC.X - pointC.Y + lineC) / (Math.Sqrt(lineK * lineK + 1)); 167 | return distance; 168 | } 169 | } 170 | } 171 | -------------------------------------------------------------------------------- /OpenPlot4AO/NovGIS.OpenPlot.Core/Element/LinearPlotElement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using ESRI.ArcGIS.Carto; 3 | using ESRI.ArcGIS.Display; 4 | using ESRI.ArcGIS.esriSystem; 5 | using ESRI.ArcGIS.Geometry; 6 | 7 | namespace NovGIS.OpenPlot.Element 8 | { 9 | public class LinearPlotElement : LineElement, IElement, IElementProperties, IElementProperties2, IElementProperties3, ILineElement, IGraphicElement, IBoundsProperties, IElementEditVertices, ITransform2D, IPropertySupport, IPersistStream, IClone, IXMLSerialize 10 | { 11 | 12 | 13 | public void QueryBounds(IDisplay Display, IEnvelope Bounds) 14 | { 15 | throw new NotImplementedException(); 16 | } 17 | 18 | public void QueryOutline(IDisplay Display, IPolygon Outline) 19 | { 20 | throw new NotImplementedException(); 21 | } 22 | 23 | public bool HitTest(double x, double y, double Tolerance) 24 | { 25 | throw new NotImplementedException(); 26 | } 27 | 28 | public void Deactivate() 29 | { 30 | throw new NotImplementedException(); 31 | } 32 | 33 | public IGeometry Geometry 34 | { 35 | get { throw new NotImplementedException(); } 36 | set { throw new NotImplementedException(); } 37 | } 38 | 39 | public ISelectionTracker SelectionTracker 40 | { 41 | get { throw new NotImplementedException(); } 42 | } 43 | 44 | public bool Locked 45 | { 46 | get { throw new NotImplementedException(); } 47 | set { throw new NotImplementedException(); } 48 | } 49 | 50 | public void Activate(IDisplay Display) 51 | { 52 | throw new NotImplementedException(); 53 | } 54 | 55 | public void Draw(IDisplay Display, ITrackCancel TrackCancel) 56 | { 57 | throw new NotImplementedException(); 58 | } 59 | 60 | bool IElementProperties2.CanRotate() 61 | { 62 | throw new NotImplementedException(); 63 | } 64 | 65 | string IElementProperties3.Name 66 | { 67 | get { throw new NotImplementedException(); } 68 | set { throw new NotImplementedException(); } 69 | } 70 | 71 | string IElementProperties3.Type 72 | { 73 | get { throw new NotImplementedException(); } 74 | set { throw new NotImplementedException(); } 75 | } 76 | 77 | bool IElementProperties3.AutoTransform 78 | { 79 | get { throw new NotImplementedException(); } 80 | set { throw new NotImplementedException(); } 81 | } 82 | 83 | object IElementProperties3.CustomProperty 84 | { 85 | get { throw new NotImplementedException(); } 86 | set { throw new NotImplementedException(); } 87 | } 88 | 89 | double IElementProperties3.ReferenceScale 90 | { 91 | get { throw new NotImplementedException(); } 92 | set { throw new NotImplementedException(); } 93 | } 94 | 95 | public esriAnchorPointEnum AnchorPoint 96 | { 97 | get { throw new NotImplementedException(); } 98 | set { throw new NotImplementedException(); } 99 | } 100 | 101 | ISpatialReference IElementProperties3.SpatialReference 102 | { 103 | get { throw new NotImplementedException(); } 104 | set { throw new NotImplementedException(); } 105 | } 106 | 107 | bool IElementProperties3.CanRotate() 108 | { 109 | throw new NotImplementedException(); 110 | } 111 | 112 | string IElementProperties2.Name 113 | { 114 | get { throw new NotImplementedException(); } 115 | set { throw new NotImplementedException(); } 116 | } 117 | 118 | string IElementProperties2.Type 119 | { 120 | get { throw new NotImplementedException(); } 121 | set { throw new NotImplementedException(); } 122 | } 123 | 124 | bool IElementProperties2.AutoTransform 125 | { 126 | get { throw new NotImplementedException(); } 127 | set { throw new NotImplementedException(); } 128 | } 129 | 130 | object IElementProperties2.CustomProperty 131 | { 132 | get { throw new NotImplementedException(); } 133 | set { throw new NotImplementedException(); } 134 | } 135 | 136 | double IElementProperties2.ReferenceScale 137 | { 138 | get { throw new NotImplementedException(); } 139 | set { throw new NotImplementedException(); } 140 | } 141 | 142 | string IElementProperties.Name 143 | { 144 | get { throw new NotImplementedException(); } 145 | set { throw new NotImplementedException(); } 146 | } 147 | 148 | string IElementProperties.Type 149 | { 150 | get { throw new NotImplementedException(); } 151 | set { throw new NotImplementedException(); } 152 | } 153 | 154 | bool IElementProperties.AutoTransform 155 | { 156 | get { throw new NotImplementedException(); } 157 | set { throw new NotImplementedException(); } 158 | } 159 | 160 | object IElementProperties.CustomProperty 161 | { 162 | get { throw new NotImplementedException(); } 163 | set { throw new NotImplementedException(); } 164 | } 165 | 166 | public ILineSymbol Symbol 167 | { 168 | get { throw new NotImplementedException(); } 169 | set { throw new NotImplementedException(); } 170 | } 171 | 172 | ISpatialReference IGraphicElement.SpatialReference 173 | { 174 | get { throw new NotImplementedException(); } 175 | set { throw new NotImplementedException(); } 176 | } 177 | 178 | public bool FixedAspectRatio 179 | { 180 | get { throw new NotImplementedException(); } 181 | set { throw new NotImplementedException(); } 182 | } 183 | 184 | public bool FixedSize 185 | { 186 | get { throw new NotImplementedException(); } 187 | } 188 | 189 | public ISelectionTracker GetMoveVerticesSelectionTracker() 190 | { 191 | throw new NotImplementedException(); 192 | } 193 | 194 | public bool MovingVertices 195 | { 196 | get { throw new NotImplementedException(); } 197 | set { throw new NotImplementedException(); } 198 | } 199 | 200 | public void Move(double dx, double dy) 201 | { 202 | throw new NotImplementedException(); 203 | } 204 | 205 | public void MoveVector(ILine v) 206 | { 207 | throw new NotImplementedException(); 208 | } 209 | 210 | public void Scale(IPoint Origin, double sx, double sy) 211 | { 212 | throw new NotImplementedException(); 213 | } 214 | 215 | public void Rotate(IPoint Origin, double rotationAngle) 216 | { 217 | throw new NotImplementedException(); 218 | } 219 | 220 | public void Transform(esriTransformDirection direction, ITransformation transformation) 221 | { 222 | throw new NotImplementedException(); 223 | } 224 | 225 | public bool Applies(object pUnk) 226 | { 227 | throw new NotImplementedException(); 228 | } 229 | 230 | public bool CanApply(object pUnk) 231 | { 232 | throw new NotImplementedException(); 233 | } 234 | 235 | public object Apply(object newObject) 236 | { 237 | throw new NotImplementedException(); 238 | } 239 | 240 | public object get_Current(object pUnk) 241 | { 242 | throw new NotImplementedException(); 243 | } 244 | 245 | void IPersist.GetClassID(out Guid pClassID) 246 | { 247 | throw new NotImplementedException(); 248 | } 249 | 250 | public void IsDirty() 251 | { 252 | throw new NotImplementedException(); 253 | } 254 | 255 | public void Load(IStream pstm) 256 | { 257 | throw new NotImplementedException(); 258 | } 259 | 260 | public void Save(IStream pstm, int fClearDirty) 261 | { 262 | throw new NotImplementedException(); 263 | } 264 | 265 | public void GetSizeMax(out _ULARGE_INTEGER pcbSize) 266 | { 267 | throw new NotImplementedException(); 268 | } 269 | 270 | void IPersistStream.GetClassID(out Guid pClassID) 271 | { 272 | throw new NotImplementedException(); 273 | } 274 | 275 | public IClone Clone() 276 | { 277 | throw new NotImplementedException(); 278 | } 279 | 280 | public void Assign(IClone src) 281 | { 282 | throw new NotImplementedException(); 283 | } 284 | 285 | public bool IsEqual(IClone other) 286 | { 287 | throw new NotImplementedException(); 288 | } 289 | 290 | public bool IsIdentical(IClone other) 291 | { 292 | throw new NotImplementedException(); 293 | } 294 | 295 | public void Serialize(IXMLSerializeData data) 296 | { 297 | throw new NotImplementedException(); 298 | } 299 | 300 | public void Deserialize(IXMLSerializeData data) 301 | { 302 | throw new NotImplementedException(); 303 | } 304 | } 305 | } 306 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------