tx
2025-04-22 e0b138b3e057de6f57021e6c8963868f5c5acc5a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
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
    {
 
        protected override void DrawQHCurve()
        {
            if (_allCurveQH == null || _allCurveQH.Count() == 0)
                return;
            var layer_curve = GetLayerByName("粗实线");
 
            double borderOffsetFactor = 1.1;//调整背景遮罩的比例 1是文字的背景,越大背景遮罩效果越大
            
            #region  把预设的最小切割线,找出标为显示
            //string min_curve_id = null;
            //if (!_isHaveSetMinCurve)
            //{
 
            //    double min_d2_insimu = double.MaxValue;
            //    foreach (var curve in _allCurveQH)
            //    {
            //        if (curve.CurveTag != null)
            //        {
            //            var tag = curve.CurveTag.ToString();
            //            if (tag == "SimuWaterCurve")
            //            {
            //                if (curve.GetCurveDoublePara() > 0)
            //                {
            //                    min_d2_insimu = Math.Min(min_d2_insimu, curve.GetCurveDoublePara());
            //                    min_curve_id = curve.CurveID.ToString();
            //                }
            //            }
            //        }
            //    }
            //} 
            #endregion
 
            _defatulCurveLabelHeight = 2;
            foreach (var curve in _allCurveQH)
            {
                if (!curve.IsDispCurve)
                    continue;
                if (curve.CurveExpress == null)
                    continue;
                //if (curve.CurveTag != null)
                //{
                //    var tag = curve.CurveTag.ToString();
                //    if (tag == "SimuWaterCurve")
                //    {
                //        if (curve.GetCurveDoublePara() != this._minD2)
                //            continue;
                //        //if (curve.CurveID.ToString() != min_curve_id)
                //        //    continue;
                //    }
                       
                //}
 
 
                var points = Eventech.Common.CurveExpressConver.ToPoints(curve.CurveExpress, 15);
                //绘制曲线
                var dxfSpline = DrawSingleCurveQH(_colorCurve, points, 30, layer_curve);
                if (dxfSpline == null)
                    return;
                //绘制曲线名称
                bool isDrawCurveName = false;
                if (curve.IsDispName && !string.IsNullOrEmpty(curve.CurveName) && !curve.CurveName.StartsWith("SIMUINDEX")) 
                {
                    isDrawCurveName = true;
                    var pt_posi = new Point3D(dxfSpline.FitPoints[0].X + _defatulCurveLabelHeight, dxfSpline.FitPoints[1].Y + _defatulCurveLabelHeight - 2, 0d);
                    if (curve.LabelPosiName != null && !curve.LabelPosiName.IsZeroPt())
                    {
                        pt_posi.X = MapRealToPictQ(curve.LabelPosiName.X);
                        pt_posi.Y = MapRealToPictH(curve.LabelPosiName.Y);
                    }
 
                    pt_posi.X += _curveParasLabelSpaceX;
                    pt_posi.Y += _curveParasLabelSpaceY;
                    pt_posi.Y += 1;//大部分定位的是曲线上的位置,所以加上一个字高度
 
                    DxfMText textLabel = new DxfMText("%%c"+curve.CurveName, pt_posi, _defatulCurveLabelHeight);
                    textLabel.Color = _colorCurveText;
                    if (_curveTextFont != null)
                        textLabel.Style = _curveTextFont;
 
                    if (curve.LabelPosiParaAligment == Eventech.Model.eTextAligment.Right)
                        textLabel.AttachmentPoint = AttachmentPoint.MiddleRight;
                    else if (curve.LabelPosiParaAligment == Eventech.Model.eTextAligment.Left)
                        textLabel.AttachmentPoint = AttachmentPoint.MiddleLeft;
                    else if (curve.LabelPosiParaAligment == Eventech.Model.eTextAligment.Top)
                        textLabel.AttachmentPoint = AttachmentPoint.BottomCenter;
 
                    textLabel.BackgroundFillFlags = BackgroundFillFlags.UseBackgroundFillColor | BackgroundFillFlags.UseDrawingWindowColor;
                    textLabel.BackgroundFillInfo = new BackgroundFillInfo();
                    textLabel.BackgroundFillInfo.BorderOffsetFactor = borderOffsetFactor;//调整背景遮罩的比例 1是文字的背景,越大背景遮罩效果越大
 
                    if (_curveTextFont != null)
                        textLabel.Style = this._curveTextFont;
                    _dxfFileModel.Entities.Add(textLabel);
                }
 
                if (curve.IsDispPara && !string.IsNullOrEmpty(curve.CurvePara) && !isDrawCurveName)
                {
                    var pt_posi = new Point3D(dxfSpline.FitPoints[0].X + _defatulCurveLabelHeight, dxfSpline.FitPoints[1].Y + _defatulCurveLabelHeight - 2, 0d);
                    if (curve.LabelPosiPara != null && curve.LabelPosiPara.IsZeroPt())
                    {
                        pt_posi.X = MapRealToPictQ(curve.LabelPosiPara.X);
                        pt_posi.Y = MapRealToPictH(curve.LabelPosiPara.Y);
                    }
 
                    pt_posi.X += _curveParasLabelSpaceX;
                    pt_posi.Y += _curveParasLabelSpaceY;
                    pt_posi.Y += 2;//大部分定位的是曲线上的位置,所以加上一个字高度
 
                    DxfMText textLabel = new DxfMText(curve.CurvePara, pt_posi, _defatulCurveLabelHeight);
                    textLabel.Color = _colorCurveText;
                    if (curve.LabelPosiParaAligment == Eventech.Model.eTextAligment.Right)
                        textLabel.AttachmentPoint = AttachmentPoint.MiddleRight;
                    else if (curve.LabelPosiParaAligment == Eventech.Model.eTextAligment.Left)
                        textLabel.AttachmentPoint = AttachmentPoint.MiddleLeft;
                    else if (curve.LabelPosiParaAligment == Eventech.Model.eTextAligment.Top)
                        textLabel.AttachmentPoint = AttachmentPoint.BottomCenter;
 
 
                    textLabel.BackgroundFillFlags = BackgroundFillFlags.UseBackgroundFillColor | BackgroundFillFlags.UseDrawingWindowColor;
                    textLabel.BackgroundFillInfo = new BackgroundFillInfo();
                    textLabel.BackgroundFillInfo.BorderOffsetFactor = borderOffsetFactor;//调整背景遮罩的比例 1是文字的背景,越大背景遮罩效果越大
 
                    if (_curveTextFont != null)
                        textLabel.Style = this._curveTextFont;
                    _dxfFileModel.Entities.Add(textLabel);
                }
            }
        }
 
 
        //绘制汽蚀曲线
        protected override void DrawQNPSHCurve()
        {
            if (_allCurveNPSH == null || _allCurveNPSH.Count() == 0)
                return;
 
            foreach (var curve in _allCurveNPSH)
            {
                if (!curve.IsDispCurve)
                    continue;
                if (curve.CurveExpress == null)
                    continue;
                double work_qh_max_flow = -1;
                if (_isTrimCurveNpshOverQH)
                {
                    var wrk_qh_curve = (from x in _allCurveQH where x.CurveTag != null && x.CurveTag.ToString() == "WorkWaterCurve" select x.CurveExpress).FirstOrDefault();
                    if (wrk_qh_curve != null)
                        work_qh_max_flow = wrk_qh_curve.RangeMax;
                }
 
 
                Eventech.Model.FeatPointList points = null;
                if (this._regionPointParas != null)
                {
                    if (IsCurveNpshStartWithRegionAllow)
                    {//剪切且延长
                        if (this._regionPointParas.AllowRegionMin.Q > curve.CurveExpress.RangeMin)
                        {
                            double max_q = curve.CurveExpress.RangeMax;
                            points = Eventech.Common.FitCurveHelper.GetFitPointsByRange(curve.CurveExpress, this._regionPointParas.AllowRegionMin.Q, max_q, 7);
                        }
                        else
                        {
                            points = Eventech.Common.FitCurveHelper.GetFitPoints(curve.CurveExpress, 7);
                            points.Insert(0, new Eventech.Model.FeatPoint(this._regionPointParas.AllowRegionMin.Q, points.First().Y));
                        }
 
                    }
 
                    else
                    {
                        //if (_isTrimCurveNpshOverQH)
                        //{
                        //    
                        //}
 
                        if (_isTrimCurveNpshOverQH && work_qh_max_flow > 1)
                            points = Eventech.Common.FitCurveHelper.GetFitPointsByRange(curve.CurveExpress, curve.CurveExpress.RangeMin, work_qh_max_flow, 7);
                        else
                            points = Eventech.Common.FitCurveHelper.GetFitPoints(curve.CurveExpress, 7);
                    }
                }
                else
                {
                    if (_isTrimCurveNpshOverQH && work_qh_max_flow > 1)
                        points = Eventech.Common.FitCurveHelper.GetFitPointsByRange(curve.CurveExpress, curve.CurveExpress.RangeMin, work_qh_max_flow, 7);
                    else
                        points = Eventech.Common.FitCurveHelper.GetFitPoints(curve.CurveExpress, 7);
                }
 
                var dxfSpline = DrawSingleCurveQNPSH(_colorCurve, points);
                if (dxfSpline == null)
                    return;
                if (curve.IsDispPara && !string.IsNullOrEmpty(curve.CurvePara))
                {
                    var pt_posi = new Point3D(dxfSpline.FitPoints[0].X + _defatulCurveLabelHeight * 1.5, dxfSpline.FitPoints[0].Y + _defatulCurveLabelHeight, 0d);
                    if (curve.LabelPosiPara != null)
                    {
                        pt_posi = new Point3D(curve.LabelPosiPara.X, curve.LabelPosiPara.Y, 0d);
                    }
 
                    if (curve.LabelPosiPara != null)
                    {
                        pt_posi.X = MapRealToPictQ(curve.LabelPosiPara.X);
                        pt_posi.Y = MapRealToPictNPSH(curve.LabelPosiPara.Y);
                    }
 
                    pt_posi.X += _curveParasLabelSpaceX;
                    pt_posi.Y += _curveParasLabelSpaceY;
 
                    DxfMText textLabel = new DxfMText(curve.CurvePara, pt_posi, _defatulCurveLabelHeight);
                    if (curve.LabelPosiParaAligment == Eventech.Model.eTextAligment.Right)
                        textLabel.AttachmentPoint = AttachmentPoint.MiddleRight;
                    else if (curve.LabelPosiParaAligment == Eventech.Model.eTextAligment.Left)
                        textLabel.AttachmentPoint = AttachmentPoint.MiddleLeft;
                    else if (curve.LabelPosiParaAligment == Eventech.Model.eTextAligment.Top)
                        textLabel.AttachmentPoint = AttachmentPoint.BottomCenter;
 
                    textLabel.Color = _colorCurve;
 
                    textLabel.BackgroundFillFlags = BackgroundFillFlags.UseBackgroundFillColor | BackgroundFillFlags.UseDrawingWindowColor;
                    textLabel.BackgroundFillInfo = new BackgroundFillInfo();
                    textLabel.BackgroundFillInfo.BorderOffsetFactor = 1.2;//调整背景遮罩的比例 1是文字的背景,越大背景遮罩效果越大
 
                    if (_curveTextFont != null)
                        textLabel.Style = this._curveTextFont;
                    _dxfFileModel.Entities.Add(textLabel);
                }
            }
        }
 
        //绘制效率曲线
        protected override void DrawQECurve()
        {
            if (_allCurveQE == null || _allCurveQE.Count() == 0)
                return;
            if (!this.IsDispCurveQE)
                return;
 
            var layer_curve = GetLayerByName("粗实线");
            foreach (var curve in _allCurveQE)
            {
                if (!curve.IsDispCurve)
                    continue;
                if (curve.CurveExpress == null)
                    continue;
                var points = Eventech.Common.CurveExpressConver.ToPoints(curve.CurveExpress, 15);
 
 
                var dxfSpline = DrawSingleCurveQE(_colorCurve, points, 30, layer_curve);
                if (dxfSpline == null)
                    return;
                if (curve.IsDispPara && !string.IsNullOrEmpty(curve.CurvePara))
                {
                    var pt_posi = new Point3D(dxfSpline.FitPoints[0].X + _defatulCurveLabelHeight, dxfSpline.FitPoints[1].Y + _defatulCurveLabelHeight - 2, 0d);
                    if (curve.LabelPosiPara != null)
                    {
                        pt_posi.X = MapRealToPictQ(curve.LabelPosiPara.X);
                        pt_posi.Y = MapRealToPictE(curve.LabelPosiPara.Y);
                    }
 
                    DxfMText textLabel = new DxfMText(curve.CurvePara, pt_posi, _defatulCurveLabelHeight);
                    textLabel.Color = _colorCurve;
                    if (_curveTextFont != null)
                        textLabel.Style = this._curveTextFont;
                    _dxfFileModel.Entities.Add(textLabel);
                }
 
            }
        }
 
 
        //绘制功率曲线
        protected override void DrawQPCurve()
        {
            if (_allCurveQP == null || _allCurveQP.Count() == 0)
                return;
            var layer_curve = GetLayerByName("粗实线");
            foreach (var curve in _allCurveQP)
            {
                if (!curve.IsDispCurve)
                    continue;
                if (curve.CurveExpress == null)
                    continue;
                var points = Eventech.Common.CurveExpressConver.ToPoints(curve.CurveExpress, 15);
 
                var dxfSpline = DrawSingleCurveQP(_colorCurve, points, 30, layer_curve);
                if (dxfSpline == null)
                    return;
                if (curve.IsDispPara && !string.IsNullOrEmpty(curve.CurvePara))
                {
                    var pt_posi = new Point3D(dxfSpline.FitPoints[0].X + _defatulCurveLabelHeight, dxfSpline.FitPoints[1].Y + _defatulCurveLabelHeight - 2, 0d);
                    if (curve.LabelPosiPara != null)
                    {
                        pt_posi.X = MapRealToPictQ(curve.LabelPosiPara.X);
                        pt_posi.Y = MapRealToPictP(curve.LabelPosiPara.Y);
                    }
 
                    DxfMText textLabel = new DxfMText(curve.CurvePara, pt_posi, _defatulCurveLabelHeight);
                    textLabel.Color = _colorCurve;
                    if (_curveTextFont != null)
                        textLabel.Style = this._curveTextFont;
                    _dxfFileModel.Entities.Add(textLabel);
                }
            }
        }
 
 
        //绘制区域
        public void DrawRegion()
        {
            var layer_grid_line = GetLayerByName("细实线");
 
            #region 最优区域(标注)
            DxfDimensionStyle alternativedimenstionStyle = null;
            if (this._isDispRegionPrefer && this._regionPointParas != null)
            {
                if (alternativedimenstionStyle == null)
                {
                    WW.Cad.Model.Color deminColor = WW.Cad.Model.Color.CreateFromColorIndex(100); //CreateFromRgb(0, 255, 0);
                    //var frameTextFont = _dxfFileModel.GetTextStyleWithName("PC_TEXTSTYLE");//文件自带字体 
 
                    alternativedimenstionStyle = new DxfDimensionStyle(_dxfFileModel);
                    alternativedimenstionStyle.Name = "Architectural";//GB_LINEAR 文字在线上面 "Architectural" 文字在中间
                    //alternativedimenstionStyle.LinearUnitFormat = LinearUnitFormat.Engineering;
                    alternativedimenstionStyle.ArrowSize = 1.5d;
                    alternativedimenstionStyle.TextHeight = 2.5;
                    //alternativedimenstionStyle.FixedExtensionLineLength = 5;
                    alternativedimenstionStyle.ExtensionLineColor = deminColor;
                    alternativedimenstionStyle.ExtensionLineExtension = 2;
                    alternativedimenstionStyle.DimensionLineColor = deminColor;
                    alternativedimenstionStyle.TextColor = deminColor;
 
                    alternativedimenstionStyle.TextBackgroundFillMode = DimensionTextBackgroundFillMode.DrawingBackgroundColor;
                   // alternativedimenstionStyle.TextBackgroundColor =   WW.Cad.Model.Color.CreateFromColorIndex(18); //CreateFromRgb(0, 255, 0);
                    //if (frameTextFont != null)
                    //    alternativedimenstionStyle.TextStyle = frameTextFont;
                    //alternativedimenstionStyle.TickSize = 10;
                    _dxfFileModel.DimensionStyles.Add(alternativedimenstionStyle);
 
                }
 
                DxfDimension.Linear dimension = new DxfDimension.Linear(alternativedimenstionStyle);
                //  dimension.HasTextRotation = false;
                //  dimension.TextRotation = 0;
                // Touches bottom side of the circle.
                dimension.ExtensionLine1StartPoint = new Point3D(MapRealToPictQ(this._regionPointParas.PerferRegionMin.Q), _diagramLeftTopPt_QH.Y, 0);
                // Touches top side of the circle.
                dimension.ExtensionLine2StartPoint = new Point3D(MapRealToPictQ(this._regionPointParas.PerferRegionMax.Q), _diagramLeftTopPt_QH.Y, 0);
                //dimension.Color = GetEntityColor(System.Drawing.Color.Beige);
                //dimension.DxfColor = GetEntityColor(System.Drawing.Color.Beige);
                dimension.DimensionLineLocation = new Point3D((dimension.ExtensionLine1StartPoint.X + dimension.ExtensionLine2StartPoint.X) * 0.5, _diagramLeftTopPt_QH.Y + 3.2, 0);
                //  dimension.UseTextMiddlePoint = true;
                //dimension.HorizontalDirection = 0;
                if (this._currentLangugage == Eventech.Model.eLocalizationType.zhCN)
                    dimension.Text = " 优先工作区 ";//
                else
                    dimension.Text = " Priority workspace ";//
 
                _dxfFileModel.Entities.Add(dimension);
 
                //DxfVPort activeViewport = DxfVPort.CreateActiveVPort();
                //activeViewport.Center = new Point2D(3, 2);
                //activeViewport.Height = 15;
                //_dxfFileModel.VPorts.Add(activeViewport);
 
                var dxfLineDash = _dxfFileModel.LineTypes.Where(x => x.Name == "DASHED2").FirstOrDefault();//虚线
 
                Point2D pt_min1 = new Point2D(MapRealToPictQ(this._regionPointParas.PerferRegionMin.Q), _diagramLeftTopPt_QH.Y);
                Point2D pt_min2 = new Point2D(MapRealToPictQ(this._regionPointParas.PerferRegionMin.Q), _diagramLeftBottomPt_QP.Y);
                DxfLine dxfLine_min = new DxfLine(pt_min1, pt_min2);
                dxfLine_min.Color = AutoCadHelper.GetColor(System.Drawing.Color.Red);
                dxfLine_min.Layer = layer_grid_line;
                if (dxfLineDash != null)
                    dxfLine_min.LineType = dxfLineDash;
                _dxfFileModel.Entities.Add(dxfLine_min);
 
 
 
                Point2D pt_max1 = new Point2D(MapRealToPictQ(this._regionPointParas.PerferRegionMax.Q), _diagramLeftTopPt_QH.Y);
                Point2D pt_max2 = new Point2D(MapRealToPictQ(this._regionPointParas.PerferRegionMax.Q), _diagramLeftBottomPt_QP.Y);
                DxfLine dxfLine_max = new DxfLine(pt_max1, pt_max2);
                dxfLine_max.Color = AutoCadHelper.GetColor(System.Drawing.Color.Red);
                dxfLine_max.Layer = layer_grid_line;
                if (dxfLineDash != null)
                    dxfLine_max.LineType = dxfLineDash;
                _dxfFileModel.Entities.Add(dxfLine_max);
            }
            #endregion
 
            #region 运行区域(标注)
            if (_isDispRegionAllow && this._regionPointParas != null)
            {
                if (alternativedimenstionStyle == null)
                {
                    WW.Cad.Model.Color deminColor = WW.Cad.Model.Color.CreateFromColorIndex(100); //CreateFromRgb(0, 255, 0);
                    //var deminColor = WW.Cad.Model.Color.CreateFromRgb(0, 0, 255);
                    //if (this._isMonoColor)
                    //    deminColor = WW.Cad.Model.Color.CreateFromRgb(250, 250, 250);
 
                    alternativedimenstionStyle = new DxfDimensionStyle(_dxfFileModel);
                    alternativedimenstionStyle.Name = "Architectural";
                    //alternativedimenstionStyle.LinearUnitFormat = LinearUnitFormat.Engineering;
                    alternativedimenstionStyle.ArrowSize = 1.5d;
                    alternativedimenstionStyle.TextHeight = 2;
                    //alternativedimenstionStyle.FixedExtensionLineLength = 5;
                    alternativedimenstionStyle.ExtensionLineColor = deminColor;
                    alternativedimenstionStyle.ExtensionLineExtension = 2.5;
                    alternativedimenstionStyle.DimensionLineColor = deminColor;
                    alternativedimenstionStyle.TextColor = deminColor;
                    //alternativedimenstionStyle.TickSize = 10;
                    alternativedimenstionStyle.TextBackgroundFillMode = DimensionTextBackgroundFillMode.DrawingBackgroundColor;
                    //alternativedimenstionStyle.TextBackgroundColor = WW.Cad.Model.Color.CreateFromColorIndex(18); //CreateFromRgb(0, 255, 0);
                    _dxfFileModel.DimensionStyles.Add(alternativedimenstionStyle);
 
                }
 
 
                DxfDimension.Linear dimension = new DxfDimension.Linear(alternativedimenstionStyle);
                //  dimension.HasTextRotation = false;
                //  dimension.TextRotation = 0;
                // Touches bottom side of the circle.
                dimension.ExtensionLine1StartPoint = new Point3D(MapRealToPictQ(this._regionPointParas.AllowRegionMin.Q), _diagramLeftBottomPt_QH.Y, 0);
                // Touches top side of the circle.
                dimension.ExtensionLine2StartPoint = new Point3D(MapRealToPictQ(this._regionPointParas.AllowRegionMax.Q), _diagramLeftBottomPt_QH.Y, 0);
                //dimension.Color = GetEntityColor(System.Drawing.Color.Beige);
                //dimension.DxfColor = GetEntityColor(System.Drawing.Color.Beige);
                dimension.DimensionLineLocation = new Point3D((dimension.ExtensionLine1StartPoint.X + dimension.ExtensionLine2StartPoint.X) * 0.5, _diagramLeftBottomPt_QH.Y - 4.25, 0);
                //  dimension.UseTextMiddlePoint = true;
                //dimension.HorizontalDirection = 0;
                if (this._currentLangugage == Eventech.Model.eLocalizationType.zhCN)
                    dimension.Text = " 允许工作区 ";//
                else
                    dimension.Text = " Allow workspace ";//
 
                _dxfFileModel.Entities.Add(dimension);
 
                //DxfVPort activeViewport = DxfVPort.CreateActiveVPort();
                //activeViewport.Center = new Point2D(3, 2);
                //activeViewport.Height = 15;
                //_dxfFileModel.VPorts.Add(activeViewport);
 
                var dxfLineDash = _dxfFileModel.LineTypes.Where(x => x.Name == "LEI").FirstOrDefault();//虚线
 
                Point2D pt_min1 = new Point2D(MapRealToPictQ(this._regionPointParas.AllowRegionMin.Q), _diagramLeftTopPt_QH.Y);
                Point2D pt_min2 = new Point2D(MapRealToPictQ(this._regionPointParas.AllowRegionMin.Q), _diagramLeftBottomPt_QP.Y);
                DxfLine dxfLine_min = new DxfLine(pt_min1, pt_min2);
                dxfLine_min.Color = AutoCadHelper.GetColor(System.Drawing.Color.Red);
                dxfLine_min.Layer = layer_grid_line;
                if (dxfLineDash != null)
                    dxfLine_min.LineType = dxfLineDash;
                _dxfFileModel.Entities.Add(dxfLine_min);
 
 
 
                Point2D pt_max1 = new Point2D(MapRealToPictQ(this._regionPointParas.AllowRegionMax.Q), _diagramLeftTopPt_QH.Y);
                Point2D pt_max2 = new Point2D(MapRealToPictQ(this._regionPointParas.AllowRegionMax.Q), _diagramLeftBottomPt_QP.Y);
                DxfLine dxfLine_max = new DxfLine(pt_max1, pt_max2);
                dxfLine_max.Color = AutoCadHelper.GetColor(System.Drawing.Color.Red);
                dxfLine_max.Layer = layer_grid_line;
                if (dxfLineDash != null)
                    dxfLine_max.LineType = dxfLineDash;
                _dxfFileModel.Entities.Add(dxfLine_max);
            }
            #endregion
 
            #region 最小流量线
            //if (_isDispRegionAllow && this._regionPointParas != null)
            //{
            //    var regionAllowQ_pict = MapRealToPictQ(this._regionPointParas.AllowRegionMin.Q);
 
            //    var curveColor = TProduct.PumpGraph.Dxf.AutoCadHelper.GetColor(110);
            //    //
            //    var dxfLineDash = _dxfFileModel.LineTypes.Where(x => x.Name == "DASHED2").FirstOrDefault();//虚线
            //    //延长线
            //    DxfLine lineQ = new DxfLine(new Point2D(regionAllowQ_pict, this._diagramLeftTopPt_QH.Y), new Point2D(regionAllowQ_pict, -8));
            //    lineQ.LineWeight = 40;
            //    lineQ.Color = curveColor;
            //    if (dxfLineDash != null)
            //        lineQ.LineType = dxfLineDash;
            //    _dxfFileModel.Entities.Add(lineQ);
 
            //    //文字
            //    var textFont = _dxfFileModel.GetTextStyleWithName("PC_TEXTSTYLE4");//文件自带字体 
            //    if (textFont == null)
            //        textFont = _dxfFileModel.GetTextStyleWithName("Standard");//文件自带字体 
 
            //    Point3D pt_q_min = new Point3D();
            //    pt_q_min.X = regionAllowQ_pict;
            //    pt_q_min.Y = -30;
            //    pt_q_min.Z = 0d;
            //    DxfMText text_q_min = new DxfMText("Qmin", pt_q_min, 11);//\P表示回车
            //    text_q_min.AttachmentPoint = AttachmentPoint.TopCenter;
            //    text_q_min.Color = curveColor;
            //    text_q_min.Style = textFont;
            //    _dxfFileModel.Entities.Add(text_q_min);
            //}
            #endregion
 
        }
 
 
        #region 工作点
        private void DrawWorkPoint()
        {
            if (!_isDrawDesignPoint)
                return;
            var layer_curve = GetLayerByName("粗实线");
 
            var textColor = TProduct.PumpGraph.Dxf.AutoCadHelper.GetColor(TProduct.PumpGraph.Dxf.AutoCadHelper.RedColorIndex);
            if (this._isMonoColor)
            {
                textColor = TProduct.PumpGraph.Dxf.AutoCadHelper.GetColor(TProduct.PumpGraph.Dxf.AutoCadHelper.WhiteColorIndex);
            }
            if (this._designPointStdUnit != null)
            {
                Point2D centerPt = new Point2D();
                centerPt.X = MapRealToPictQ(this._designPointStdUnit.X);
                centerPt.Y = MapRealToPictH(this._designPointStdUnit.Y);
 
         
 
                // 
                DxfLine lineQ = new DxfLine(new Point2D(centerPt.X, this._diagramLeftTopPt_QH.Y), new Point2D(centerPt.X, this._diagramLeftBottomPt.Y));
                lineQ.LineWeight = 30;
                lineQ.Color = textColor;
                lineQ.Layer = layer_curve;
                _dxfFileModel.Entities.Add(lineQ);
 
 
 
                DxfLine lineH = new DxfLine(new Point2D(this._diagramLeftTopPt_QH.X, centerPt.Y), new Point2D(this._diagramRightTopPt_QH.X, centerPt.Y));
                lineH.LineWeight = 30;
                lineH.Layer = layer_curve;
                lineH.Color = textColor;
                _dxfFileModel.Entities.Add(lineH);
 
 
 
                DxfCircle circleQP = new DxfCircle(centerPt, 1.5);
                circleQP.LineWeight = 200;
                circleQP.Color = textColor;
                circleQP.Layer = layer_curve;
                _dxfFileModel.Entities.Add(circleQP);   
            }
 
 
 
 
 
           
         
        }
        #endregion
 
 
    }
}