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.

637 lines
30 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using Arction.Wpf.ChartingMVVM;
using Arction.Wpf.ChartingMVVM.Axes;
using Arction.Wpf.ChartingMVVM.Series3D;
using Arction.Wpf.ChartingMVVM.Views.View3D;
using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
using Txgy.EWS.Client.Common;
using Txgy.EWS.Client.PageModule.Models;
using WW.Cad.Model.Entities;
using WW.Cad.Model;
using Color = System.Windows.Media.Color;
using Colors = System.Windows.Media.Colors;
using WW.Cad.IO;
using Arction.Wpf.ChartingMVVM.Annotations;
using Txgy.Microseismic.BaseLib.Models;
using ACadSharp.Entities;
using Txgy.EWS.Client.Common.MessageEvents;
using Prism.Events;
using System.Threading;
using Arction.Wpf.ChartingMVVM.Titles;
using Newtonsoft.Json.Linq;
using System.Windows;
using Action = System.Action;
using SciColorMaps.Portable;
using Txgy.EWS.Client.Models;
namespace Txgy.EWS.Client.PageModule.ViewModels
{
public class PlanViewModel : BindableBase
{
public string eventLayerName = "地震事件";
public Color eventLayerColor = Colors.Red;
public Color eventColor = Colors.Red;
public Color eventTextColor = Colors.Blue;
public double eventLayerLineWeight = 1;
public double eventTextSize = 12;
public string cnstLTypeName = "地震事件2";
public string CadFilePath { get; set; }
public SizeDoubleXYZ EventSize;
//LCPlanModel _lcModel;
//public CadLineList cadLineList;
public List<MmEvent> ShowEvents;
public List<PointLineSeries3D> eventList;
private ChartTitle _chartTitle;
public ChartTitle ChartTitle
{
get { return _chartTitle; }
set
{
SetProperty(ref _chartTitle, value);
}
}
private double _scale = 1;
public double Scale
{
get { return _scale; }
set
{
SetProperty(ref _scale, value);
}
}
#region LightningChart属性
private int _widthRS = 2000;
public int WidthRS
{
get { return _widthRS; }
set
{
SetProperty(ref _widthRS, value);
}
}
private int _heightRS = 700;
public int HeightRS
{
get { return _heightRS; }
set
{
SetProperty(ref _heightRS, value);
}
}
private int _depthRS = 2000;
public int DepthRS
{
get { return _depthRS; }
set
{
SetProperty(ref _depthRS, value);
}
}
private double _sideRotationRS = 0;
public double SideRotationRS
{
get { return _sideRotationRS; }
set
{
SetProperty(ref _sideRotationRS, value);
}
}
private double _horizontalRotationRS = 0;
public double HorizontalRotationRS
{
get { return _horizontalRotationRS; }
set
{
SetProperty(ref _horizontalRotationRS, value);
}
}
private double _verticalRotationRS = 90;
public double VerticalRotationRS
{
get { return _verticalRotationRS; }
set
{
//Console.WriteLine(value.ToString());
SetProperty(ref _verticalRotationRS, value);
}
}
private double _distanceRS = 1300;
public double DistanceRS
{
get { return _distanceRS; }
set
{
//Console.WriteLine(value.ToString());
SetProperty(ref _distanceRS, value);
}
}
private bool _clipDispaly = true;
public bool ClipDispaly
{
get { return _clipDispaly; }
set
{
SetProperty(ref _clipDispaly, value);
}
}
private WallXZ _bottomWall;
public WallXZ BottomWall
{
get { return _bottomWall; }
set
{
SetProperty(ref _bottomWall, value);
}
}
private AxisX3D _axisXPri3D;
public AxisX3D AxisXPri3D
{
get { return _axisXPri3D; }
set
{
SetProperty(ref _axisXPri3D, value);
}
}
private AxisY3D _axisYPri3D;
public AxisY3D AxisYPri3D
{
get { return _axisYPri3D; }
set
{
SetProperty(ref _axisYPri3D, value);
}
}
private AxisZ3D _axisZPri3D;
public AxisZ3D AxisZPri3D
{
get { return _axisZPri3D; }
set
{
SetProperty(ref _axisZPri3D, value);
}
}
private ProjectionType _projectionTypeRS = ProjectionType.Orthographic;
public ProjectionType ProjectionTypeRS
{
get { return _projectionTypeRS; }
set
{
SetProperty(ref _projectionTypeRS, value);
}
}
private Fill _chartBackGround = new Fill();
private IEventAggregator _ea;
public Fill ChartBackGround
{
get { return _chartBackGround; }
set
{
SetProperty(ref _chartBackGround, value);
}
}
public Light3DCollection Lights { get; set; }
public Polygon3DCollection Polygons { get; set; }
public PointLineSeries3DCollection ChartPointLineCollection { get; set; }
public Annotation3DCollection ChartAnnotationCollection { get; set; }
public List<PointLineSeries3D> cadImage3DList { get; set; }
#endregion
public PlanViewModel(IEventAggregator ea)
{
//Color _color = Color.FromName(_colorName);
CadFilePath = GlobalConfig.ProjectConfig.CadFileName;
//_lcModel = new LCPlanModel();
_chartBackGround.GradientFill = GradientFill.Solid;
_chartBackGround.GradientColor = Colors.White;
_chartTitle = new ChartTitle();
_chartTitle.Text = "平面视图";
_bottomWall = new WallXZ();
_bottomWall.Material = new Material3D() { DiffuseColor = Color.FromArgb(0, 248, 248, 255) };
_bottomWall.SetGridStripColor1(Color.FromArgb(0, 248, 248, 255));
_bottomWall.SetGridStripColor2(Color.FromArgb(0, 248, 248, 255));
Lights = View3D.CreateDefaultLights();
Lights[1].Location.SetValues((GlobalConfig.ProjectConfig.WorkArea.EMax - GlobalConfig.ProjectConfig.WorkArea.EMin) / 2f, 100,
(GlobalConfig.ProjectConfig.WorkArea.NMax - GlobalConfig.ProjectConfig.WorkArea.NMin) / 2f);
WidthRS = (int)((GlobalConfig.ProjectConfig.WorkArea.EMax - GlobalConfig.ProjectConfig.WorkArea.EMin) / Scale);
HeightRS = (int)((GlobalConfig.ProjectConfig.WorkArea.ZMax - GlobalConfig.ProjectConfig.WorkArea.ZMin) / Scale);
DepthRS = (int)((GlobalConfig.ProjectConfig.WorkArea.NMax - GlobalConfig.ProjectConfig.WorkArea.NMin) / Scale);
//AxisXPri3D = new AxisX3D();
//AxisXPri3D.Minimum = 0;
//AxisXPri3D.Maximum = (GlobalConfig.ProjectConfig.WorkArea.EMax - GlobalConfig.ProjectConfig.WorkArea.EMin) / Scale;
////AxisXPri3D.MajorDiv = 0.5;
//AxisXPri3D.Title.Text = "横轴";
//AxisXPri3D.LabelsVisible = true;
//AxisXPri3D.LabelsColor = Colors.Black;
//AxisXPri3D.Orientation = PlaneXAxis3D.XZ;
//AxisXPri3D.Location = AxisXLocation3D.BottomFront;
//AxisXPri3D.LabelsNumberFormat = "00000000";
//AxisYPri3D = new AxisY3D();
//AxisYPri3D.Minimum = (GlobalConfig.ProjectConfig.WorkArea.ZMin / Scale);
//AxisYPri3D.Maximum = (GlobalConfig.ProjectConfig.WorkArea.ZMax / Scale);
//AxisYPri3D.Reversed = true;
//AxisYPri3D.LabelsColor = Colors.Black;
////AxisYPri3D.Visible = false;
//AxisZPri3D = new AxisZ3D();
//AxisZPri3D.Minimum = 0;
//AxisZPri3D.Maximum = (GlobalConfig.ProjectConfig.WorkArea.NMax - GlobalConfig.ProjectConfig.WorkArea.NMin) / Scale;
////AxisZPri3D.MajorDiv = 0.5;
//AxisZPri3D.Title.Text = "纵轴";
//AxisZPri3D.Orientation = PlaneZAxis3D.XZ;
//AxisZPri3D.Location = AxisZLocation3D.BottomRight;
//AxisZPri3D.LabelsColor = Colors.Black;
//AxisZPri3D.LabelsNumberFormat = "0000000";
AxisXPri3D = new AxisX3D();
AxisXPri3D.Maximum = GlobalConfig.ProjectConfig.WorkArea.EMax / Scale;
AxisXPri3D.Minimum = GlobalConfig.ProjectConfig.WorkArea.EMin / Scale;
//AxisXPri3D.Maximum = (GlobalConfig.ProjectConfig.WorkArea.EMax - GlobalConfig.ProjectConfig.WorkArea.EMin) / Scale;
//AxisXPri3D.MajorDiv = 500;
//AxisXPri3D.MajorDivCount = 1;
AxisXPri3D.Title.Text = "横轴";
AxisXPri3D.Title.Visible = false;
AxisXPri3D.LabelsColor = Colors.Black;
AxisXPri3D.LabelsNumberFormat = "00000000";
AxisXPri3D.AutoFormatLabels = false;
AxisXPri3D.Orientation = PlaneXAxis3D.XZ;
AxisXPri3D.Location = AxisXLocation3D.TopFront;
AxisYPri3D = new AxisY3D();
AxisYPri3D.Maximum = 30;
AxisYPri3D.Minimum = 0;
AxisYPri3D.Visible = false;
AxisZPri3D = new AxisZ3D();
AxisZPri3D.Maximum = GlobalConfig.ProjectConfig.WorkArea.NMax / Scale;
AxisZPri3D.Minimum = GlobalConfig.ProjectConfig.WorkArea.NMin / Scale;
//AxisZPri3D.Maximum = (GlobalConfig.ProjectConfig.WorkArea.NMax - GlobalConfig.ProjectConfig.WorkArea.NMin) / Scale;
//AxisZPri3D.MajorDiv = 500;
//AxisZPri3D.MajorDivCount = 1;
AxisZPri3D.Title.Text = "纵轴";
AxisZPri3D.Title.Visible = false;
AxisZPri3D.LabelsColor = Colors.Black;
AxisZPri3D.LabelsNumberFormat = "0000000";
AxisZPri3D.AutoFormatLabels = false;
AxisZPri3D.Orientation = PlaneZAxis3D.XZ;
AxisZPri3D.Location = AxisZLocation3D.TopRight;
//Polygons = _lcModel.CreatePolygons();
ChartPointLineCollection = new PointLineSeries3DCollection();
ChartAnnotationCollection = new Annotation3DCollection();
CreateBackgroudByDwg();
EventSize = new SizeDoubleXYZ(GlobalConfig.eventDSize*20, GlobalConfig.eventDSize*20, GlobalConfig.eventDSize * 20);
ShowEvents = new List<MmEvent>();
_ea = ea;
//this._ea.GetEvent<UpdateEventsMessage>().Subscribe(u =>
//{
// CreateEventList();
//});
//CreateEventList();
}
public void CreateBackgroudByDwg()
{
cadImage3DList = new List<PointLineSeries3D>();
DxfModel model = DwgReader.Read(CadFilePath);
//try
{
Color color = Colors.Black;
double lineWidth = 0.05;
int lineStyle = 1;
bool closeLine = true;
foreach (var item in model.Layers)
{
if (item.Enabled)
{
//CadLinePropertyModel clpm = CadLineList.LineProperties.Find(lp => lp.Name == item.Name);
CadLinePropertyModel clpm = null;
if (clpm != null)
{
color = clpm.LineColor;
lineWidth = clpm.LineWidth;
closeLine = clpm.CloseLine;
//Console.WriteLine($"名称:{item.Name}\t开关{item.Enabled.ToString()}\t线宽:{item.LineWeight}\t线型{item.LineType.Name}");
var entitys = model.Entities.Where(et => et.Layer.Name == item.Name);
if (entitys != null)
{
foreach (var entity in entitys)
{
//if (entity.Layer.Name == "埋深线")
//{
// Console.WriteLine("埋深线:"+entity.EntityType);
//}
//if (entity.Layer.Name=="巷道集合")
//{
// Console.WriteLine(entity.EntityType);
//}
if (entity.EntityType == "POLYLINE")
{
List<SeriesPoint3D> points = new List<SeriesPoint3D>();
foreach (var point in ((DxfPolyline3D)entity).Vertices)
{
//double x = (point.X - GlobalConfig.BaseX) / Scale;
//double y = (point.Y - GlobalConfig.BaseY) / Scale;
double x = (point.X) / Scale;
double y = (point.Y) / Scale;
points.Add(new SeriesPoint3D(x, clpm.LayerHeight, y, color));
}
cadImage3DList.Add(CreateDxfLwPolyline("cad-" + item.Name, entity.ToString()
, false, lineStyle, lineWidth, points.ToArray(), closeLine));
}
if (entity.EntityType == "LWPOLYLINE")
{
List<SeriesPoint3D> points = new List<SeriesPoint3D>();
foreach (var point in ((DxfLwPolyline)entity).Vertices)
{
//double x = (point.X - GlobalConfig.BaseX) / Scale;
//double y = (point.Y - GlobalConfig.BaseY) / Scale;
double x = (point.X) / Scale;
double y = (point.Y) / Scale;
points.Add(new SeriesPoint3D(x, clpm.LayerHeight, y, color));
}
cadImage3DList.Add(CreateDxfLwPolyline("cad-" + item.Name, entity.ToString()
, false, lineStyle, lineWidth, points.ToArray(), closeLine));
}
if (entity.EntityType == "TEXT")
{
DxfText et = (DxfText)entity;
//if (item.Name.Contains("台站"))
//{
// ChartAnnotationCollection.Add(CreateDxfText(((DxfText)entity), "cad-text", 12, clpm.LayerHeight));
//}
if (et.AlignmentPoint1.X >= GlobalConfig.ProjectConfig.WorkArea.EMin &&
et.AlignmentPoint1.X <= GlobalConfig.ProjectConfig.WorkArea.EMax &&
et.AlignmentPoint1.Y >= GlobalConfig.ProjectConfig.WorkArea.NMin &&
et.AlignmentPoint1.Y <= GlobalConfig.ProjectConfig.WorkArea.EMax)
{
//Console.WriteLine($"R:{((DxfText)entity).Color.R}\tG:{((DxfText)entity).Color.G}\tB:{((DxfText)entity).Color.B}");
ChartAnnotationCollection.Add(CreateDxfText(((DxfText)entity), "cad-text", 12, clpm.LayerHeight));
}
}
if (entity.EntityType== "MTEXT")
{
DxfMText et = (DxfMText)entity;
//if (et.AlignmentPoint1.X >= GlobalConfig.ProjectConfig.WorkArea.EMin &&
// et.AlignmentPoint1.X <= GlobalConfig.ProjectConfig.WorkArea.EMax &&
// et.AlignmentPoint1.Y >= GlobalConfig.ProjectConfig.WorkArea.NMin &&
// et.AlignmentPoint1.Y <= GlobalConfig.ProjectConfig.WorkArea.EMax)
{
ChartAnnotationCollection.Add(CreateDxfMText(et, "cad-text", 12, clpm.LayerHeight));
}
}
}
}
//if (entitys != null)
//{
// foreach (var entity in entitys)
// {
// if (entity.EntityType == "LWPOLYLINE" || (item.Name == "埋深線" && (entity.EntityType == "POLYLINE" || entity.EntityType == "HATCH")))
// {
// List<SeriesPoint3D> points = new List<SeriesPoint3D>();
// //Console.WriteLine($"线宽:{item.LineWeight}\t颜色{entity.Color.ToString()}");
// //if (item.Name == "埋深線")
// //{
// // Console.WriteLine(entity.EntityType);
// // if (entity.EntityType== "HATCH")
// // {
// // DxfHatch dh=(DxfHatch)entity;
// // DxfText dt = new DxfText();
// // dt.Text=dh.Name;
// // dt.AlignmentPoint1 = new WW.Math.Point3D(dh.ElevationPoint.X, dh.ElevationPoint.Y, 0);
// // Console.WriteLine($"name:{dh.Name}\t{dh.ElevationPoint.X}\t{dh.ElevationPoint.Y}");
// // if (dt.AlignmentPoint1.X >= GlobalConfig.ProjectConfig.WorkArea.EMin &&
// // dt.AlignmentPoint1.X <= GlobalConfig.ProjectConfig.WorkArea.EMax &&
// // dt.AlignmentPoint1.Y >= GlobalConfig.ProjectConfig.WorkArea.NMin &&
// // dt.AlignmentPoint1.Y <= GlobalConfig.ProjectConfig.WorkArea.EMax)
// // {
// // ChartAnnotationCollection.Add(CreateDxfText(dt, "cad-text", 12, clpm.LayerHeight));
// // }
// // }
// // else
// if (entity.EntityType == "POLYLINE")
// {
// foreach (var point in ((DxfPolyline3D)entity).Vertices)
// {
// //double x = (point.X - GlobalConfig.BaseX) / Scale;
// //double y = (point.Y - GlobalConfig.BaseY) / Scale;
// double x = (point.X) / Scale;
// double y = (point.Y) / Scale;
// points.Add(new SeriesPoint3D(x, clpm.LayerHeight, y, color));
// }
// }
// //}
// else
// {
// foreach (var point in ((DxfLwPolyline)entity).Vertices)
// {
// //double x = (point.X - GlobalConfig.BaseX) / Scale;
// //double y = (point.Y - GlobalConfig.BaseY) / Scale;
// double x = (point.X) / Scale;
// double y = (point.Y) / Scale;
// points.Add(new SeriesPoint3D(x, clpm.LayerHeight, y, color));
// }
// }
// cadImage3DList.Add(CreateDxfLwPolyline("cad-" + item.Name, entity.ToString()
// , false, lineStyle, lineWidth, points.ToArray(), closeLine));
// }
// //if (entity.EntityType == "TEXT" && (item.Name == "等高线-20"
// // || item.Name == "目标监测区"
// // || item.Name == "N1100台站位置设计位置"))
// //if (entity.EntityType == "TEXT" && GlobalConfig.DwgLayersDisplay.Contains(item.Name))
// if (entity.EntityType == "TEXT")
// {
// DxfText et = (DxfText)entity;
// if (et.AlignmentPoint1.X >= GlobalConfig.ProjectConfig.WorkArea.EMin &&
// et.AlignmentPoint1.X <= GlobalConfig.ProjectConfig.WorkArea.EMax &&
// et.AlignmentPoint1.Y >= GlobalConfig.ProjectConfig.WorkArea.NMin &&
// et.AlignmentPoint1.Y <= GlobalConfig.ProjectConfig.WorkArea.EMax)
// {
// //Console.WriteLine($"R:{((DxfText)entity).Color.R}\tG:{((DxfText)entity).Color.G}\tB:{((DxfText)entity).Color.B}");
// ChartAnnotationCollection.Add(CreateDxfText(((DxfText)entity), "cad-text", 12, clpm.LayerHeight));
// }
// }
// }
// //Console.WriteLine(entitys.Count());
//}
//Console.WriteLine(item.Model.Entities.Count);
}
}
}
ChartPointLineCollection.AddRange(cadImage3DList);
}
//catch (Exception ex)
//{
// Console.WriteLine(ex.Message);
//}
}
public void CreateEventList()
{
if (!GlobalData.AppendEvent)
{
List<PointLineSeries3D> newCollection = ChartPointLineCollection.ToList();
//Console.WriteLine(newCollection.Count);
newCollection.RemoveAll(x => x.Title.Text.Contains("微地震事件"));
//Console.WriteLine(newCollection.Count);
ChartPointLineCollection.Clear();
ChartPointLineCollection.AddRange(newCollection);
ChartPointLineCollection.ToList().RemoveAll(x => x.Title.Text.Contains("微地震事件"));
}
//if (GlobalData.DisplayEvents.Count > 0)
if (GlobalData.SearchEvents.Count > 0)
{
eventList = new List<PointLineSeries3D>();
PointLineSeries3D pls3d = new PointLineSeries3D();
pls3d.Title.Text = "微地震事件";
pls3d.Tag = "mm-event";
pls3d.IndividualPointColors = true;
pls3d.IndividualPointSizes = true;
pls3d.LineVisible = false;
pls3d.AllowUserInteraction = true;
pls3d.PointsVisible = true;
pls3d.PointStyle.Shape3D = PointShape3D.Sphere;
pls3d.PointStyle.Size3D = EventSize;
List<SeriesPoint3D> sp3List = new List<SeriesPoint3D>();
//SeriesPoint3D[] sp3s = new SeriesPoint3D[GlobalData.EventResults.Count];
foreach (var item in GlobalData.SearchEvents)
{
//if (item.Y>38397500 && item.Y<38398200)
{
//float sizeFactor = (float)(((4f + item.ML) / (4f)) * 0.6f) + 0.4f;
float sizeFactor = (float)(((4f + item.ML) / (4f)) * 2f) + 0.1f;
int colorIndex = (int)(((item.Z - GlobalConfig.ProjectConfig.WorkArea.ZMin)
/ Math.Abs(GlobalConfig.ProjectConfig.WorkArea.ZMax - GlobalConfig.ProjectConfig.WorkArea.ZMin))
* GlobalConfig.ColorCountDefault);
Color ec = GlobalConfig.eventDepthColor[colorIndex];
sp3List.Add(new SeriesPoint3D((item.Y) / Scale, 20, (item.X) / Scale, ec, sizeFactor));
}
}
pls3d.AddPoints(sp3List.ToArray(), true);
ChartPointLineCollection.Add(pls3d);
}
}
public PointLineSeries3D EventModel2Pls3d(MmEvent mm)
{
PointLineSeries3D pls3d = new PointLineSeries3D();
pls3d.Title.Text = mm.EventTimeStr;
pls3d.Tag = "mm-event";
pls3d.IndividualPointColors = true;
pls3d.IndividualPointSizes = true;
pls3d.LineVisible = false;
pls3d.AllowUserInteraction = true;
pls3d.PointsVisible = true;
pls3d.PointStyle.Shape3D = PointShape3D.Sphere;
pls3d.PointStyle.Size3D = EventSize;
return pls3d;
}
public static PointLineSeries3D CreateDxfLwPolyline(string tag, string title, bool allowUser, int lineStyle, double lineWidth, SeriesPoint3D[] points, bool closeLine)
{
PointLineSeries3D pls3d = new PointLineSeries3D();
pls3d.Tag = tag;
pls3d.Title.Text = title;
pls3d.MultiColorLine = true;
pls3d.AllowUserInteraction = allowUser;
pls3d.PointsVisible = false;
pls3d.LineStyle.LineOptimization = (LineOptimization)lineStyle;
pls3d.LineStyle.Width = lineWidth;
pls3d.Points = points;
pls3d.ClosedLine = closeLine;
return pls3d;
}
public Annotation3D CreateDxfText(DxfText dxfText, string tag, double fontSize, double layerHeight)
{
Annotation3D at3d = new Annotation3D();
at3d.Tag = tag;
at3d.Style = AnnotationStyle.Rectangle;
at3d.AllowUserInteraction = false;
at3d.BorderVisible = false;
at3d.Shadow.Visible = false;
at3d.Visible = true;
at3d.Fill.Style = RectFillStyle.None;
at3d.TextStyle.Color = Dc2Mc(dxfText.Color);
at3d.TextStyle.Font = new WpfFont("微软雅黑", fontSize);
at3d.Text = dxfText.Text;
//at3d.TargetAxisValues = new PointDoubleXYZ((dxfText.AlignmentPoint1.X- GlobalConfig.BaseX)/Scale, 40,
// (dxfText.AlignmentPoint1.Y- GlobalConfig.BaseY)/Scale);
at3d.LocationCoordinateSystem = CoordinateSystem.AxisValues;
at3d.LocationAxisValues.SetValues((dxfText.AlignmentPoint1.X) / Scale, layerHeight,
(dxfText.AlignmentPoint1.Y) / Scale);
//at3d.LocationAxisValues.SetValues((dxfText.AlignmentPoint1.X - GlobalConfig.BaseX) / Scale, layerHeight,
// (dxfText.AlignmentPoint1.Y - GlobalConfig.BaseY) / Scale);
at3d.Anchor.SetValues(0.5, 0.5);
return at3d;
}
public Annotation3D CreateDxfMText(DxfMText dxfText, string tag, double fontSize, double layerHeight)
{
Annotation3D at3d = new Annotation3D();
at3d.Tag = tag;
at3d.Style = AnnotationStyle.Rectangle;
at3d.AllowUserInteraction = false;
at3d.BorderVisible = false;
at3d.Shadow.Visible = false;
at3d.Visible = true;
at3d.Fill.Style = RectFillStyle.None;
at3d.TextStyle.Color = Colors.Blue;
//at3d.TextStyle.Color = Dc2Mc(dxfText.Color);
at3d.TextStyle.Font = new WpfFont("微软雅黑", fontSize);
at3d.Text = dxfText.Text;
at3d.LocationCoordinateSystem = CoordinateSystem.AxisValues;
at3d.LocationAxisValues.SetValues((dxfText.InsertionPoint.X) / Scale, layerHeight,
(dxfText.InsertionPoint.Y) / Scale);
//at3d.LocationAxisValues.SetValues((dxfText.InsertionPoint.X - GlobalConfig.BaseX) / Scale, layerHeight,
// (dxfText.InsertionPoint.Y - GlobalConfig.BaseY) / Scale);
at3d.Anchor.SetValues(0.5, 0.5);
return at3d;
}
/// <summary>
/// dxfColor2MediaColor
/// </summary>
/// <param name="en"></param>
/// <returns></returns>
public static Color Dc2Mc(EntityColor en)
{
return Color.FromRgb(en.R, en.G, en.B);
}
}
}