using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
|
using WW.Cad.Base;
|
using WW.Cad.Drawing;
|
using WW.Cad.Drawing.GDI;
|
using WW.Cad.IO;
|
using WW.Cad.Model;
|
using WW.Math;
|
using WW.Cad.Model.Entities;
|
using WW.Actions;
|
using WW.Cad.Model.Tables;
|
using WW.Cad.Model.Objects;
|
|
namespace TProduct.PumpGraph.Dxf
|
{
|
public partial class ZlpFeatChart1 : ZlpFeatChart
|
{
|
public ZlpFeatChart1()
|
{
|
|
}
|
|
public virtual bool InitialTemplate()
|
{
|
return false;
|
}
|
|
public override bool CreateDxf(string strFilePath)
|
{
|
try
|
{
|
if (string.IsNullOrEmpty(_strTemplateFile) || !System.IO.File.Exists(_strTemplateFile))
|
{
|
return false;
|
}
|
|
|
_dxfFileModel = DwgReader.Read(_strTemplateFile);
|
|
InitialChartColorAndFont();
|
|
//默认字体
|
_axisTextFont = new DxfTextStyle("arial", "arial.ttf");
|
_dxfFileModel.TextStyles.Add(_axisTextFont);
|
_frameTextFont = _dxfFileModel.GetTextStyleWithName("FS");//文件自带字体
|
|
InitialDiagramSize();
|
|
DrawAxisQ_First();//画X轴
|
|
DrawAxisH();//画Y轴
|
|
DrawDesignPointLine();
|
|
if (CurveInfoQH != null && CurveInfoQH.Count > 0)
|
{
|
foreach (var curve in CurveInfoQH)
|
{
|
if (_annoAnchorPointList == null)
|
{
|
DrawSingleCurveH( curve.PointInfo, curve.CurvePara.ToString() + "°", false);
|
}
|
else
|
{
|
DrawSingleCurveH( curve.PointInfo, null, false);
|
}
|
}
|
}
|
|
if (EqualParaCurveE != null && EqualParaCurveE.Count > 0)
|
{
|
foreach (var curve in EqualParaCurveE)
|
{
|
if (_annoAnchorPointList == null)
|
{
|
DrawSingleCurveE( curve.PointInfo, curve.CurvePara.ToString() + "%", curve.IsClosed);
|
}
|
else
|
{
|
DrawSingleCurveE( curve.PointInfo, null, curve.IsClosed);
|
}
|
}
|
}
|
|
if (_annoAnchorPointList != null )
|
{
|
for (int k = 0; k < _annoAnchorPointList.Count; k++)
|
{
|
var curveLabel = _annoAnchorPointList[k];
|
WW.Cad.Model.Entities.EntityColor colorCurve;
|
if (curveLabel.CurveTag == "QH")
|
colorCurve = _axisLabelColorQ;
|
else
|
colorCurve = _axisLabelColorE ;
|
|
Point3D pt3D = new Point3D();
|
pt3D.X = MapRealToPictQ(_coordinateParas.AxisCalcQ.Calc(curveLabel.X))+2;
|
pt3D.Y = MapRealToPictH(_coordinateParas.AxisCalcH.Calc(curveLabel.Y))+7;
|
pt3D.Z = 0;
|
|
|
DxfText textLabel = new DxfText(curveLabel.Text, pt3D, 2d);
|
textLabel.Thickness = 0.4d;
|
textLabel.Height = 6;
|
textLabel.Color = colorCurve;
|
//textLabel.Style = _defaultTextFont;
|
_dxfFileModel.Entities.Add(textLabel);
|
|
}
|
}
|
|
|
DrawDesignPointLine();
|
|
//额定点 和 额定参数文字
|
//DrawRatedParas();
|
|
|
|
//标题栏
|
DrawFrameTtileText();
|
|
|
|
//if (_equipmentCurveParas != null)
|
//{
|
// WW.Cad.Model.Entities.EntityColor colorDxf = GetEntityColor(System.Drawing.Color.Beige);
|
|
// DrawSingleCurveQH(colorDxf, _equipmentCurveParas.CurveInfo, null);
|
//}
|
|
|
////添加尺寸
|
//DxfDimension.Aligned dimension = new DxfDimension.Aligned(_dxfFileModel.DefaultDimensionStyle);
|
//dimension.DimensionLineLocation = new Point3D(7, 2, 0);
|
//// Touches bottom side of the circle.
|
//dimension.ExtensionLine1StartPoint = new Point3D(3, 0, 0);
|
//// Touches top side of the circle.
|
//dimension.ExtensionLine2StartPoint = new Point3D(3, 4, 0);
|
//_dxfFileModel.Entities.Add(dimension);
|
|
|
|
//保存文件
|
SaveFile(strFilePath);
|
|
|
}
|
catch //(Exception ex)
|
{
|
|
return false;
|
}
|
|
|
return true;
|
}
|
|
|
public override bool InitialTemplate(string CorpDataFolder, Eventech.Model.eLocalizationType location, string attachInfo)
|
{
|
_currentLangugage = location;
|
var file = GetTemplateFilePath(CorpDataFolder, location);
|
if (string.IsNullOrEmpty(file))
|
return false;
|
this._strTemplateFile = file;
|
return true;
|
}
|
|
public static string GetTemplateFilePath(string CorpDataFolder, Eventech.Model.eLocalizationType location)
|
{
|
string strTemplateFolder = null;
|
if (location != Eventech.Model.eLocalizationType.zhCN)
|
{
|
strTemplateFolder = System.IO.Path.Combine(CorpDataFolder, "template", "ZLP_Style1_EN.dwg");
|
if (System.IO.File.Exists(strTemplateFolder))
|
{
|
return strTemplateFolder;
|
}
|
strTemplateFolder = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "template", "ZLP_Style1_EN.dwg");
|
if (System.IO.File.Exists(strTemplateFolder))
|
{
|
return strTemplateFolder;
|
}
|
}
|
|
strTemplateFolder = System.IO.Path.Combine(CorpDataFolder, "template", "ZLP_Style1_CN.dwg");
|
if (System.IO.File.Exists(strTemplateFolder))
|
{
|
return strTemplateFolder;
|
}
|
strTemplateFolder = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "template", "ZLP_Style1_CN.dwg");
|
if (System.IO.File.Exists(strTemplateFolder))
|
{
|
return strTemplateFolder;
|
}
|
|
return strTemplateFolder;
|
}
|
|
|
|
|
|
}
|
}
|