123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- /**
- *
- * @author seagle
- * @date 2024-7-22
- * @Description 管路图元件对象封装
- */
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace MECF.Framework.UI.Core.DxfScript
- {
- public class GasText: GasBaseShape
- {
- public double X { get; set; }
- public double Y { get; set; }
- public string Text { get; set; }
-
- public double FontSize { get; set; } = 0;
- public double TextHeight { get; set; } = 0;
- public double RectHeight { get; set; } = 0;
- public double RectWidth { get; set; } = 0;
- public double LineSpace { get; set; } = 0;
- public int Alignment = 5; //1 = 左上;2 = 中上;3 = 右上 4 = 左中;5 = 正中;6 = 右中 7 = 左下;8 = 中下;9 = 右下
- public GasText( double x,double y, string text)
- {
- X = x;
- Y = y;
- Text = text;
- Id = CreateId(ShapeType.TEXT, x, y);
- }
- public override bool Contains(double x, double y)
- {
- double left = 0;
- double top = 0;
- double right = 0;
- double bottom = 0;
- switch (Alignment)
- {
- case 1:
- left =X;
- top=Y;
- break;
- case 4:
- left = X;
- top = Y+RectHeight/2;
- break;
- case 7:
- left =X;
- top = Y + RectHeight;
- break;
- case 2:
- left = X - RectWidth / 2;
- top = Y;
- break;
- case 5:
- left = X - RectWidth / 2;
- top = Y + RectHeight / 2;
- break;
- case 8:
- left = X - RectWidth / 2;
- top = Y + RectHeight;
- break;
- case 3:
- left = X - RectWidth ;
- top = Y;
- break;
- case 6:
- left = X - RectWidth;
- top = Y + RectHeight / 2;
- break;
- case 9:
- left = X - RectWidth;
- top = Y + RectHeight;
- break;
- }
- right = left + RectWidth;
- bottom = top -RectHeight;
- if (x>=left-E && x<=right+E &&
- y>=bottom-E && y <= top+E)
- {
- return true;
- }
- else
- {
- return false;
- }
-
- }
- public override void Move(double x, double y)
- {
- X += x;
- Y += y;
- }
- }
- }
|