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 ZlpFeatChart10 : ZlpFeatChart
|
{
|
public ZlpFeatChart10()
|
{
|
AxisTitlePosiStyleY = eAxisTitlePosiStyle.Top;//纵坐标标题的位置 0表示 中间, 1表示刻度的上面
|
_axisLabelSizeX = 8;
|
_axisLabelSizeY = 8;
|
_axisTitleSizeX = 10;
|
_axisTitleSizeY = 10;
|
|
|
_axisMajorTickLength = 4;//长刻度线的长度
|
_axisMinorTickLength = 2;//短刻度线的长度
|
|
_defatulCurveLabelHeight = 8;
|
_equalCurveParaLabelHeight = 5;
|
|
|
_axisLabelSpaceToDiagramY_left = 8;//刻度文字离Y轴的距离
|
_axisTitleSpaceToDiagramY_left = 9;//
|
|
_axisTitleSpaceToLabel_Vertial_Y = 20;
|
|
_axisLabelSpaceToDiagramQ = 8;//刻度文字离X轴的距离
|
_axisTitleSpaceToDiagramQ = 32;//
|
}
|
|
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();
|
|
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);
|
}
|
}
|
}
|
|
//
|
DrawCurveLabel();
|
|
DrawDesignPointLine();
|
|
|
|
|
|
//标题栏
|
DrawFrameTtileText_Draw();
|
|
//绘制参数表
|
CreateOhterHdrTable();
|
|
//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);
|
|
|
|
//保存文件
|
this._printKindSize = System.Drawing.Printing.PaperKind.A4;
|
SaveFile(strFilePath);
|
|
|
}
|
catch //(Exception ex)
|
{
|
|
return false;
|
}
|
|
|
return true;
|
}
|
|
protected override void InitialChartColorAndFont()
|
{
|
base.InitialChartColorAndFont();
|
//默认字体
|
//_axisTextFont = new DxfTextStyle("arial", "arial.ttf");
|
//_defaultTextFont = new DxfTextStyle("simfang", "simfang.ttf");//仿宋体 在WINDOWS/FONT下的文件名称
|
// _dxfFileModel.TextStyles.Add(_axisTextFont);
|
var hz0 = _dxfFileModel.GetTextStyleWithName("HZTXT");//文件自带字体
|
_axisTextFont = hz0;
|
|
_frameTextFont = hz0;//文件自带字体
|
|
_frameTextColor = TProduct.PumpGraph.Dxf.AutoCadHelper.GreenColor;
|
_curveTextFont = hz0;//文件自带字体
|
}
|
|
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_Style10_EN.dwg");
|
if (System.IO.File.Exists(strTemplateFolder))
|
{
|
return strTemplateFolder;
|
}
|
strTemplateFolder = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "template", "ZLP_Style10_EN.dwg");
|
if (System.IO.File.Exists(strTemplateFolder))
|
{
|
return strTemplateFolder;
|
}
|
}
|
|
strTemplateFolder = System.IO.Path.Combine(CorpDataFolder, "template", "ZLP_Style10_CN.dwg");
|
if (System.IO.File.Exists(strTemplateFolder))
|
{
|
return strTemplateFolder;
|
}
|
strTemplateFolder = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "template", "ZLP_Style10_CN.dwg");
|
if (System.IO.File.Exists(strTemplateFolder))
|
{
|
return strTemplateFolder;
|
}
|
|
return strTemplateFolder;
|
}
|
|
|
|
|
// 设计点
|
private void DrawDesignPointLine()
|
{
|
if (_designPointStdUnit == null)
|
return;
|
Point2D centerPt = new Point2D();
|
centerPt.X = MapRealToPictQ(_coordinateParas.AxisCalcQ.Calc(_designPointStdUnit.X));
|
centerPt.Y = MapRealToPictH(_coordinateParas.AxisCalcH.Calc(_designPointStdUnit.Y));
|
|
|
DxfLine lineH = new DxfLine(new Point2D(centerPt.X, centerPt.Y),
|
new Point2D(centerPt.X - 25, centerPt.Y));
|
lineH.LineWeight = 35;
|
lineH.Color = _designPointColor;
|
_dxfFileModel.Entities.Add(lineH);
|
|
|
DxfLine lineV = new DxfLine(new Point2D(centerPt.X, centerPt.Y),
|
new Point2D(centerPt.X, centerPt.Y - 16));
|
lineV.LineWeight = 35;
|
lineV.Color = _designPointColor;
|
_dxfFileModel.Entities.Add(lineV);
|
|
|
DxfLine lineX1 = new DxfLine(new Point2D(centerPt.X, centerPt.Y - 16),
|
new Point2D(centerPt.X - 25, centerPt.Y));
|
lineX1.LineWeight = 35;
|
lineX1.Color = _designPointColor;
|
_dxfFileModel.Entities.Add(lineX1);
|
|
DxfLine lineX2 = new DxfLine(new Point2D(centerPt.X, centerPt.Y - 11.26),
|
new Point2D(centerPt.X - 17.45, centerPt.Y));
|
lineX2.LineWeight = 35;
|
lineX2.Color = _designPointColor;
|
_dxfFileModel.Entities.Add(lineX2);
|
|
|
DxfLine lineX3 = new DxfLine(new Point2D(centerPt.X, centerPt.Y - 6.52),
|
new Point2D(centerPt.X - 10.1, centerPt.Y));
|
lineX3.LineWeight = 35;
|
lineX3.Color = _designPointColor;
|
_dxfFileModel.Entities.Add(lineX3);
|
|
}
|
|
}
|
}
|