1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- using MECF.Framework.UI.Core.DxfScript;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Media;
- using System.Windows.Shapes;
- namespace MECF.Framework.UI.Core.DxfScript
- {
- public abstract class GasBaseShape : UIElement
- {
- public enum ShapeType { HLINE = 1, VLINE = 2, ACUTE = 3, OBTUSE = 4, POLY = 5, CIRCLE = 6, TEXT = 7, FUNNEL = 8 };
- public int Id { get; set; } = 0;
- public Script BoolCondition { get; set; } = null;
- public Script StringCondition { get; set; } = null;
- public Script ClickCondition { get; set; } = null;
- public static double E { get; set; } = 2;
- public bool Enable { get; set; } = true;
- public Brush Brush { get; set; } = null;
- /// <summary>
- /// 点击坐标是否在元素内部
- /// </summary>
- /// <param name="x"></param>
- /// <param name="y"></param>
- /// <returns>true在则选中该元素 ;false不在</returns>
- public abstract bool Contains(double x, double y);
- public static int CreateId(ShapeType shapeType, double x, double y)
- {
- int xx = (int)(Math.Round(x + 0.0001) / 2);
- int yy = (int)(Math.Round(y + 0.0001) / 2);
- return ((int)shapeType) * 1000000 + xx * 1000 + yy;
- }
- public bool IsSamePoint(double x, double y, double ox, double oy)
- {
- return Math.Abs(x - ox) < E && Math.Abs(y - oy) < E;
- }
- /// <summary>
- /// 页面拖拽坐标点随之改变
- /// </summary>
- /// <param name="x"></param>
- /// <param name="y"></param>
- public abstract void Move(double x, double y);
- }
- }
|