using Metis.Measuring;
using PaintDotNet.Annotation.Enum;
using PaintDotNet.Base;
using PaintDotNet.Data.Param;
using PaintDotNet.Measuring;
using PaintDotNet.Preview2;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Windows.Forms;
namespace PaintDotNet.Menus
{
///
/// 图像测量菜单
///
internal sealed class MeasureActionMenu : PdnMenuItem
{
public static ArrayList ArrayList1;
public static ArrayList ArrayList2;
public static ArrayList ArrayList3;
public static bool InitKb = true;
#region Menus
private PdnMenuItem menuChoiseAction;
private PdnMenuItem menuSelectAllAction;
private PdnMenuItem menuContinuousDrawingAction;
private PdnMenuItem menuClearAllAction;
private ToolStripSeparator menuHelpSeparator1;
private PdnMenuItem menuOpticalDensity;
private PdnMenuItem menuBitmapAnalysis;
private ToolStripSeparator menuHelpSeparator2;
private PdnMenuItem menuLengthMeasurement;
private PdnMenuItem menuMultiPointLineSegment;
private PdnMenuItem menuCurveLength;
private PdnMenuItem menuPointPerpendicular;
private PdnMenuItem menuParallelLines;
private PdnMenuItem menuPolygonMeasurement;
private PdnMenuItem menuCircularMeasurement;
private PdnMenuItem menuAngleMeasurement;
private PdnMenuItem menuRegistrationMeasurement;
private ToolStripSeparator menuHelpSeparator3;
private PdnMenuItem menuRulerCalibration;
private PdnMenuItem menuMeasureList;
private PdnMenuItem menuTheoreticalScale;
private PdnMenuItem menuGeometryMeasure;
//标尺标定子菜单
//标尺标定
private PdnMenuItem menuSubRulerCalibration;
//应用当前
private PdnMenuItem menuSubApplyCurrent;
//应用全部
private PdnMenuItem menuSubApplyAll;
//长度测量子菜单
//直线
private PdnMenuItem menuStraightLine;
//长度
private PdnMenuItem menuLengthLine;
//水平线
private PdnMenuItem menuHorizontalLine;
//垂线
private PdnMenuItem menuPerpendicular;
//垂线
private PdnMenuItem menuDistance;
//多点线段子菜单
//多点直线
private PdnMenuItem menuMultipointStraightLine;
//多点水平线
private PdnMenuItem menuMultipointHorizontalLine;
//多点线段
private PdnMenuItem menuMultipointLineSegment1;
//多点垂直线
private PdnMenuItem menuMultipointVerticalLine;
//曲线长度子菜单
//折线
private PdnMenuItem menuPolyline;
//轨迹曲线
private PdnMenuItem menuTraceCurve;
//曲线
private PdnMenuItem menuCurve;
//点垂线子菜单
//点垂线
private PdnMenuItem menuPointVertical;
//多点垂线
private PdnMenuItem menuMultiPointVertical;
//水平多点垂线
private PdnMenuItem menuHorizontalMultipointVertical;
//垂直多点垂线
private PdnMenuItem menuVerticalMultipointVertical;
//点到水平线距离
private PdnMenuItem menuPointToHLine;
//平行线测量子菜单
//平行线
private PdnMenuItem menuParallelLine;
//多点平行线
private PdnMenuItem menuMultipointParallel;
//多点水平平行线
private PdnMenuItem menuMultipointHorizontalParallelLines;
//多点垂直平行线
private PdnMenuItem menuMultipointVerticalParallelLines;
//多边形测量子菜单
//闭合曲线
private PdnMenuItem menuClosedCurve;
//多边形
private PdnMenuItem menuPolygon;
//矩形
private PdnMenuItem menuRectangle;
//任意矩形
private PdnMenuItem menuArbitraryRectangle;
//正方形
private PdnMenuItem menuSquare;
//任意正方形
private PdnMenuItem menuArbitrarySquare;
//轨迹多边形
private PdnMenuItem menuTrackPolygon;
//圆形测量子菜单
//三点圆
private PdnMenuItem menuThreePointCircle;
//向内画圆
private PdnMenuItem menuDrawCircleInward;
//向外画圆
private PdnMenuItem menuDrawCircleOutward;
//直径画圆
private PdnMenuItem menuDiameterCircle;
//点到圆距离
private PdnMenuItem menuPointToCircleDistance;
//点到圆心距离
private PdnMenuItem menuPointToCenterDistance;
//点到圆弧距离
private PdnMenuItem menuPointToArcDistance;
//角度测量子菜单
//三点角度
private PdnMenuItem menuThreePointAngle;
//四点角度
private PdnMenuItem menuFourPointAngle;
//三点弧
private PdnMenuItem menuThreePointArc;
// 对准度测量子菜单
//圆心到圆心距离
private PdnMenuItem menuCenterToCenterDistance;
//两线中垂线距离
private PdnMenuItem menuTwoLineVLDistance;
#endregion
public static Preview2Dialog _p2Form => Preview2Dialog.Instance;
///
/// 图像测量
///
public MeasureActionMenu(int menuId)
{
InitializeComponent();
this.MenuId = menuId;
this.AutomaticScript = false;
}
protected override void OnAppWorkspaceChanged()
{
base.OnAppWorkspaceChanged();
}
private void InitializeComponent()
{
this.menuChoiseAction = new PdnMenuItem(ActionType.MeasureSelect);
this.menuSelectAllAction = new PdnMenuItem(ActionType.SelectAllMeasure);
this.menuContinuousDrawingAction = new PdnMenuItem(ActionType.ContinuousDrawingMeasure, true);
this.menuClearAllAction = new PdnMenuItem(ActionType.ClearAllMeasure);
this.menuHelpSeparator1 = new ToolStripSeparator();
this.menuOpticalDensity = new PdnMenuItem(ActionType.OpticalDensity);
this.menuBitmapAnalysis = new PdnMenuItem(ActionType.BitmapAnalysis);
this.menuHelpSeparator2 = new ToolStripSeparator();
this.menuLengthMeasurement = new PdnMenuItem(ActionType.LengthMeasurement);
this.menuMultiPointLineSegment = new PdnMenuItem(ActionType.MultiPointLineSegment);
this.menuCurveLength = new PdnMenuItem(ActionType.CurveLength);
this.menuPointPerpendicular = new PdnMenuItem(ActionType.PointPerpendicular);
this.menuParallelLines = new PdnMenuItem(ActionType.ParallelLines);
this.menuPolygonMeasurement = new PdnMenuItem(ActionType.PolygonMeasurement);
this.menuCircularMeasurement = new PdnMenuItem(ActionType.CircularMeasurement);
this.menuAngleMeasurement = new PdnMenuItem(ActionType.AngleMeasurement);
this.menuRegistrationMeasurement = new PdnMenuItem(ActionType.RegistrationMeasurement);
this.menuHelpSeparator3 = new ToolStripSeparator();
this.menuMeasureList = new PdnMenuItem(ActionType.MeasureList);
this.menuRulerCalibration = new PdnMenuItem(ActionType.RulerCalibration);
this.menuTheoreticalScale = new PdnMenuItem(ActionType.TheoreticalScale);
this.menuSubRulerCalibration = new PdnMenuItem(ActionType.SubRulerCalibration);
this.menuSubApplyCurrent = new PdnMenuItem(ActionType.SubApplyCurrent);
this.menuSubApplyAll = new PdnMenuItem(ActionType.SubApplyAll);
this.menuStraightLine = new PdnMenuItem(ActionType.StraightLine);
this.menuLengthLine = new PdnMenuItem(ActionType.LengthLine);
this.menuHorizontalLine = new PdnMenuItem(ActionType.HorizontalLine);
this.menuPerpendicular = new PdnMenuItem(ActionType.Perpendicular);
this.menuDistance = new PdnMenuItem(ActionType.StraightDistanceLine);
this.menuMultipointStraightLine = new PdnMenuItem(ActionType.MultipointStraightLine);
this.menuMultipointHorizontalLine = new PdnMenuItem(ActionType.MultipointLineSegment1);
this.menuMultipointLineSegment1 = new PdnMenuItem(ActionType.MultipointHorizontalLine);
this.menuMultipointVerticalLine = new PdnMenuItem(ActionType.MultipointVerticalLine);
this.menuPolyline = new PdnMenuItem(ActionType.Polyline);
this.menuCurve = new PdnMenuItem(ActionType.Curve);
this.menuTraceCurve = new PdnMenuItem(ActionType.TraceCurve);
this.menuPointVertical = new PdnMenuItem(ActionType.PointVertical);
this.menuMultiPointVertical = new PdnMenuItem(ActionType.MultiPointVertical);
this.menuHorizontalMultipointVertical = new PdnMenuItem(ActionType.HorizontalMultipointVertical);
this.menuVerticalMultipointVertical = new PdnMenuItem(ActionType.VerticalMultipointVertical);
this.menuPointToHLine = new PdnMenuItem(ActionType.menuPointToHLine);
this.menuParallelLine = new PdnMenuItem(ActionType.ParallelLine);
this.menuMultipointParallel = new PdnMenuItem(ActionType.MultipointParallel);
this.menuMultipointHorizontalParallelLines = new PdnMenuItem(ActionType.MultipointHorizontalParallelLines);
this.menuMultipointVerticalParallelLines = new PdnMenuItem(ActionType.MultipointVerticalParallelLines);
this.menuClosedCurve = new PdnMenuItem(ActionType.ClosedCurve);
this.menuPolygon = new PdnMenuItem(ActionType.Polygon);
this.menuRectangle = new PdnMenuItem(ActionType.Rectangle);
this.menuArbitraryRectangle = new PdnMenuItem(ActionType.ArbitraryRectangle);
this.menuSquare = new PdnMenuItem(ActionType.Square);
this.menuArbitrarySquare = new PdnMenuItem(ActionType.ArbitrarySquare);
this.menuTrackPolygon = new PdnMenuItem(ActionType.TrackPolygon);
this.menuThreePointCircle = new PdnMenuItem(ActionType.ThreePointCircle);
this.menuDrawCircleInward = new PdnMenuItem(ActionType.DrawCircleInward);
this.menuDrawCircleOutward = new PdnMenuItem(ActionType.DrawCircleOutward);
this.menuDiameterCircle = new PdnMenuItem(ActionType.DiameterCircle);
this.menuPointToCircleDistance = new PdnMenuItem(ActionType.PointToCircleDistance);
this.menuPointToCenterDistance = new PdnMenuItem(ActionType.PointToCenterDistance);
this.menuPointToArcDistance = new PdnMenuItem(ActionType.PointToArcDistance);
this.menuThreePointAngle = new PdnMenuItem(ActionType.ThreePointAngle);
this.menuFourPointAngle = new PdnMenuItem(ActionType.FourPointAngle);
this.menuThreePointArc = new PdnMenuItem(ActionType.ThreePointArc);
this.menuCenterToCenterDistance = new PdnMenuItem(ActionType.CenterToCenterDistance);
this.menuTwoLineVLDistance = new PdnMenuItem(ActionType.TwoLineVLDistance);
this.menuGeometryMeasure = new PdnMenuItem(ActionType.GeometryMeasure);
//
// 主菜单
//
this.DropDownItems.AddRange(new ToolStripItem[] {
this.menuChoiseAction,
this.menuSelectAllAction,
this.menuContinuousDrawingAction,
this.menuClearAllAction,
this.menuHelpSeparator1,
this.menuOpticalDensity,
this.menuBitmapAnalysis,
this.menuHelpSeparator2,
this.menuLengthMeasurement,
this.menuMultiPointLineSegment,
this.menuCurveLength,
this.menuCircularMeasurement,
this.menuAngleMeasurement,
this.menuRegistrationMeasurement,
this.menuPointPerpendicular,
this.menuParallelLines,
this.menuPolygonMeasurement,
this.menuHelpSeparator3,
this.menuMeasureList,
this.menuRulerCalibration,
this.menuTheoreticalScale,
this.menuGeometryMeasure
});
this.Name = "Menu.MeasureAction";
this.Text = PdnResources.GetString("Menu.MeasureAction.Text");
//
// 选择
//
this.menuChoiseAction.NeedWaitKey = true;
this.menuChoiseAction.Click += new EventHandler(MenuChoiseAction_Click);
//
// 全选
//
this.menuSelectAllAction.NeedWaitKey = true;
this.menuSelectAllAction.Click += new EventHandler(MenuSelectAllAction_Click);
//
// 连续绘制
//
this.menuContinuousDrawingAction.NeedWaitKey = true;
this.menuContinuousDrawingAction.Click += new EventHandler(MenuContinuousDrawingAction_Click);
//
// 清空元素
//
this.menuClearAllAction.Click += new EventHandler(MenuClearAllAction_Click);
//
// 光密度
//
this.menuOpticalDensity.NeedWaitKey = true;
this.menuOpticalDensity.Click += new EventHandler(MenuOpticalDensity_Click);
//
// 位图分析
//
this.menuBitmapAnalysis.Click += new EventHandler(BitmapAnalysis_Click);
//
// 长度测量
//
this.menuLengthMeasurement.DropDownItems.AddRange(new ToolStripItem[] {
this.menuStraightLine,
this.menuLengthLine,
this.menuHorizontalLine,
this.menuPerpendicular,
this.menuDistance
});
//
// 多点线段
//
this.menuMultiPointLineSegment.DropDownItems.AddRange(new ToolStripItem[] {
this.menuMultipointStraightLine,
this.menuMultipointLineSegment1,
this.menuMultipointHorizontalLine,
this.menuMultipointVerticalLine
});
//
// 曲线长度
//
this.menuCurveLength.DropDownItems.AddRange(new ToolStripItem[] {
this.menuPolyline,
this.menuCurve,
this.menuTraceCurve
});
//
// 点垂线测量
//
this.menuPointPerpendicular.DropDownItems.AddRange(new ToolStripItem[] {
this.menuPointVertical,
this.menuMultiPointVertical,
this.menuHorizontalMultipointVertical,
this.menuVerticalMultipointVertical,
this.menuPointToHLine
});
//
// 平行线测量
//
this.menuParallelLines.DropDownItems.AddRange(new ToolStripItem[] {
this.menuParallelLine,
this.menuMultipointParallel,
this.menuMultipointHorizontalParallelLines,
this.menuMultipointVerticalParallelLines
});
//
// 多边形测量
//
this.menuPolygonMeasurement.DropDownItems.AddRange(new ToolStripItem[] {
this.menuClosedCurve,
this.menuPolygon,
this.menuRectangle,
this.menuArbitraryRectangle,
this.menuSquare,
this.menuArbitrarySquare,
this.menuTrackPolygon
});
//
// 圆形测量
//
this.menuCircularMeasurement.DropDownItems.AddRange(new ToolStripItem[] {
this.menuThreePointCircle,
this.menuDrawCircleInward,
this.menuDrawCircleOutward,
this.menuDiameterCircle,
this.menuPointToCircleDistance,
this.menuPointToCenterDistance,
this.menuPointToArcDistance
});
//
// 角度测量
//
this.menuAngleMeasurement.DropDownItems.AddRange(new ToolStripItem[] {
this.menuThreePointAngle,
this.menuFourPointAngle,
this.menuThreePointArc
});
this.menuRegistrationMeasurement.Image = PdnResources.GetImageResource("Icons.MenuMeasureRegistrationMeasurementIcon.png").Reference;
this.menuRegistrationMeasurement.DropDownItems.AddRange(new ToolStripItem[] {
this.menuCenterToCenterDistance,
this.menuTwoLineVLDistance
});
//
// 标尺标定
//
//this.menuRulerCalibration.NeedWaitKey = true;
this.menuRulerCalibration.DropDownItems.AddRange(new ToolStripItem[] {
this.menuSubRulerCalibration,
this.menuSubApplyCurrent,
this.menuSubApplyAll
});
//this.menuRulerCalibration.Click += new EventHandler(MenuRulerCalibration_Click);
//
// 测量列表
//
this.menuMeasureList.NeedWaitKey = true;
this.menuMeasureList.Click += new EventHandler(MenuMeasureList_Click);
//
// 理论比例尺
//
this.menuTheoreticalScale.Click += new EventHandler(TheoreticalScale_Click);
//
// 以下是子菜单
//
//
// 标尺标定(子菜单)
//
this.menuSubRulerCalibration.Text = PdnResources.GetString("Menu.MeasureAction.RulerCalibration.Text");
this.menuSubRulerCalibration.NeedWaitKey = true;
this.menuSubRulerCalibration.Click += new EventHandler(MenuRulerCalibration_Click);
this.menuSubRulerCalibration.Image = PdnResources.GetImageResource("Icons.MenuRulerCalibration.png").Reference;
//
// 应用当前
//
this.menuSubApplyCurrent.Text = PdnResources.GetString("Menu.Imagement.Rulersetting.current.text");
this.menuSubApplyCurrent.NeedWaitKey = true;
this.menuSubApplyCurrent.Click += new EventHandler(MenuSubApplyCurrent_Click);
this.menuSubApplyCurrent.Image = PdnResources.GetImageResource("Icons.MenuNow.png").Reference;
//
// 应用全部
//
this.menuSubApplyAll.Text = PdnResources.GetString("Menu.Binaryoperation.Binaryextraction.Applytoall.text");
this.menuSubApplyAll.NeedWaitKey = true;
this.menuSubApplyAll.Click += new EventHandler(MenuSubApplyAll_Click);
this.menuSubApplyAll.Image = PdnResources.GetImageResource("Icons.MenuAll.png").Reference;
//
// 直线
//
this.menuStraightLine.Text = PdnResources.GetString("Menu.MeasureAction.MeasureLine.Text");
this.menuStraightLine.NeedWaitKey = true;
this.menuStraightLine.Click += new EventHandler(MenuStraightLine_Click);
this.menuStraightLine.Image = PdnResources.GetImageResource("Icons.MenuMeasureLineIcon.png").Reference;
//
//
// 距离
//
this.menuDistance.Text = PdnResources.GetString("Menu.MeasureAction.MeasureDistanceLine.Text");
this.menuDistance.NeedWaitKey = true;
this.menuDistance.Click += new EventHandler(MenuDistance_Click);
this.menuDistance.Image = PdnResources.GetImageResource("Icons.MenuMeasureLineIcon.png").Reference;
//
// 长度
//
this.menuLengthLine.Text = PdnResources.GetString("Menu.MeasureAction.MeasureLength.Text");
this.menuLengthLine.NeedWaitKey = true;
this.menuLengthLine.Click += new EventHandler(MenuLengthLine_Click);
this.menuLengthLine.Image = PdnResources.GetImageResource("Icons.MenuMeasureLengthIcon.png").Reference;
//
// 水平线
//
this.menuHorizontalLine.Text = PdnResources.GetString("Menu.MeasureAction.MeasureHLine.Text");
this.menuHorizontalLine.NeedWaitKey = true;
this.menuHorizontalLine.Click += new EventHandler(MenuHorizontalLine_Click);
this.menuHorizontalLine.Image = PdnResources.GetImageResource("Icons.MenuMeasureHLineIcon.png").Reference;
//
// 垂线
//
this.menuPerpendicular.Text = PdnResources.GetString("Menu.MeasureAction.MeasureVLine.Text");
this.menuPerpendicular.NeedWaitKey = true;
this.menuPerpendicular.Click += new EventHandler(MenuPerpendicular_Click);
this.menuPerpendicular.Image = PdnResources.GetImageResource("Icons.MenuMeasureVLineIcon.png").Reference;
//
// 多点直线
//
this.menuMultipointStraightLine.Text = PdnResources.GetString("Menu.MeasureAction.MeasureMulLine.Text");
this.menuMultipointStraightLine.NeedWaitKey = true;
this.menuMultipointStraightLine.Click += new EventHandler(menuMultipointStraightLine_Click);
this.menuMultipointStraightLine.Image = PdnResources.GetImageResource("Icons.MenuMeasureMulLineIcon.png").Reference;
//
// 多点水平线
//
this.menuMultipointHorizontalLine.Text = PdnResources.GetString("Menu.MeasureAction.MeasureMulHVLine.Text");
this.menuMultipointHorizontalLine.NeedWaitKey = true;
this.menuMultipointHorizontalLine.Click += new EventHandler(menuMultipointHorizontalLine_Click);
this.menuMultipointHorizontalLine.Image = PdnResources.GetImageResource("Icons.MenuMeasureMulHVLineIcon.png").Reference;
//
// 多点线段
//
this.menuMultipointLineSegment1.Text = PdnResources.GetString("Menu.MeasureAction.MeasureMulSegment.Text");
this.menuMultipointLineSegment1.NeedWaitKey = true;
this.menuMultipointLineSegment1.Click += new EventHandler(menuMultipointLineSegment1_Click);
this.menuMultipointLineSegment1.Image = PdnResources.GetImageResource("Icons.MenuMeasureMulSegmentIcon.png").Reference;
//
// 多点垂直线
//
this.menuMultipointVerticalLine.Text = PdnResources.GetString("Menu.MeasureAction.MeasureMulVLine.Text");
this.menuMultipointVerticalLine.NeedWaitKey = true;
this.menuMultipointVerticalLine.Click += new EventHandler(menuMultipointVerticalLine_Click);
this.menuMultipointVerticalLine.Image = PdnResources.GetImageResource("Icons.MenuMeasureMulVLineIcon.png").Reference;
//
// 折线
//
this.menuPolyline.Text = PdnResources.GetString("Menu.MeasureAction.MeasureBrokenLine.Text");
this.menuPolyline.NeedWaitKey = true;
this.menuPolyline.Click += new EventHandler(MenuPolyline_Click);
this.menuPolyline.Image = PdnResources.GetImageResource("Icons.MenuMeasureBrokenLineIcon.png").Reference;
//
// 轨迹曲线
//
this.menuTraceCurve.Text = PdnResources.GetString("Menu.MeasureAction.MeasureTraceCurve.Text");
this.menuTraceCurve.NeedWaitKey = true;
this.menuTraceCurve.Click += new EventHandler(MenuTraceCurve_Click);
this.menuTraceCurve.Image = PdnResources.GetImageResource("Icons.MenuMeasureTraceCurveIcon.png").Reference;
//
// 曲线
//
this.menuCurve.Text = PdnResources.GetString("Menu.MeasureAction.MeasureCurveLine.Text");
this.menuCurve.NeedWaitKey = true;
this.menuCurve.Click += new EventHandler(MenuCurve_Click);
this.menuCurve.Image = PdnResources.GetImageResource("Icons.MenuMeasureCurveLineIcon.png").Reference;
//
// 点垂线
//
this.menuPointVertical.Text = PdnResources.GetString("Menu.MeasureAction.MeasurePLine.Text");
this.menuPointVertical.NeedWaitKey = true;
this.menuPointVertical.Click += new EventHandler(menuPointVertical_Click);
this.menuPointVertical.Image = PdnResources.GetImageResource("Icons.MenuMeasurePLineIcon.png").Reference;
//
// 多点垂线
//
this.menuMultiPointVertical.Text = PdnResources.GetString("Menu.MeasureAction.MeasureMulPLine.Text");
this.menuMultiPointVertical.NeedWaitKey = true;
this.menuMultiPointVertical.Click += new EventHandler(menuMultiPointVertical_Click);
this.menuMultiPointVertical.Image = PdnResources.GetImageResource("Icons.MenuMeasureMulPLineIcon.png").Reference;
//
// 水平多点垂线
//
this.menuHorizontalMultipointVertical.Text = PdnResources.GetString("Menu.MeasureAction.MeasureHMulPLine.Text");
this.menuHorizontalMultipointVertical.NeedWaitKey = true;
this.menuHorizontalMultipointVertical.Click += new EventHandler(menuHorizontalMultipointVertical_Click);
this.menuHorizontalMultipointVertical.Image = PdnResources.GetImageResource("Icons.MenuMeasureHMulPLineIcon.png").Reference;
//
// 垂直多点垂线
//
this.menuVerticalMultipointVertical.Text = PdnResources.GetString("Menu.MeasureAction.MeasureVMulPLine.Text");
this.menuVerticalMultipointVertical.NeedWaitKey = true;
this.menuVerticalMultipointVertical.Click += new EventHandler(menuVerticalMultipointVertical_Click);
this.menuVerticalMultipointVertical.Image = PdnResources.GetImageResource("Icons.MenuMeasureVMulPLineIcon.png").Reference;
//
//
//点到水平线距离
//
this.menuPointToHLine.Text = PdnResources.GetString("Menu.MeasureAction.MeasurePointHLine.Text");
this.menuPointToHLine.NeedWaitKey = true;
this.menuPointToHLine.Click += new EventHandler(menuMultiPointToHLine_Click);
this.menuPointToHLine.Image = PdnResources.GetImageResource("Icons.MenuMeasurePLineIcon.png").Reference;
// 平行线
//
this.menuParallelLine.Text = PdnResources.GetString("Menu.MeasureAction.MeasureParallelLine.Text");
this.menuParallelLine.NeedWaitKey = true;
this.menuParallelLine.Click += new EventHandler(menuParallelLine_Click);
this.menuParallelLine.Image = PdnResources.GetImageResource("Icons.MenuMeasureParallelLineIcon.png").Reference;
//
// 多点平行线
//
this.menuMultipointParallel.Text = PdnResources.GetString("Menu.MeasureAction.MeasureMulParallelLine.Text");
this.menuMultipointParallel.NeedWaitKey = true;
this.menuMultipointParallel.Click += new EventHandler(menuMultipointParallel_Click);
this.menuMultipointParallel.Image = PdnResources.GetImageResource("Icons.MenuMeasureMulParallelLineIcon.png").Reference;
//
// 水平多点平行线
//
this.menuMultipointHorizontalParallelLines.Text = PdnResources.GetString("Menu.MeasureAction.MeasureHMulParallelLine.Text");
this.menuMultipointHorizontalParallelLines.NeedWaitKey = true;
this.menuMultipointHorizontalParallelLines.Click += new EventHandler(menuMultipointHorizontalParallelLines_Click);
this.menuMultipointHorizontalParallelLines.Image = PdnResources.GetImageResource("Icons.MenuMeasureHMulParallelLineIcon.png").Reference;
//
// 垂直多点平行线
//
this.menuMultipointVerticalParallelLines.Text = PdnResources.GetString("Menu.MeasureAction.MeasureVMulParallelLine.Text");
this.menuMultipointVerticalParallelLines.NeedWaitKey = true;
this.menuMultipointVerticalParallelLines.Click += new EventHandler(menuMultipointVerticalParallelLines_Click);
this.menuMultipointVerticalParallelLines.Image = PdnResources.GetImageResource("Icons.MenuMeasureVMulParallelLineIcon.png").Reference;
//
// 闭合曲线
//
this.menuClosedCurve.Text = PdnResources.GetString("Menu.MeasureAction.MeasureClosedCurve.Text");
this.menuClosedCurve.NeedWaitKey = true;
this.menuClosedCurve.Click += new EventHandler(menuClosedCurve_Click);
this.menuClosedCurve.Image = PdnResources.GetImageResource("Icons.MenuMeasureClosedCurveIcon.png").Reference;
//
// 多边形
//
this.menuPolygon.Text = PdnResources.GetString("Menu.MeasureAction.MeasurePolygon.Text");
this.menuPolygon.NeedWaitKey = true;
this.menuPolygon.Click += new EventHandler(menuPolygon_Click);
this.menuPolygon.Image = PdnResources.GetImageResource("Icons.MenuMeasurePolygonIcon.png").Reference;
//
// 矩形
//
this.menuRectangle.Text = PdnResources.GetString("Menu.MeasureAction.MeasureRectangle.Text");
this.menuRectangle.NeedWaitKey = true;
this.menuRectangle.Click += new EventHandler(menuRectangle_Click);
this.menuRectangle.Image = PdnResources.GetImageResource("Icons.MenuMeasureRectangleIcon.png").Reference;
//
// 任意矩形
//
this.menuArbitraryRectangle.Text = PdnResources.GetString("Menu.MeasureAction.MeasureRandRectangle.Text");
this.menuArbitraryRectangle.NeedWaitKey = true;
this.menuArbitraryRectangle.Click += new EventHandler(menuArbitraryRectangle_Click);
this.menuArbitraryRectangle.Image = PdnResources.GetImageResource("Icons.MenuMeasureRandRectangleIcon.png").Reference;
//
// 正方形
//
this.menuSquare.Text = PdnResources.GetString("Menu.MeasureAction.MeasureSquare.Text");
this.menuSquare.NeedWaitKey = true;
this.menuSquare.Click += new EventHandler(menuSquare_Click);
this.menuSquare.Image = PdnResources.GetImageResource("Icons.MenuMeasureSquareIcon.png").Reference;
//
// 任意正方形
//
this.menuArbitrarySquare.Text = PdnResources.GetString("Menu.MeasureAction.MeasureRandSquare.Text");
this.menuArbitrarySquare.NeedWaitKey = true;
this.menuArbitrarySquare.Click += new EventHandler(menuArbitrarySquare_Click);
this.menuArbitrarySquare.Image = PdnResources.GetImageResource("Icons.MenuMeasureRandSquareIcon.png").Reference;
//
// 轨迹多边形
//
this.menuTrackPolygon.Text = PdnResources.GetString("Menu.MeasureAction.MeasureTracePolygon.Text");
this.menuTrackPolygon.NeedWaitKey = true;
this.menuTrackPolygon.Click += new EventHandler(menuTrackPolygon_Click);
this.menuTrackPolygon.Image = PdnResources.GetImageResource("Icons.MenuMeasureTracePolygonIcon.png").Reference;
//
// 三点圆
//
this.menuThreePointCircle.Text = PdnResources.GetString("Menu.MeasureAction.MeasureCircle.Text");
this.menuThreePointCircle.NeedWaitKey = true;
this.menuThreePointCircle.Click += new EventHandler(MenuThreePointCircle_Click);
this.menuThreePointCircle.Image = PdnResources.GetImageResource("Icons.MenuMeasureCircleIcon.png").Reference;
//
// 向内画圆
//
this.menuDrawCircleInward.Text = PdnResources.GetString("Menu.MeasureAction.MeasureInnerCircle.Text");
this.menuDrawCircleInward.NeedWaitKey = true;
this.menuDrawCircleInward.Click += new EventHandler(MenuDrawCircleInward_Click);
this.menuDrawCircleInward.Image = PdnResources.GetImageResource("Icons.MenuMeasureInnerCircleIcon.png").Reference;
//
// 向外画圆
//
this.menuDrawCircleOutward.Text = PdnResources.GetString("Menu.MeasureAction.MeasureOuterCircle.Text");
this.menuDrawCircleOutward.NeedWaitKey = true;
this.menuDrawCircleOutward.Click += new EventHandler(MenuDrawCircleOutward_Click);
this.menuDrawCircleOutward.Image = PdnResources.GetImageResource("Icons.MenuMeasureOuterCircleIcon.png").Reference;
//
// 直径画圆
//
this.menuDiameterCircle.Text = PdnResources.GetString("Menu.MeasureAction.MeasureDiameterCircle.Text");
this.menuDiameterCircle.NeedWaitKey = true;
this.menuDiameterCircle.Click += new EventHandler(MenuDiameterCircle_Click);
this.menuDiameterCircle.Image = PdnResources.GetImageResource("Icons.MenuMeasureDiameterCircleIcon.png").Reference;
//
// 点到圆距离
//
this.menuPointToCircleDistance.Text = PdnResources.GetString("Menu.MeasureAction.MeasurePointEdgeSize.Text");
this.menuPointToCircleDistance.NeedWaitKey = true;
this.menuPointToCircleDistance.Click += new EventHandler(MenuPointToCircleDistance_Click);
this.menuPointToCircleDistance.Image = PdnResources.GetImageResource("Icons.MenuMeasurePointEdgeSizeIcon.png").Reference;
//
// 点到圆心距离
//
this.menuPointToCenterDistance.Text = PdnResources.GetString("Menu.MeasureAction.MeasurePointCenterSize.Text");
this.menuPointToCenterDistance.NeedWaitKey = true;
this.menuPointToCenterDistance.Click += new EventHandler(MenuPointToCenterDistance_Click);
this.menuPointToCenterDistance.Image = PdnResources.GetImageResource("Icons.MenuPointToCenterDistance.png").Reference;
//
// 点到圆弧距离
//
this.menuPointToArcDistance.Text = PdnResources.GetString("Menu.MeasureAction.MeasurePointArcSize.Text");
this.menuPointToArcDistance.NeedWaitKey = true;
this.menuPointToArcDistance.Click += new EventHandler(MenuPointToArcDistance_Click);
this.menuPointToArcDistance.Image = PdnResources.GetImageResource("Icons.MenuPointToArcDistance.png").Reference;
//
// 圆心到圆心距离
//
this.menuCenterToCenterDistance.Text = PdnResources.GetString("Menu.MeasureAction.MeasureCenterCenterSize.Text");
this.menuCenterToCenterDistance.NeedWaitKey = true;
this.menuCenterToCenterDistance.Click += new EventHandler(MenuCenterToCenterDistance_Click);
this.menuCenterToCenterDistance.Image = PdnResources.GetImageResource("Icons.MenuMeasurePointCenterSizeIcon.png").Reference;
//
// 两线中垂线距离
//
this.menuTwoLineVLDistance.Text = PdnResources.GetString("Menu.MeasureAction.MeasureTwoLineVLDistance.Text");
this.menuTwoLineVLDistance.NeedWaitKey = true;
this.menuTwoLineVLDistance.Click += new EventHandler(MeasureTwoLineVLDistance_Click);
this.menuTwoLineVLDistance.Image = PdnResources.GetImageResource("Icons.MenuTwoLineVLDistance.png").Reference;
//
// 三点角度
//
this.menuThreePointAngle.Text = PdnResources.GetString("Menu.MeasureAction.MeasureThreePointAngle.Text");
this.menuThreePointAngle.NeedWaitKey = true;
this.menuThreePointAngle.Click += new EventHandler(menuThreePointAngle_Click);
this.menuThreePointAngle.Image = PdnResources.GetImageResource("Icons.MenuMeasureThreePointAngleIcon.png").Reference;
//
// 四点角度
//
this.menuFourPointAngle.Text = PdnResources.GetString("Menu.MeasureAction.MeasureFourPointAngle.Text");
this.menuFourPointAngle.NeedWaitKey = true;
this.menuFourPointAngle.Click += new EventHandler(menuFourPointAngle_Click);
this.menuFourPointAngle.Image = PdnResources.GetImageResource("Icons.MenuMeasureFourPointAngleIcon.png").Reference;
//
// 三点弧
//
this.menuThreePointArc.Text = PdnResources.GetString("Menu.MeasureAction.MeasureThreePointArc.Text");
this.menuThreePointArc.NeedWaitKey = true;
this.menuThreePointArc.Click += new EventHandler(menuThreePointArc_Click);
this.menuThreePointArc.Image = PdnResources.GetImageResource("Icons.MenuMeasureThreePointArcIcon.png").Reference;
//
// 几何测量
//
this.menuGeometryMeasure.Text = PdnResources.GetString("MeasureAction.InteractiveMeasurement");
this.menuGeometryMeasure.Click += new EventHandler(menuGeometryMeasure_Click);
this.menuGeometryMeasure.Image = PdnResources.GetImageResource("Icons.MenuMeasureThreePointArcIcon.png").Reference;
//
// 加载菜单的文字和icon
//
this.LoadNames(this.Name);
this.LoadIcons();
}
protected override void OnDropDownOpening(EventArgs e)
{
this.menuContinuousDrawingAction.Checked = DocumentView.ContinuousDrawing;
this.menuMeasureList.Checked = AppWorkspace.Widgets.MeasureListDialog.Visible;
this.menuRulerCalibration.Checked = AppWorkspace.Widgets.RuleListForm.Visible;
this.menuOpticalDensity.Checked = AppWorkspace.Widgets.OpticalDensityDialog.Visible;
this.menuGeometryMeasure.Checked = AppWorkspace.Widgets.GeometryMeasureDialog.Visible;
if (AppWorkspace.ActiveDocumentWorkspace == null/* || AppWorkspace.ScriptRunning*/)
{
this.menuOpticalDensity.Enabled = false;
this.menuBitmapAnalysis.Enabled = false;
}
else
{
this.menuOpticalDensity.Enabled = true;
this.menuBitmapAnalysis.Enabled = true;
}
//this.RecursiveData(this.DropDownItems);
base.OnDropDownOpening(e);
}
///
/// 选择
///
///
private void MenuChoiseAction_Click(object sender, EventArgs e)
{
if (_p2Form != null)
_p2Form?.SetActiveTool(DrawToolType.Pointer);
else
if (AppWorkspace.ActiveDocumentWorkspace != null)
{
if (AppWorkspace.startScriptRecording)
{
AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List());
}
AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.Pointer;
}
this.SetCameraPreviewActiveTool(DrawToolType.Pointer);
}
///
/// 全选
///
///
private void MenuSelectAllAction_Click(object sender, EventArgs e)
{
if (_p2Form != null)
{
_p2Form.DrawObjSelectAll();
return;
}
if (AppWorkspace.ActiveDocumentWorkspace != null)
{
if (AppWorkspace.startScriptRecording)
{
AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List());
}
AppWorkspace.ActiveDocumentWorkspace.GraphicsList.SelectAll();
AppWorkspace.ActiveDocumentWorkspace.Refresh();
}
if (AppWorkspace.cameraPreviewDialog != null && !AppWorkspace.cameraPreviewDialog.IsDisposed)
{
AppWorkspace.cameraPreviewDialog.documentWorkspace.GraphicsList.SelectAll();
AppWorkspace.cameraPreviewDialog.documentWorkspace.Refresh();
}
}
///
/// 连续绘制
///
///
private void MenuContinuousDrawingAction_Click(object sender, EventArgs e)
{
if (AppWorkspace.startScriptRecording)
{
AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List());
}
AppWorkspace.ContinuousDrawing = !AppWorkspace.ContinuousDrawing;
}
///
/// 清空元素
///
///
private void MenuClearAllAction_Click(object sender, EventArgs e)
{
if (_p2Form != null)
{
_p2Form.DrawObjClear();
return;
}
if (AppWorkspace.ActiveDocumentWorkspace != null)
{
if (AppWorkspace.startScriptRecording)
{
AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List());
}
AppWorkspace.ActiveDocumentWorkspace.GraphicsList.Clear();
AppWorkspace.ActiveDocumentWorkspace.Refresh();
}
if (AppWorkspace.cameraPreviewDialog != null && !AppWorkspace.cameraPreviewDialog.IsDisposed)
{
AppWorkspace.cameraPreviewDialog.documentWorkspace.GraphicsList.Clear();
AppWorkspace.cameraPreviewDialog.documentWorkspace.Refresh();
}
}
private void SetDrawTool(DrawToolType drawTool, object sender)
{
if (_p2Form != null)
_p2Form?.SetActiveTool(drawTool);
else
if (AppWorkspace.ActiveDocumentWorkspace != null)
{
if (AppWorkspace.startScriptRecording)
{
AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List());
}
AppWorkspace.ActiveDocumentWorkspace.ToolNumber = -1;
AppWorkspace.ActiveDocumentWorkspace.ActiveTool = drawTool;
}
this.SetCameraPreviewActiveTool(drawTool);
}
///
/// 长度测量->直线
///
private void MenuStraightLine_Click(object sender, EventArgs e)
{
SetDrawTool(DrawToolType.MeasureLine, sender);
}
///
/// 长度测量->距离
///
private void MenuDistance_Click(object sender, EventArgs e)
{
SetDrawTool(DrawToolType.MeasureDistanceLine, sender);
}
///
/// 长度测量->长度
///
private void MenuLengthLine_Click(object sender, EventArgs e)
{
SetDrawTool(DrawToolType.MeasureLength, sender);
}
///
/// 长度测量->水平线
///
private void MenuHorizontalLine_Click(object sender, EventArgs e)
{
SetDrawTool(DrawToolType.MeasureHLine, sender);
}
///
/// 长度测量->垂线
///
private void MenuPerpendicular_Click(object sender, EventArgs e)
{
SetDrawTool(DrawToolType.MeasureVLine, sender);
}
///
/// 测量-曲线-折线
///
private void MenuPolyline_Click(object sender, EventArgs e)
{
SetDrawTool(DrawToolType.MeasureBrokenLine, sender);
}
///
/// 曲线测量->轨迹曲线
///
private void MenuTraceCurve_Click(object sender, EventArgs e)
{
SetDrawTool(DrawToolType.MeasureTraceCurve, sender);
}
///
/// 圆形->三点圆
///
private void MenuThreePointCircle_Click(object sender, EventArgs e)
{
SetDrawTool(DrawToolType.MeasureCircle, sender);
}
///
/// 圆形->向内画圆
///
private void MenuDrawCircleInward_Click(object sender, EventArgs e)
{
SetDrawTool(DrawToolType.MeasureInnerCircle, sender);
}
///
/// 圆形->向外画圆
///
private void MenuDrawCircleOutward_Click(object sender, EventArgs e)
{
SetDrawTool(DrawToolType.MeasureOuterCircle, sender);
}
///
/// 圆形->直径画圆
///
private void MenuDiameterCircle_Click(object sender, EventArgs e)
{
SetDrawTool(DrawToolType.MeasureDiameterCircle, sender);
}
///
/// 圆形->点到圆距离
///
private void MenuPointToCircleDistance_Click(object sender, EventArgs e)
{
SetDrawTool(DrawToolType.MeasurePointEdgeSize, sender);
}
///
/// 圆形->点到圆心距离
///
private void MenuPointToCenterDistance_Click(object sender, EventArgs e)
{
SetDrawTool(DrawToolType.MeasurePointCenterSize, sender);
}
///
/// 圆形->点到圆弧距离
///
private void MenuPointToArcDistance_Click(object sender, EventArgs e)
{
SetDrawTool(DrawToolType.MeasurePointArcSize, sender);
}
///
/// 对准度->圆心到圆心距离
///
private void MenuCenterToCenterDistance_Click(object sender, EventArgs e)
{
SetDrawTool(DrawToolType.MeasureCenterCenterSize, sender);
}
///
/// 对准度->两线中垂线距离
///
private void MeasureTwoLineVLDistance_Click(object sender, EventArgs e)
{
SetDrawTool(DrawToolType.MeasureTwoLineVLDistance, sender);
}
///
/// 曲线测量->曲线
///
private void MenuCurve_Click(object sender, EventArgs e)
{
SetDrawTool(DrawToolType.MeasureCurveLine, sender);
}
///
/// 三点角度
///
private void menuThreePointAngle_Click(object sender, EventArgs e)
{
SetDrawTool(DrawToolType.MeasureThreePointAngle, sender);
}
///
/// 四点角度
///
private void menuFourPointAngle_Click(object sender, EventArgs e)
{
SetDrawTool(DrawToolType.MeasureFourPointAngle, sender);
}
///
/// 三点弧
///
private void menuThreePointArc_Click(object sender, EventArgs e)
{
SetDrawTool(DrawToolType.MeasureThreePointArc, sender);
}
///
/// 几何测量
///
private void menuGeometryMeasure_Click(object sender, EventArgs e)
{
//if (AppWorkspace.ActiveDocumentWorkspace != null)
//{
if (AppWorkspace.startScriptRecording)
{
AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List());
}
AppWorkspace.Widgets.GeometryMeasureDialog.Visible = !AppWorkspace.Widgets.GeometryMeasureDialog.Visible;
this.AppWorkspace.toolBar.RefreshBtnSelect(AppWorkspace.Widgets.GeometryMeasureDialog.Visible, "Geometry");
this.AppWorkspace.toolsPanel.RefreshBtnSelect(AppWorkspace.Widgets.GeometryMeasureDialog.Visible, "Geometry");
this.menuGeometryMeasure.Checked = AppWorkspace.Widgets.GeometryMeasureDialog.Visible;
if (AppWorkspace.ActiveDocumentWorkspace != null)
{
AppWorkspace.ActiveDocumentWorkspace.Focus();
}
//Form form = Application.OpenForms["GeometryMeasureDialog"];//尝试获取已经弹出的窗口对象
//FloatingFormMethod.ShowFloatForm(form, form == null ? new GeometryMeasureDialog(AppWorkspace) : null, AppWorkspace, true);
AppWorkspace.RefreshMeasureListView();
//}
}
///
///点垂线
///
private void menuPointVertical_Click(object sender, EventArgs e)
{
SetDrawTool(DrawToolType.MeasurePLine, sender);
}
///
///多点垂线
///
private void menuMultiPointVertical_Click(object sender, EventArgs e)
{
SetDrawTool(DrawToolType.MeasureMulPLine, sender);
}
///
///点到水平线距离
///
private void menuMultiPointToHLine_Click(object sender, EventArgs e)
{
SetDrawTool(DrawToolType.MeasurePointHLine, sender);
}
///
///水平多点垂线
///
private void menuHorizontalMultipointVertical_Click(object sender, EventArgs e)
{
SetDrawTool(DrawToolType.MeasureHMulPLine, sender);
}
///
///垂直多点垂线
///
private void menuVerticalMultipointVertical_Click(object sender, EventArgs e)
{
SetDrawTool(DrawToolType.MeasureVMulPLine, sender);
}
///
///平行线
///
private void menuParallelLine_Click(object sender, EventArgs e)
{
SetDrawTool(DrawToolType.MeasureParallelLine, sender);
}
///
///多点平行线
///
private void menuMultipointParallel_Click(object sender, EventArgs e)
{
SetDrawTool(DrawToolType.MeasureMulParallelLine, sender);
}
///
///水平多点平行线
///
private void menuMultipointHorizontalParallelLines_Click(object sender, EventArgs e)
{
SetDrawTool(DrawToolType.MeasureHMulParallelLine, sender);
}
///
///垂直多点平行线
///
private void menuMultipointVerticalParallelLines_Click(object sender, EventArgs e)
{
SetDrawTool(DrawToolType.MeasureVMulParallelLine, sender);
}
///
///闭合曲线
///
///
private void menuClosedCurve_Click(object sender, EventArgs e)
{
SetDrawTool(DrawToolType.MeasureClosedCurve, sender);
}
///
///多边形
///
private void menuPolygon_Click(object sender, EventArgs e)
{
SetDrawTool(DrawToolType.MeasurePolygon, sender);
}
///
///矩形
///
private void menuRectangle_Click(object sender, EventArgs e)
{
SetDrawTool(DrawToolType.MeasureRectangle, sender);
}
///
/// 任意矩形
///
private void menuArbitraryRectangle_Click(object sender, EventArgs e)
{
SetDrawTool(DrawToolType.MeasureRandRectangle, sender);
}
///
/// 任意正方形
///
private void menuArbitrarySquare_Click(object sender, EventArgs e)
{
SetDrawTool(DrawToolType.MeasureRandSquare, sender);
}
///
///正方形
///
private void menuSquare_Click(object sender, EventArgs e)
{
SetDrawTool(DrawToolType.MeasureSquare, sender);
}
///
///轨迹多边形
///
private void menuTrackPolygon_Click(object sender, EventArgs e)
{
SetDrawTool(DrawToolType.MeasureTracePolygon, sender);
}
///
///多点直线
///
private void menuMultipointStraightLine_Click(object sender, EventArgs e)
{
SetDrawTool(DrawToolType.MeasureMulLine, sender);
}
///
///多点线段
///
private void menuMultipointLineSegment1_Click(object sender, EventArgs e)
{
SetDrawTool(DrawToolType.MeasureMulSegment, sender);
}
///
///多点水平线
///
private void menuMultipointHorizontalLine_Click(object sender, EventArgs e)
{
SetDrawTool(DrawToolType.MeasureMulHVLine, sender);
}
///
///多点垂直线
///
private void menuMultipointVerticalLine_Click(object sender, EventArgs e)
{
SetDrawTool(DrawToolType.MeasureMulVLine, sender);
}
///
/// 标尺标定
///
private void MenuRulerCalibration_Click(object sender, EventArgs e)
{
AppWorkspace.Widgets.RuleListForm.Visible = !AppWorkspace.Widgets.RuleListForm.Visible;
if (AppWorkspace.ActiveDocumentWorkspace != null)
{
if (AppWorkspace.startScriptRecording)
{
AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List());
}
this.AppWorkspace.toolBar.RefreshBtnSelect(AppWorkspace.Widgets.RuleListForm.Visible, "RulerCalibration");
this.AppWorkspace.toolsPanel.RefreshBtnSelect(AppWorkspace.Widgets.RuleListForm.Visible, "RulerCalibration");
this.menuRulerCalibration.Checked = AppWorkspace.Widgets.RuleListForm.Visible;
AppWorkspace.ActiveDocumentWorkspace.Focus();
//AppWorkspace.Widgets.RuleListForm.MenuSubApplyCurrent();
}
}
///
/// 应用当前
///
private void MenuSubApplyCurrent_Click(object sender, EventArgs e)
{
if (AppWorkspace.startScriptRecording)
{
AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List());
}
AppWorkspace.Widgets.RuleListForm.MenuSubApplyCurrent();
}
///
/// 应用全部
///
private void MenuSubApplyAll_Click(object sender, EventArgs e)
{
if (AppWorkspace.startScriptRecording)
{
AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List());
}
AppWorkspace.Widgets.RuleListForm.MenuSubApplyAll();
}
///
/// 测量列表
///
private void MenuMeasureList_Click(object sender, EventArgs e)
{
AppWorkspace.Widgets.MeasureListDialog.Visible = !AppWorkspace.Widgets.MeasureListDialog.Visible;
if (AppWorkspace.ActiveDocumentWorkspace != null)
{
if (AppWorkspace.startScriptRecording)
{
AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List());
}
this.AppWorkspace.toolBar.RefreshBtnSelect(AppWorkspace.Widgets.MeasureListDialog.Visible, "MeasureList");
this.AppWorkspace.toolsPanel.RefreshBtnSelect(AppWorkspace.Widgets.MeasureListDialog.Visible, "MeasureList");
this.menuMeasureList.Checked = AppWorkspace.Widgets.MeasureListDialog.Visible;
AppWorkspace.ActiveDocumentWorkspace.Focus();
}
}
///
/// 光密度
///
private void MenuOpticalDensity_Click(object sender, EventArgs e)
{
AppWorkspace.Widgets.OpticalDensityDialog.Visible = !AppWorkspace.Widgets.OpticalDensityDialog.Visible;
if (AppWorkspace.ActiveDocumentWorkspace != null)
{
if (AppWorkspace.startScriptRecording)
{
AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List());
}
this.AppWorkspace.toolBar.RefreshBtnSelect(AppWorkspace.Widgets.OpticalDensityDialog.Visible, "OpticalDensity");
this.AppWorkspace.toolsPanel.RefreshBtnSelect(AppWorkspace.Widgets.OpticalDensityDialog.Visible, "OpticalDensity");
this.menuOpticalDensity.Checked = AppWorkspace.Widgets.OpticalDensityDialog.Visible;
bool canDram = true;
int count = this.AppWorkspace.ActiveDocumentWorkspace.GraphicsList.Count;
for (int i = 0; i < count; i++)
{
if (this.AppWorkspace.ActiveDocumentWorkspace.GraphicsList[i].objectType == DrawClass.Other
&& this.AppWorkspace.ActiveDocumentWorkspace.GraphicsList[i].drawToolType == DrawToolType.OpticalDensityLine)
{
canDram = false;
this.AppWorkspace.ActiveDocumentWorkspace.GraphicsList[i].Selected = true;
}
}
if (canDram)
AppWorkspace.ActiveDocumentWorkspace.ActiveTool = DrawToolType.OpticalDensityLine;
AppWorkspace.ActiveDocumentWorkspace.Focus();
}
}
///
/// 位图分析
///
private void BitmapAnalysis_Click(object sender, EventArgs e)
{
if (AppWorkspace.ActiveDocumentWorkspace != null)
{
using (BitmapAnalysisDialog dialog = new BitmapAnalysisDialog(this.AppWorkspace))
{
if (AppWorkspace.startScriptRecording)
{
AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List());
}
dialog.StartPosition = FormStartPosition.CenterParent;
dialog.ShowDialog();
}
}
else
{
MessageBox.Show(PdnResources.GetString("Menu.Pleaseopenatleastonepicturefirst.Text"));
}
}
///
/// 理论比例尺
///
private void TheoreticalScale_Click(object sender, EventArgs e)
{
using (TheoreticalScaleDialog dialog = new TheoreticalScaleDialog(this.AppWorkspace, ArrayList1, ArrayList2, ArrayList3))
{
if (AppWorkspace.startScriptRecording)
{
AppWorkspace.SetScriptStartRecording(((PdnMenuItem)sender).MenuId, ((PdnMenuItem)sender).Text, new List());
}
dialog.StartPosition = FormStartPosition.CenterParent;
dialog.ShowDialog();
}
}
private void SetCameraPreviewActiveTool(DrawToolType drawToolType)
{
if (AppWorkspace.cameraPreviewDialog != null && !AppWorkspace.cameraPreviewDialog.IsDisposed)
{
AppWorkspace.cameraPreviewDialog.documentWorkspace.ActiveTool = drawToolType;
}
}
private string GetCultureInfoName(CultureInfo ci)
{
CultureInfo en_US = new CultureInfo("en-US");
if (ci.Equals(en_US))
{
return GetCultureInfoName(ci.Parent);
}
else
{
return ci.NativeName;
}
}
public void checkMenu(bool v)
{
this.menuContinuousDrawingAction.Checked = v;
if (v == false)
_p2Form?.SetActiveTool(DrawToolType.Pointer);
}
}
}