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 LxpFeatChart7
|
{
|
private void DrawPanelQH()
|
{
|
DrawGidLineInQH_竖直();
|
DrawGidLineInQH_水平();
|
DrawAxisHead();
|
|
}
|
|
private void DrawGidLineInQH_竖直()
|
{
|
double spaceWidth = (_diagramRightBottomPt_QH.X - _diagramLeftBottomPt_QH.X) / (_coordinateParas.GridNumberX);//X轴上格子的宽度
|
|
var layer_grid_line = GetLayerByName("细实线");
|
|
double spaceInteriorWidth = spaceWidth / 3;
|
for (int i = 0; i < _coordinateParas.GridNumberX + 1; i++)
|
{
|
double space = i * spaceWidth;//竖直线之间的间距
|
Point2D startXgeziPt = new Point2D(_diagramLeftBottomPt_QH.X + space, _diagramLeftBottomPt_QH.Y);
|
Point2D endXgeziPt = new Point2D(_diagramLeftBottomPt_QH.X + space, _diagramLeftTopPt_QH.Y);
|
DxfLine dxfLine = new DxfLine(startXgeziPt, endXgeziPt);
|
dxfLine.Color = this._gridLineColor;
|
dxfLine.Layer = layer_grid_line;
|
|
_dxfFileModel.Entities.Add(dxfLine);
|
|
if (i != _coordinateParas.GridNumberX)
|
{
|
for (int j = 1; j < 3; j++)
|
{
|
Point2D startXgeziPt_subjoin = new Point2D(_diagramLeftBottomPt_QH.X + space + spaceInteriorWidth * j, _diagramLeftBottomPt_QH.Y);
|
Point2D endXgeziPt_subjoin = new Point2D(_diagramLeftBottomPt_QH.X + space + spaceInteriorWidth * j, _diagramLeftTopPt_QH.Y);
|
DxfLine dxfLine_subjoin = new DxfLine(startXgeziPt_subjoin, endXgeziPt_subjoin);
|
dxfLine_subjoin.Color = this._gridLineColor;
|
dxfLine_subjoin.Layer = layer_grid_line;
|
_dxfFileModel.Entities.Add(dxfLine_subjoin);
|
}
|
}
|
}
|
}
|
|
private void DrawGidLineInQH_水平()
|
{
|
var gridNumber = _coordinateParas.EndLineNoH - _coordinateParas.StartLineNoH;
|
double spaceHeight = (_diagramLeftTopPt_QH.Y - _diagramLeftBottomPt_QH.Y) / gridNumber;//Y轴上格子的宽度
|
double spaceInteriorHeight = spaceHeight / 5;
|
|
var layer_grid_line = GetLayerByName("细实线");
|
|
//bool isIntervalLabel = false;
|
//if (hGridNumber > 5)
|
//{
|
// isIntervalLabel = true;
|
//}
|
for (int i = 0; i < gridNumber; i++)
|
{
|
//if (isIntervalLabel && i % 2 == 0)
|
// continue;
|
|
double space = i * spaceHeight;//水平线
|
Point2D startXgeziPt = new Point2D(_diagramLeftBottomPt_QH.X, _diagramLeftBottomPt_QH.Y + space);
|
Point2D endXgeziPt = new Point2D(_diagramRightBottomPt_QH.X, _diagramLeftBottomPt_QH.Y + space);
|
DxfLine dxfLine = new DxfLine(startXgeziPt, endXgeziPt);
|
dxfLine.Color = this._gridLineColor;
|
dxfLine.Layer = layer_grid_line;
|
_dxfFileModel.Entities.Add(dxfLine);
|
|
for (int j = 1; j < 5; j++)
|
{
|
Point2D startXgeziPt_subjoin = new Point2D(_diagramLeftBottomPt_QH.X, _diagramLeftBottomPt_QH.Y + space + spaceInteriorHeight * j);
|
Point2D endXgeziPt_subjoin = new Point2D(_diagramRightBottomPt_QH.X, _diagramLeftBottomPt_QH.Y + space + spaceInteriorHeight * j);
|
DxfLine dxfLine_subjoin = new DxfLine(startXgeziPt_subjoin, endXgeziPt_subjoin);
|
dxfLine_subjoin.Color = this._gridLineColor;
|
dxfLine_subjoin.Layer = layer_grid_line;
|
_dxfFileModel.Entities.Add(dxfLine_subjoin);
|
}
|
}
|
|
DxfLine dxfTopLine = new DxfLine(new Point2D(_diagramLeftTopPt_QH.X, _diagramLeftTopPt_QH.Y), new Point2D(_diagramRightTopPt_QH.X, _diagramLeftTopPt_QH.Y));
|
dxfTopLine.Color = this._gridLineColor;
|
_dxfFileModel.Entities.Add(dxfTopLine);
|
|
}
|
|
private void DrawAxisHead()
|
{
|
double coorMin = _coordinateParas.DispMinH();
|
double coordSpace = _coordinateParas.CoordSpaceH;
|
double gridNumber = _coordinateParas.EndLineNoH - _coordinateParas.StartLineNoH;
|
double coorMax = gridNumber * coordSpace;//刻度显示最大值
|
|
var layer_grid_line = GetLayerByName("细实线");
|
|
//是否间隔的LABEL
|
//bool isIntervalLabel = false;
|
//if (_coordinateParas.GridNumberY > 20)
|
//{
|
// isIntervalLabel = true;
|
//}
|
|
for (int i = 0; i < gridNumber + 1; i++)
|
{
|
double space = i * this._diagram_Cell_Height_E;
|
double kedu_d = coorMin + i * coordSpace;
|
if (kedu_d < 0.001)
|
kedu_d = 0;
|
string kedu_str = kedu_d.ToString();
|
var labelPt = new Point3D(_diagramLeftBottomPt_QH.X - _axisLabelSpaceToDiagramY_left, _diagramLeftBottomPt_QH.Y + space, 0d);
|
DxfMText axisLabel = new DxfMText(kedu_str, labelPt, _axisLabelSizeY);//\P表示回车
|
axisLabel.AttachmentPoint = AttachmentPoint.MiddleRight;
|
if (_axisTextFont != null)
|
axisLabel.Style = this._axisTextFont;
|
axisLabel.Color = this._axisLabelColorH;
|
axisLabel.Layer = layer_grid_line;
|
_dxfFileModel.Entities.Add(axisLabel);
|
|
|
|
Point2D startXgeziPt = new Point2D(_diagramLeftBottomPt_QH.X - 1.2, _diagramLeftBottomPt_QH.Y + space);
|
Point2D endXgeziPt = new Point2D(_diagramLeftBottomPt_QH.X, _diagramLeftBottomPt_QH.Y + space);
|
DxfLine dxfLine = new DxfLine(startXgeziPt, endXgeziPt);
|
dxfLine.Color = this._gridLineColor;
|
dxfLine.LineWeight = 40;
|
dxfLine.Layer = layer_grid_line;
|
_dxfFileModel.Entities.Add(dxfLine);
|
|
|
////
|
//if (isIntervalLabel)
|
// i = i + 1;
|
}
|
|
string title = string.Format("H\r\n(m)");
|
|
Point3D pt = new Point3D();
|
pt.X = _diagramLeftTopPt_QH.X - 9.5;
|
pt.Y = _diagramLeftTopPt_QH.Y - 3;
|
pt.Z = 0;
|
DxfMText textTitle = new DxfMText(title, pt, _axisTitleSizeY);
|
textTitle.Color = this._axisTitleColorE;
|
textTitle.AttachmentPoint = AttachmentPoint.MiddleRight;
|
if (_axisTextFont != null)
|
textTitle.Style = this._axisTextFont;
|
textTitle.Layer = layer_grid_line;
|
_dxfFileModel.Entities.Add(textTitle);
|
}
|
|
}
|
}
|