You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kev/Drawer/UCDraw/SigmaDrawerStyle/RectangularCSGridProperty.cs

480 lines
14 KiB
C#

1 month ago
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;
using System.Drawing;
1 month ago
#if WEB_SERVICE
#else
1 month ago
using System.Drawing.Design;
1 month ago
#endif
1 month ago
namespace GeoSigma.SigmaDrawerStyle
{
public interface IRectangularCSGridPropertyChange
{
//提供这个接口的目的:改变子属性值,父属性未立即改变。
//例如,改变步长,但x,y未立即改变。需要点击'x,y'后,'x,y'才会改变。
//解决这个问题的方法:通知外界,属性已经改变了。外部代码,接到通知后,全部刷新属性。
//
void RCSGridPropertyChange();
}
public class GridStep
{
private IRectangularCSGridPropertyChange iChange;
/// <summary>
/// Initializes a new instance of the <see cref="GridStep"/> class.
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
/// <param name="iChange"></param>
public GridStep(double x, double y, IRectangularCSGridPropertyChange iChange)
{
this.iChange = iChange;
this.x = x;
this.y = y;
}
//需重写此方法.这个结果会显示是网格步长后面.
public override string ToString()
{
return x.ToString() + "," + y.ToString();
}
private double x;
private double y;
[DisplayName("\t\t\t\t\t\tX(米)")]
public double X
{
get => x;
set
{
x = value;
iChange.RCSGridPropertyChange();
}
}
[DisplayName("\t\t\t\t\t\tY(米)")]
public double Y
{
get => y;
set
{
y = value;
iChange.RCSGridPropertyChange();
}
}
}
public class Base
{
private IRectangularCSGridPropertyChange iChange;
/// <summary>
/// Initializes a new instance of the <see cref="Base"/> class.
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
/// <param name="iChange"></param>
public Base(double x, double y, IRectangularCSGridPropertyChange iChange)
{
this.iChange = iChange;
}
private double x;
private double y;
public double X
{
get => x;
set
{
x = value;
iChange.RCSGridPropertyChange();
}
}
public double Y
{
get => y;
set
{
y = value;
iChange.RCSGridPropertyChange();
}
}
public override string ToString()
{
return x.ToString() + "," + y.ToString();
}
}
public class Coefficient
{
private IRectangularCSGridPropertyChange iChange;
/// <summary>
/// Initializes a new instance of the <see cref="Coefficient"/> class.
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
/// <param name="iChange"></param>
public Coefficient(double x, double y, IRectangularCSGridPropertyChange iChange)
{
this.iChange = iChange;
}
private double x = 1;
private double y = 1;
public double X
{
get => x;
set
{
x = value;
iChange.RCSGridPropertyChange();
}
}
public double Y
{
get => y;
set
{
y = value;
iChange.RCSGridPropertyChange();
}
}
public override string ToString()
{
return x.ToString() + "," + y.ToString();
}
}
public class CoordinateRange
{
private IRectangularCSGridPropertyChange iChange;
/// <summary>
/// Initializes a new instance of the <see cref="CoordinateRange"/> class.
/// </summary>
/// <param name="left"></param>
/// <param name="top"></param>
/// <param name="right"></param>
/// <param name="bottom"></param>
/// <param name="iChange"></param>
public CoordinateRange(double left, double top, double right, double bottom, IRectangularCSGridPropertyChange iChange)
{
this.iChange = iChange;
}
private double left = 0.0;
private double top = 0.0;
private double right = 0.0;
private double bottom = 0.0;
[DisplayName("\t\t\t\t\t\t\t\t\t左")]
public double Left
{
get => left;
set
{
left = value;
iChange.RCSGridPropertyChange();
}
}
[DisplayName("\t\t\t\t\t\t\t\t上")]
public double Top
{
get => top;
set
{
top = value;
iChange.RCSGridPropertyChange();
}
}
[DisplayName("\t\t\t\t\t\t\t右")]
public double Right
{
get => right;
set
{
right = value;
iChange.RCSGridPropertyChange();
}
}
[DisplayName("\t\t\t\t\t\t下")]
public double Bottom
{
get => bottom;
set
{
bottom = value;
iChange.RCSGridPropertyChange();
}
}
public override string ToString()
{
return left.ToString() + "," + top.ToString() + "," + right.ToString() + "," + bottom.ToString();
}
}
public class RectangularCSGridProperty
{
public enum SHOWMODE
{
线,
,
}
public enum SCALE
{
,
,
1,
2
}
public enum NOTATION_MODE
{
,
,
,
,
}
public enum OUTER_BORDER
{
,
}
public enum BLACK_BORDER
{
,
}
/// <summary>
/// Initializes a new instance of the <see cref="RectangularCSGridProperty"/> class.
/// </summary>
/// <param name="iChange"></param>
public RectangularCSGridProperty(IRectangularCSGridPropertyChange iChange)
{
this.iChange = iChange;
step = new GridStep(25, 25, iChange);
coefficient = new Coefficient(1, 1, iChange);
baseNumber = new Base(0, 0, iChange);
coordRange = new CoordinateRange(0, 0, 0, 0, iChange);
showMode = SHOWMODE.线;
gridColor = Color.Black;
}
private IRectangularCSGridPropertyChange iChange;
private SHOWMODE showMode;
private GridStep step;
private Color gridColor;
private int textHeight = 200;
private SCALE textScale = SCALE.;
private NOTATION_MODE notatioinMode = NOTATION_MODE.;
private Base baseNumber;
private Coefficient coefficient;
private CoordinateRange coordRange;
private OUTER_BORDER outerBorder = OUTER_BORDER.;
private int borderThickness = 100;
private BLACK_BORDER blackOutterBorder = BLACK_BORDER.;
private Color borderColor = Color.Black;
[Category("\t直角网"), DisplayName("\t\t\t\t\t\t显示方式")]
public SHOWMODE ShowMode
{
get => showMode;
set
{
showMode = value;
iChange.RCSGridPropertyChange();
}
}
[Category("\t直角网"), DisplayName("\t\t\t\t\t\t网格步长")]
[TypeConverter(typeof(ExpandableObjectConverter))]
public GridStep Step
{
get => step;
set
{
step = value;
iChange.RCSGridPropertyChange();
}
}
1 month ago
#if WEB_SERVICE
#else
1 month ago
[Editor(typeof(PropertyEditorColor), typeof(UITypeEditor))]
1 month ago
#endif
1 month ago
[Category("\t直角网"), DisplayName("\t\t\t\t\t\t颜色")]
public Color GridColor
{
get => gridColor;
set
{
gridColor = value;
iChange.RCSGridPropertyChange();
}
}
[Category("文本"), DisplayName("\t\t\t\t\t\t文字高度")]
public int TextHeight
{
get => textHeight;
set
{
textHeight = value;
iChange.RCSGridPropertyChange();
}
}
[Category("文本"), DisplayName("\t\t\t\t\t\t刻度")]
public SCALE TextScale
{
get => textScale;
set
{
textScale = value;
iChange.RCSGridPropertyChange();
}
}
[Category("文本"), DisplayName("\t\t\t\t\t\t标注方式")]
public NOTATION_MODE NotatioinMode
{
get => notatioinMode;
set
{
notatioinMode = value;
iChange.RCSGridPropertyChange();
}
}
[Category("高级设置"), DisplayName("\t\t\t\t\t\t基数")]
[TypeConverter(typeof(ExpandableObjectConverter))]
public Base BaseNumber
{
get => baseNumber;
set
{
baseNumber = value;
iChange.RCSGridPropertyChange();
}
}
[Category("高级设置"), DisplayName("\t\t\t\t\t\t系数")]
[TypeConverter(typeof(ExpandableObjectConverter))]
public Coefficient Coefficient
{
get => coefficient;
set
{
coefficient = value;
iChange.RCSGridPropertyChange();
}
}
[Category("高级设置"), DisplayName("\t\t\t\t\t\t坐标范围")]
[TypeConverter(typeof(ExpandableObjectConverter))]
public CoordinateRange CoordRange
{
get => coordRange;
set
{
coordRange = value;
iChange.RCSGridPropertyChange();
}
}
[Category("边框"), DisplayName("\t\t\t\t\t\t显示外边框")]
public OUTER_BORDER OuterBorder
{
get => outerBorder;
set
{
outerBorder = value;
iChange.RCSGridPropertyChange();
}
}
[Category("边框"), DisplayName("\t\t\t\t\t\t边框厚度")]
public int BorderThickness
{
get => borderThickness;
set
{
borderThickness = value;
iChange.RCSGridPropertyChange();
}
}
[Category("边框"), DisplayName("\t\t\t\t\t\t显示为黑边框")]
public BLACK_BORDER BlackOutterBorder
{
get => blackOutterBorder;
set
{
blackOutterBorder = value;
iChange.RCSGridPropertyChange();
}
}
[Category("边框"), DisplayName("\t\t\t\t\t\t颜色")]
1 month ago
#if WEB_SERVICE
#else
1 month ago
[Editor(typeof(PropertyEditorColor), typeof(UITypeEditor))]
1 month ago
#endif
1 month ago
public Color BorderColor
{
get => borderColor;
set
{
borderColor = value;
iChange.RCSGridPropertyChange();
}
}
public void FillData(ref GeoSigmaDrawLib.RectangularCSGridData data)
{
data.baseX = this.BaseNumber.X;
data.baseY = this.BaseNumber.Y;
data.blackOutterBorder = (int)this.BlackOutterBorder;
data.borderColorR = this.BorderColor.R;
data.borderColorG = this.BorderColor.G;
data.borderColorB = this.BorderColor.B;
data.borderThickness = this.BorderThickness;
data.left = this.CoordRange.Left;
data.top = this.CoordRange.Top;
data.right = this.CoordRange.Right;
data.bottom = this.CoordRange.Bottom;
data.coefficientX = this.Coefficient.X;
data.coefficientY = this.Coefficient.Y;
data.gridColorR = this.GridColor.R;
data.gridColorG = this.GridColor.G;
data.gridColorB = this.GridColor.B;
data.isShowOutBorder = (int)this.OuterBorder;
data.notatioinMode = (int)this.NotatioinMode;
data.showMode = (int)this.ShowMode;
data.stepX = this.Step.X;
data.stepY = this.Step.Y;
data.textHeight = this.TextHeight;
data.textScale = (int)this.TextScale;
}
public void GetData(GeoSigmaDrawLib.RectangularCSGridData data)
{
this.BaseNumber.X = data.baseX;
this.BaseNumber.Y = data.baseY;
this.BlackOutterBorder = (BLACK_BORDER)data.blackOutterBorder;
this.BorderColor = Color.FromArgb(data.borderColorR, data.borderColorG, data.borderColorB);
this.BorderThickness = data.borderThickness;
this.CoordRange.Left = data.left;
this.CoordRange.Top = data.top;
this.CoordRange.Right = data.right;
this.CoordRange.Bottom = data.bottom;
this.Coefficient.X = data.coefficientX;
this.Coefficient.Y = data.coefficientY;
this.GridColor = Color.FromArgb(data.gridColorR, data.gridColorG, data.gridColorB);
this.OuterBorder = (OUTER_BORDER)data.isShowOutBorder;
this.NotatioinMode = (NOTATION_MODE)data.notatioinMode;
this.ShowMode = (SHOWMODE)data.showMode;
this.Step.X = data.stepX;
this.Step.Y = data.stepY;
this.TextHeight = data.textHeight;
this.TextScale = (SCALE)data.textScale;
}
}
}