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.
345 lines
9.3 KiB
C#
345 lines
9.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Drawing;
|
|
#if WEB_SERVICE
|
|
#else
|
|
using System.Drawing.Design;
|
|
using System.Windows.Forms;
|
|
#endif
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Xml.Serialization;
|
|
using GeoSigma;
|
|
using GeoSigma.SigmaDrawerStyle;
|
|
using GeoSigma.SigmaDrawerStyle.Converter;
|
|
using GeoSigmaDrawLib;
|
|
using SigmaDrawerStyle;
|
|
|
|
namespace SigmaDrawerElement
|
|
{
|
|
/// <summary>
|
|
/// 坐标框
|
|
/// </summary>
|
|
[TypeConverter(typeof(PropertySorter))]
|
|
public class DrawerFrameGrid : ElementBase
|
|
{
|
|
/// <summary>
|
|
/// 属性类别排序
|
|
/// </summary>
|
|
private List<string> categorys = new List<string>() { "基础属性", "数据", "外边框", "高级", "其他", "杂项" };
|
|
public DrawerFrameGrid()
|
|
{
|
|
ElementType = DrawElementType.ELEMENT_GRID;
|
|
}
|
|
|
|
[XmlIgnore]
|
|
[Browsable(false)]
|
|
[Category("数据"), DisplayName("名字"), ReadOnly(true), PropertyOrder(1)]
|
|
public override string Name
|
|
{
|
|
get
|
|
{
|
|
return base.Name;
|
|
}
|
|
set
|
|
{
|
|
base.Name = value;
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
[Category("\t\t\t基础属性"), DisplayName("网格步长"), PropertyOrder(1)]
|
|
public PropertyPoint MarkSpace
|
|
{
|
|
get
|
|
{
|
|
return new PropertyPoint((float)Base.StepX, (float)Base.StepY);
|
|
}
|
|
set
|
|
{
|
|
Base.StepX = value.X;
|
|
Base.StepY = value.Y;
|
|
}
|
|
}
|
|
[XmlIgnore]
|
|
[Category("\t\t\t基础属性"), DisplayName("文字尺寸"), PropertyOrder(2)]
|
|
public double TextSize
|
|
{
|
|
get
|
|
{
|
|
return Base.Height;
|
|
}
|
|
set
|
|
{
|
|
Base.Height = value;
|
|
Base.Width = value * 0.4;
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
[Category("\t\t\t基础属性"), DisplayName("显示方式"), PropertyOrder(3)]
|
|
[TypeConverter(typeof(SigmaDrawerElement.Converter.FrameGridDisplayStyleConverter))]
|
|
public int DisplayStyle
|
|
{
|
|
get
|
|
{
|
|
return Base.Style & ((int)GridDisplayStyle.showLine |
|
|
(int)GridDisplayStyle.showCrossPoint |
|
|
(int)GridDisplayStyle.showNull);
|
|
}
|
|
set
|
|
{
|
|
Base.Style &= ~((int)GridDisplayStyle.showLine |
|
|
(int)GridDisplayStyle.showCrossPoint |
|
|
(int)GridDisplayStyle.showNull);
|
|
Base.Style |= value;
|
|
}
|
|
}
|
|
[XmlIgnore]
|
|
[Category("\t\t\t基础属性"), DisplayName("标注方式"), PropertyOrder(4)]
|
|
[TypeConverter(typeof(SigmaDrawerElement.Converter.FrameGridStyleConverter))]
|
|
public int TextMode
|
|
{
|
|
get
|
|
{
|
|
return Base.Style & (int)GridTextStyle.textAll;
|
|
}
|
|
set
|
|
{
|
|
Base.Style &= ~(int)GridTextStyle.textAll;
|
|
Base.Style |= value;
|
|
}
|
|
}
|
|
//MarkBorder
|
|
[XmlIgnore]
|
|
[Category("\t\t\t基础属性"), DisplayName("坐标范围"), PropertyOrder(5)]
|
|
[TypeConverter(typeof(GeoSigma.SigmaDrawerStyle.Converter.BaseExpandableConverter))]
|
|
public DrawerRange RangeDelta
|
|
{
|
|
get
|
|
{
|
|
if (GridRange == null)
|
|
{
|
|
GridRange = new DrawerCoordinateLBTR();
|
|
}
|
|
return GridRange.RangeDelta;
|
|
}
|
|
set
|
|
{
|
|
GridRange.Create(value.Left, value.Right, value.Bottom, value.Top);
|
|
}
|
|
}
|
|
[XmlIgnore]
|
|
[Browsable(false)]
|
|
public DrawerCoordinateLBTR GridRange { get; set; }
|
|
|
|
[XmlIgnore]
|
|
[Category("\t\t外边框"), DisplayName("是否显示"), PropertyOrder(1)]
|
|
[TypeConverter(typeof(YesNoConverter))]
|
|
public bool EnableFrame
|
|
{
|
|
get
|
|
{
|
|
if (((int)Base.Style & (int)GridingStyle.showOutFrame) == 0)
|
|
{
|
|
return false;
|
|
}
|
|
else
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
set
|
|
{
|
|
if (value == true)
|
|
{
|
|
Base.Style |= (int)GridingStyle.showOutFrame;
|
|
}
|
|
else
|
|
{
|
|
Base.Style &= ~(int)GridingStyle.showOutFrame;
|
|
}
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
[Category("\t\t外边框"), DisplayName("厚度"), PropertyOrder(2)]
|
|
public double FrameThickness
|
|
{
|
|
get
|
|
{
|
|
return Frame.Thickness;
|
|
}
|
|
set
|
|
{
|
|
Frame.Thickness = value;
|
|
}
|
|
}
|
|
[XmlIgnore]
|
|
#if WEB_SERVICE
|
|
#else
|
|
[Editor(typeof(PropertyEditorColor), typeof(UITypeEditor))]
|
|
#endif
|
|
[Category("\t\t外边框"), DisplayName("颜色"), PropertyOrder(3)]
|
|
public Color FrameColor
|
|
{
|
|
get
|
|
{
|
|
return ColorTranslator.FromWin32(Frame.FrameColor);
|
|
}
|
|
set
|
|
{
|
|
Frame.FrameColor = ColorTranslator.ToWin32(value);
|
|
}
|
|
}
|
|
|
|
[XmlIgnore]
|
|
[Category("\t高级"), DisplayName("基数"), PropertyOrder(1)]
|
|
public PropertyPoint BaseOffset
|
|
{
|
|
get
|
|
{
|
|
return new PropertyPoint(Other.BX, Other.BY);
|
|
}
|
|
set
|
|
{
|
|
Other.BX = value.X;
|
|
Other.BY = value.Y;
|
|
}
|
|
}
|
|
[XmlIgnore]
|
|
[Category("\t高级"), DisplayName("系数"), PropertyOrder(2)]
|
|
public PropertyPoint BaseScale
|
|
{
|
|
get
|
|
{
|
|
return new PropertyPoint(Other.CX, Other.CY);
|
|
}
|
|
set
|
|
{
|
|
Other.CX = value.X;
|
|
Other.CY = value.Y;
|
|
}
|
|
}
|
|
[XmlElement]
|
|
[Browsable(false)]
|
|
public string Coordinate
|
|
{
|
|
get
|
|
{
|
|
if (GridRange == null)
|
|
{
|
|
return string.Empty;
|
|
}
|
|
return GridRange.Text;
|
|
}
|
|
set
|
|
{
|
|
GridRange = new DrawerCoordinateLBTR();
|
|
GridRange.Text = value;
|
|
}
|
|
}
|
|
[Browsable(false)]
|
|
[XmlElement]
|
|
public FrameGridBase Base { get; set; }
|
|
[XmlElement]
|
|
[Browsable(false)]
|
|
public FrameGridOther Other { get; set; }
|
|
[XmlElement]
|
|
[Browsable(false)]
|
|
public FrameGridOuter Frame { get; set; }
|
|
}
|
|
public class FrameGridBase
|
|
{
|
|
[XmlAttribute]
|
|
public double Height { get; set; } = 0.2;
|
|
[XmlAttribute]
|
|
public double Width { get; set; } = 0.08;
|
|
private double stepX = 10;
|
|
|
|
[XmlAttribute]
|
|
public double StepX
|
|
{
|
|
get
|
|
{
|
|
return stepX;
|
|
}
|
|
set
|
|
{
|
|
if (value > 0)
|
|
{
|
|
stepX = value;
|
|
}
|
|
else
|
|
{
|
|
#if WEB_SERVICE
|
|
#else
|
|
MessageBox.Show("输入值必须大于零");
|
|
#endif
|
|
}
|
|
}
|
|
}
|
|
[XmlAttribute]
|
|
private double stepY = 10;
|
|
|
|
[XmlAttribute]
|
|
public double StepY
|
|
{
|
|
get
|
|
{
|
|
return stepY;
|
|
}
|
|
set
|
|
{
|
|
if (value > 0)
|
|
{
|
|
stepY = value;
|
|
}
|
|
else
|
|
{
|
|
#if WEB_SERVICE
|
|
#else
|
|
MessageBox.Show("输入值必须大于零");
|
|
#endif
|
|
}
|
|
}
|
|
}
|
|
[XmlAttribute]
|
|
public int Style { get; set; } = (int)GridDisplayStyle.showLine |
|
|
(int)GridingStyle.markAllSide |
|
|
(int)GridingStyle.showInFrame |
|
|
(int)GridingStyle.showText |
|
|
(int)GridTextStyle.textMath |
|
|
(int)GridingStyle.showOutFrame;
|
|
}
|
|
public class FrameGridOther
|
|
{
|
|
[XmlAttribute]
|
|
public double BX { get; set; } = 0;
|
|
[XmlAttribute]
|
|
public double BY { get; set; } = 0;
|
|
[XmlAttribute]
|
|
public double CX { get; set; } = 0;
|
|
[XmlAttribute]
|
|
public double CY { get; set; } = 0;
|
|
}
|
|
public class FrameGridOuter
|
|
{
|
|
[XmlAttribute]
|
|
public double Thickness { get; set; } = 0.1;
|
|
[XmlAttribute]
|
|
public bool BlackFrame { get; set; } = true;
|
|
[XmlAttribute]
|
|
public string MarkName { get; set; } = string.Empty;
|
|
[XmlAttribute]
|
|
public int Style { get; set; } = (int)FrameStyle.FRAME_BLACK_LINE
|
|
| (int)FrameStyle.modeCenter
|
|
| (int)FrameStyle.COORDINATE_LEFT_BOTTOM
|
|
| (int)FrameStyle.INSERT_DRAW_PLUS;
|
|
[XmlAttribute("Color")]
|
|
public int FrameColor { get; set; } = 0;
|
|
}
|
|
}
|