/
XBeamRateView.cpp
executable file
·1964 lines (1574 loc) · 64 KB
/
XBeamRateView.cpp
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
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
///////////////////////////////////////////////////////////////////////
// XBeamRate - Cross Beam Load Rating
// Copyright © 1999-2024 Washington State Department of Transportation
// Bridge and Structures Office
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the Alternate Route Open Source License as
// published by the Washington State Department of Transportation,
// Bridge and Structures Office.
//
// This program is distributed in the hope that it will be useful, but
// distribution is AS IS, WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the Alternate Route Open Source License for more details.
//
// You should have received a copy of the Alternate Route Open Source
// License along with this program; if not, write to the Washington
// State Department of Transportation, Bridge and Structures Office,
// P.O. Box 47340, Olympia, WA 98503, USA or e-mail
// Bridge_Support@wsdot.wa.gov
///////////////////////////////////////////////////////////////////////
// XBeamRateView.cpp : implementation of the CXBeamRateView class
//
#include "stdafx.h"
#include "resource.h"
#include "XBeamRateDoc.h"
#include "XBeamRateView.h"
#include "XBeamRateChildFrame.h"
#include "SectionCut.h"
#include "DisplayObjectFactory.h"
#include <IFace\XBeamRateAgent.h>
#include <IFace\Project.h>
#include <IFace\AnalysisResults.h>
#include <IFace\LoadRating.h>
#include <IFace\Pier.h>
#include <IFace\EditByUI.h>
#include <..\..\PGSuper\Include\IFace\Project.h>
#include <..\..\PGSuper\Include\IFace\Bridge.h>
#include <..\..\PGSuper\Include\IFace\PointOfInterest.h>
#include <..\..\PGSuper\Include\IFace\Intervals.h>
#include <..\..\PGSuper\Include\Hints.h>
#include <IFace\Alignment.h>
#include <MFCTools\Format.h>
#include <EAF\EAFDisplayUnits.h>
#include "XBRateCalculationSheet.h"
#include <PgsExt\BridgeDescription2.h>
#include <XBeamRateExt\XBeamRateUtilities.h>
#include <WBFLGenericBridge.h>
#include <PGSuperColors.h>
#define COLUMN_LINE_COLOR GREY50
#define COLUMN_FILL_COLOR GREY70
#define XBEAM_LINE_COLOR GREY50
#define XBEAM_FILL_COLOR GREY70
#define COLUMN_LINE_WEIGHT 1
//#define XBEAM_LINE_WEIGHT 3
#define REBAR_LINE_WEIGHT 1
#define ROADWAY_DISPLAY_LIST_ID 0
#define GIRDER_DISPLAY_LIST_ID 1
#define BEARING_DISPLAY_LIST_ID 2
#define XBEAM_DISPLAY_LIST_ID 3
#define COLUMN_DISPLAY_LIST_ID 4
#define DIMENSIONS_DISPLAY_LIST_ID 5
#define REBAR_DISPLAY_LIST_ID 6
#define STIRRUP_DISPLAY_LIST_ID 7
#define SECTION_CUT_DISPLAY_LIST_ID 8
#define STAGE1_STIRRUP_COLOR STIRRUP_COLOR
#define STAGE2_STIRRUP_COLOR OLIVEDRAB
#define SECTION_CUT_ID 500
// The End/Section view of the pier is offset from the Elevation
// view by this amount.
const Float64 EndOffset = WBFL::Units::ConvertToSysUnits(10,WBFL::Units::Measure::Feet);
const SelectionType g_selectionType = stNone; // nothing is selectable, except for the section cut object
//const SelectionType g_selectionType = stAll;
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CXBeamRateView
IMPLEMENT_DYNCREATE(CXBeamRateView, CDisplayView)
BEGIN_MESSAGE_MAP(CXBeamRateView, CDisplayView)
//{{AFX_MSG_MAP(CXBeamRateView)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
ON_WM_CREATE()
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
ON_COMMAND(IDM_EXPORT_PIER, OnExportPier)
ON_COMMAND(IDM_EDIT_PIER, OnEditPier)
ON_WM_SIZE()
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CXBeamRateView construction/destruction
CXBeamRateView::CXBeamRateView()
{
// TODO: add construction code here
m_DisplayObjectID = 0;
}
CXBeamRateView::~CXBeamRateView()
{
}
BOOL CXBeamRateView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CDisplayView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CXBeamRateView printing
void CXBeamRateView::OnDraw(CDC* pDC)
{
if ( m_bIsIdealized )
{
pDC->TextOut(0,0,_T("Pier is idealized"));
}
else
{
CDisplayView::OnDraw(pDC);
}
}
BOOL CXBeamRateView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CXBeamRateView::OnPrint(CDC* pDC, CPrintInfo* pInfo)
{
// get paper size
CComPtr<IBroker> pBroker;
EAFGetBroker(&pBroker);
XBRateCalculationSheet border(pBroker);
CRect rcPrint = border.Print(pDC, 1);
// want to offset picture away from borders - get device units for 10mm
int oldmode = pDC->SetMapMode(MM_LOMETRIC);
POINT offset[2] = { {0,0}, {100,-100}};
pDC->LPtoDP(offset,2);
int offsetx = offset[1].x - offset[0].x;
int offsety = offset[1].y - offset[0].y;
rcPrint.DeflateRect(offsetx,offsety);
pDC->SetMapMode(oldmode);
if (rcPrint.IsRectEmpty())
{
CHECKX(0,_T("Can't print border - page too small?"));
rcPrint = pInfo->m_rectDraw;
}
CDisplayView::OnBeginPrinting(pDC, pInfo, rcPrint);
OnPrepareDC(pDC);
ScaleToFit();
OnDraw(pDC);
OnEndPrinting(pDC, pInfo);
}
void CXBeamRateView::OnSize(UINT nType, int cx, int cy)
{
CDisplayView::OnSize(nType, cx, cy);
CRect rect;
GetClientRect(&rect);
rect.DeflateRect(15,15,15,15);
CSize size = rect.Size();
size.cx = Max(0L,size.cx);
size.cy = Max(0L,size.cy);
SetLogicalViewRect(MM_TEXT,rect);
SetScrollSizes(MM_TEXT,size,CScrollView::sizeDefault,CScrollView::sizeDefault);
ScaleToFit();
}
/////////////////////////////////////////////////////////////////////////////
// CXBeamRateView diagnostics
#ifdef _DEBUG
void CXBeamRateView::AssertValid() const
{
// AFX_MANAGE_STATE(AfxGetStaticModuleState());
//CDisplayView::AssertValid();
}
void CXBeamRateView::Dump(CDumpContext& dc) const
{
CDisplayView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CXBeamRateView message handlers
int CXBeamRateView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if ( CDisplayView::OnCreate(lpCreateStruct) == -1 )
{
return -1;
}
EnableToolTips();
CComPtr<iDisplayMgr> dispMgr;
GetDisplayMgr(&dispMgr);
CDisplayObjectFactory* factory = new CDisplayObjectFactory();
CComPtr<iDisplayObjectFactory> doFactory;
doFactory.Attach((iDisplayObjectFactory*)factory->GetInterface(&IID_iDisplayObjectFactory));
dispMgr->AddDisplayObjectFactory(doFactory);
dispMgr->EnableLBtnSelect(TRUE);
dispMgr->EnableRBtnSelect(TRUE);
dispMgr->SetSelectionLineColor(SELECTED_OBJECT_LINE_COLOR);
dispMgr->SetSelectionFillColor(SELECTED_OBJECT_FILL_COLOR);
CDisplayView::SetMappingMode(DManip::Isotropic);
// Setup display lists
CComPtr<iDisplayList> displayList;
::CoCreateInstance(CLSID_DisplayList,nullptr,CLSCTX_ALL,IID_iDisplayList,(void**)&displayList);
displayList->SetID(SECTION_CUT_DISPLAY_LIST_ID);
dispMgr->AddDisplayList(displayList);
displayList.Release();
::CoCreateInstance(CLSID_DisplayList,nullptr,CLSCTX_ALL,IID_iDisplayList,(void**)&displayList);
displayList->SetID(DIMENSIONS_DISPLAY_LIST_ID);
dispMgr->AddDisplayList(displayList);
displayList.Release();
::CoCreateInstance(CLSID_DisplayList,nullptr,CLSCTX_ALL,IID_iDisplayList,(void**)&displayList);
displayList->SetID(ROADWAY_DISPLAY_LIST_ID);
dispMgr->AddDisplayList(displayList);
displayList.Release();
::CoCreateInstance(CLSID_DisplayList,nullptr,CLSCTX_ALL,IID_iDisplayList,(void**)&displayList);
displayList->SetID(REBAR_DISPLAY_LIST_ID);
dispMgr->AddDisplayList(displayList);
displayList.Release();
::CoCreateInstance(CLSID_DisplayList,nullptr,CLSCTX_ALL,IID_iDisplayList,(void**)&displayList);
displayList->SetID(STIRRUP_DISPLAY_LIST_ID);
dispMgr->AddDisplayList(displayList);
displayList.Release();
::CoCreateInstance(CLSID_DisplayList,nullptr,CLSCTX_ALL,IID_iDisplayList,(void**)&displayList);
displayList->SetID(BEARING_DISPLAY_LIST_ID);
dispMgr->AddDisplayList(displayList);
displayList.Release();
::CoCreateInstance(CLSID_DisplayList,nullptr,CLSCTX_ALL,IID_iDisplayList,(void**)&displayList);
displayList->SetID(GIRDER_DISPLAY_LIST_ID);
dispMgr->AddDisplayList(displayList);
displayList.Release();
::CoCreateInstance(CLSID_DisplayList,nullptr,CLSCTX_ALL,IID_iDisplayList,(void**)&displayList);
displayList->SetID(XBEAM_DISPLAY_LIST_ID);
dispMgr->AddDisplayList(displayList);
displayList.Release();
::CoCreateInstance(CLSID_DisplayList,nullptr,CLSCTX_ALL,IID_iDisplayList,(void**)&displayList);
displayList->SetID(COLUMN_DISPLAY_LIST_ID);
dispMgr->AddDisplayList(displayList);
m_pFrame = (CXBeamRateChildFrame*)GetParent();
ASSERT( m_pFrame != 0 );
ASSERT( m_pFrame->IsKindOf( RUNTIME_CLASS( CXBeamRateChildFrame ) ) );
return 0;
}
void CXBeamRateView::OnInitialUpdate()
{
CDisplayView::OnInitialUpdate();
}
PierIDType CXBeamRateView::GetPierID()
{
AFX_MANAGE_STATE(AfxGetAppModuleState());
CXBeamRateChildFrame* pFrame = (CXBeamRateChildFrame*)GetParentFrame();
return pFrame->GetPierID();
}
PierIndexType CXBeamRateView::GetPierIndex()
{
AFX_MANAGE_STATE(AfxGetAppModuleState());
CXBeamRateChildFrame* pFrame = (CXBeamRateChildFrame*)GetParentFrame();
return pFrame->GetPierIndex();
}
xbrPointOfInterest CXBeamRateView::GetCutLocation()
{
CComPtr<iDisplayMgr> dispMgr;
GetDisplayMgr(&dispMgr);
CComPtr<iDisplayList> pDL;
dispMgr->FindDisplayList(SECTION_CUT_DISPLAY_LIST_ID,&pDL);
ATLASSERT(pDL);
CComPtr<iDisplayObject> dispObj;
pDL->FindDisplayObject(SECTION_CUT_ID,&dispObj);
if ( dispObj == nullptr )
{
return xbrPointOfInterest();
}
CComPtr<iDisplayObjectEvents> sink;
dispObj->GetEventSink(&sink);
CComQIPtr<iPointDisplayObject,&IID_iPointDisplayObject> point_disp(dispObj);
CComQIPtr<iSectionCutDrawStrategy,&IID_iSectionCutDrawStrategy> sectionCutStrategy(sink);
return sectionCutStrategy->GetCutPOI(m_pFrame->GetCurrentCutLocation());
}
void CXBeamRateView::OnUpdate(CView* pSender,LPARAM lHint,CObject* pHint)
{
if (IsPGSExtension())
{
if (lHint == HINT_SELECTIONCHANGED)
{
// nothing in this view is related to the current selection
return;
}
if (lHint == HINT_BRIDGECHANGED)
{
AFX_MANAGE_STATE(AfxGetAppModuleState());
CXBeamRateChildFrame* pFrame = (CXBeamRateChildFrame*)GetParentFrame();
pFrame->UpdatePierList();
}
}
PierIDType pierID = GetPierID();
if (pierID != INVALID_ID)
{
CComPtr<IBroker> pBroker;
EAFGetBroker(&pBroker);
GET_IFACE2(pBroker, IBridgeDescription, pIBridgeDesc);
const CBridgeDescription2* pBridgeDesc = pIBridgeDesc->GetBridgeDescription();
const CPierData2* pPier = pBridgeDesc->FindPier(pierID);
if (pPier == nullptr)
{
CDC* pDC = GetDC();
pDC->TextOut(0, 0, _T("Invalid Pier"));
return;
}
}
m_pFrame->UpdateSectionCutExtents();
CDisplayView::OnUpdate(pSender,lHint,pHint);
CDManipClientDC dc2(this);
UpdateDisplayObjects();
ScaleToFit();
Invalidate();
}
void CXBeamRateView::UpdateDisplayObjects()
{
CWaitCursor wait;
m_bIsIdealized = false;
PierIndexType pierIdx = GetPierIndex();
if ( pierIdx != INVALID_INDEX )
{
CComPtr<IBroker> pBroker;
EAFGetBroker(&pBroker);
GET_IFACE2(pBroker,IBridgeDescription,pIBridgeDesc);
const CPierData2* pPier = pIBridgeDesc->GetPier(pierIdx);
if ( pPier->GetPierModelType() == pgsTypes::pmtIdealized )
{
// there is nothing to draw when the pier is idealized
m_bIsIdealized = true;
return;
}
}
CComPtr<iDisplayMgr> dispMgr;
GetDisplayMgr(&dispMgr);
// Capture the current selection before blasting all the
// display objects
DisplayObjectContainer vCurSel;
dispMgr->GetSelectedObjects(&vCurSel);
ATLASSERT(vCurSel.size() < 2);
IDType curSel = INVALID_ID;
IDType listID = INVALID_ID;
if ( vCurSel.size() == 1 )
{
CComPtr<iDisplayObject> pDO = vCurSel[0];
curSel = pDO->GetID();
CComPtr<iDisplayList> pDL;
pDO->GetDisplayList(&pDL);
listID = pDL->GetID();
}
dispMgr->ClearDisplayObjects();
m_DisplayObjectID = 0;
UpdateRoadwayDisplayObjects();
UpdateXBeamDisplayObjects();
UpdateColumnDisplayObjects();
UpdateBearingDisplayObjects();
UpdateGirderDisplayObjects();
UpdateRebarDisplayObjects();
UpdateStirrupDisplayObjects();
UpdateDimensionsDisplayObjects();
UpdateSectionCutDisplayObjects();
// Re-instate the current selection
if ( curSel != INVALID_ID )
{
CComPtr<iDisplayObject> doSel;
dispMgr->FindDisplayObject(curSel,listID,atByID,&doSel);
dispMgr->SelectObject(doSel,TRUE);
}
}
void CXBeamRateView::UpdateRoadwayDisplayObjects()
{
CComPtr<iDisplayMgr> dispMgr;
GetDisplayMgr(&dispMgr);
CDManipClientDC dc(this);
CComPtr<iDisplayList> displayList;
dispMgr->FindDisplayList(ROADWAY_DISPLAY_LIST_ID,&displayList);
CComPtr<IBroker> pBroker;
EAFGetBroker(&pBroker);
PierIDType pierID = GetPierID();
GET_IFACE2(pBroker,IXBRPier,pPier);
Float64 skew = pPier->GetSkewAngle(pierID);
Float64 cos_skew = cos(skew);
GET_IFACE2(pBroker,IXBRProject,pProject);
// Model a vertical line for the alignment
// The alignment is at X = 0 in Pier coordinates
Float64 X = 0;
Float64 Xcl = pPier->ConvertPierToCurbLineCoordinate(pierID,X);
Float64 Ydeck = pPier->GetElevation(pierID,Xcl); // deck elevation at alignment
Float64 Yt = Ydeck + WBFL::Units::ConvertToSysUnits(1.0,WBFL::Units::Measure::Feet); // add a little so it projects over the roadway surface
CComPtr<IPoint2d> pnt1;
pnt1.CoCreateInstance(CLSID_Point2d);
pnt1->Move(X,Yt);
Float64 Yb = Yt - pPier->GetMaxColumnHeight(pierID);
CComPtr<IPoint2d> pnt2;
pnt2.CoCreateInstance(CLSID_Point2d);
pnt2->Move(X,Yb);
CComPtr<iLineDisplayObject> doAlignment;
CreateLineDisplayObject(pnt1,pnt2,&doAlignment);
CComPtr<iDrawLineStrategy> drawStrategy;
doAlignment->GetDrawLineStrategy(&drawStrategy);
CComQIPtr<iSimpleDrawLineStrategy> drawAlignmentStrategy(drawStrategy);
drawAlignmentStrategy->SetWidth(ALIGNMENT_LINE_WEIGHT);
drawAlignmentStrategy->SetColor(ALIGNMENT_COLOR);
drawAlignmentStrategy->SetLineStyle(lsCenterline);
// Don't add the object to the display list here... do it at the end
// We want it to be drawn on top so it has to go into the display list last
//displayList->AddDisplayObject(doAlignment);
// Draw the bridge line if different then the alignment
CComPtr<iLineDisplayObject> doBridgeLine;
Float64 BLO = pProject->GetBridgeLineOffset(pierID);
if ( !IsZero(BLO) )
{
// Model a vertical line for the bridge line
// Let X = BLO be at the alignment and Y = the alignment elevation
Float64 X = BLO/cos_skew;
pnt1.Release();
pnt1.CoCreateInstance(CLSID_Point2d);
pnt1->Move(X,Yt);
pnt2.Release();
pnt2.CoCreateInstance(CLSID_Point2d);
pnt2->Move(X,Yb);
CreateLineDisplayObject(pnt1,pnt2,&doBridgeLine);
CComPtr<iDrawLineStrategy> drawStrategy;
doBridgeLine->GetDrawLineStrategy(&drawStrategy);
CComQIPtr<iSimpleDrawLineStrategy> drawBridgeLineStrategy(drawStrategy);
drawBridgeLineStrategy->SetWidth(BRIDGELINE_LINE_WEIGHT);
drawBridgeLineStrategy->SetColor(BRIDGE_COLOR);
drawBridgeLineStrategy->SetLineStyle(lsCenterline);
//displayList->AddDisplayObject(doBridgeLine); // do this at the end
}
// Draw Roadway Surface
if ( IsStandAlone() )
{
// Stand-alone... we don't have an actual deck modeled, so
// just show the curb-to-curb extents of the roadway surface
CComPtr<iPolyLineDisplayObject> doDeck;
doDeck.CoCreateInstance(CLSID_PolyLineDisplayObject);
doDeck->SetID(m_DisplayObjectID++);
Float64 LCO, RCO;
pProject->GetCurbLineOffset(pierID,&LCO,&RCO);
if (pProject->GetCurbLineDatum(pierID) == pgsTypes::omtBridge)
{
LCO += BLO;
RCO += BLO;
}
Float64 Ylc = pPier->GetElevation(pierID,0);
LCO /= cos_skew; // skew adjust
pnt1->Move(LCO,Ylc);
doDeck->AddPoint(pnt1);
Float64 CPO = pProject->GetCrownPointOffset(pierID);
if (LCO <= CPO && CPO <= RCO)
{
// add crown point if it is between the left and right curblines
pnt2->Move(CPO, Ydeck);
doDeck->AddPoint(pnt2);
}
Float64 Yrc = pPier->GetElevation(pierID, (RCO - LCO) / cos_skew);
RCO /= cos_skew; // skew adjust
CComPtr<IPoint2d> pnt3;
pnt3.CoCreateInstance(CLSID_Point2d);
pnt3->Move(RCO,Yrc);
doDeck->AddPoint(pnt3);
doDeck->put_PointType(plpNone);
doDeck->put_Color(PROFILE_COLOR);
doDeck->put_Width(PROFILE_LINE_WEIGHT);
doDeck->Commit();
displayList->AddDisplayObject(doDeck);
}
else
{
// Part of PGSuper/PGSplice... we can get the actual superstructure shapes
// Deck
GET_IFACE2(pBroker,IBridgeDescription,pIBridgeDesc);
const CBridgeDescription2* pBridgeDesc = pIBridgeDesc->GetBridgeDescription();
const CDeckDescription2* pDeck = pBridgeDesc->GetDeckDescription();
PierIndexType pierIdx = GetPierIndex();
const CPierData2* pPier = pBridgeDesc->GetPier(pierIdx);
Float64 pierStation = pPier->GetStation();
GET_IFACE2(pBroker,IShapes,pShapes);
GET_IFACE2(pBroker,IBridge,pBridge);
CComPtr<IDirection> pierDirection;
pBridge->GetPierDirection(pierIdx,&pierDirection);
pgsTypes::SupportedDeckType deckType = pDeck->GetDeckType();
if ( deckType != pgsTypes::sdtNone )
{
CComPtr<iPointDisplayObject> dispObj;
dispObj.CoCreateInstance(CLSID_PointDisplayObject);
CComPtr<IShape> shape;
pShapes->GetSlabShape(pierStation,pierDirection,true/*include haunch*/,&shape);
CComPtr<iShapeDrawStrategy> strategy;
strategy.CoCreateInstance(CLSID_ShapeDrawStrategy);
strategy->SetShape(shape);
strategy->SetSolidLineColor(IsStructuralDeck(deckType) ? DECK_BORDER_COLOR : NONSTRUCTURAL_DECK_BORDER_COLOR);
strategy->SetSolidFillColor(IsStructuralDeck(deckType) ? DECK_FILL_COLOR : NONSTRUCTURAL_DECK_FILL_COLOR);
strategy->SetVoidLineColor(VOID_BORDER_COLOR);
strategy->SetVoidFillColor(GetSysColor(COLOR_WINDOW));
strategy->DoFill(true);
dispObj->SetDrawingStrategy(strategy);
CComPtr<iShapeGravityWellStrategy> gravity_well;
gravity_well.CoCreateInstance(CLSID_ShapeGravityWellStrategy);
gravity_well->SetShape(shape);
dispObj->SetGravityWellStrategy(gravity_well);
dispObj->SetSelectionType(g_selectionType);
dispObj->SetID(m_DisplayObjectID++);
displayList->AddDisplayObject(dispObj);
}
// Left Hand Barrier
CComPtr<iPointDisplayObject> left_dispObj;
left_dispObj.CoCreateInstance(CLSID_PointDisplayObject);
Float64 left_curb_offset = pBridge->GetLeftCurbOffset(pierIdx);
Float64 right_curb_offset = pBridge->GetRightCurbOffset(pierIdx);
CComPtr<IShape> left_shape;
pShapes->GetLeftTrafficBarrierShape(pierStation,pierDirection,&left_shape);
CComPtr<iShapeDrawStrategy> strategy;
if ( left_shape )
{
strategy.CoCreateInstance(CLSID_ShapeDrawStrategy);
strategy->SetShape(left_shape);
strategy->SetSolidLineColor(BARRIER_BORDER_COLOR);
strategy->SetSolidFillColor(BARRIER_FILL_COLOR);
strategy->SetVoidLineColor(VOID_BORDER_COLOR);
strategy->SetVoidFillColor(GetSysColor(COLOR_WINDOW));
strategy->DoFill(true);
strategy->HasBoundingShape(false);
left_dispObj->SetDrawingStrategy(strategy);
displayList->AddDisplayObject(left_dispObj);
}
// Right Hand Barrier
CComPtr<iPointDisplayObject> right_dispObj;
right_dispObj.CoCreateInstance(CLSID_PointDisplayObject);
CComPtr<IShape> right_shape;
pShapes->GetRightTrafficBarrierShape(pierStation,pierDirection,&right_shape);
if ( right_shape )
{
strategy.Release();
strategy.CoCreateInstance(CLSID_ShapeDrawStrategy);
strategy->SetShape(right_shape);
strategy->SetSolidLineColor(BARRIER_BORDER_COLOR);
strategy->SetSolidFillColor(BARRIER_FILL_COLOR);
strategy->SetVoidLineColor(VOID_BORDER_COLOR);
strategy->SetVoidFillColor(GetSysColor(COLOR_WINDOW));
strategy->DoFill(true);
strategy->HasBoundingShape(false);
right_dispObj->SetDrawingStrategy(strategy);
displayList->AddDisplayObject(right_dispObj);
}
}
displayList->AddDisplayObject(doAlignment);
if ( doBridgeLine )
{
displayList->AddDisplayObject(doBridgeLine);
}
}
void CXBeamRateView::UpdateXBeamDisplayObjects()
{
CComPtr<iDisplayMgr> dispMgr;
GetDisplayMgr(&dispMgr);
CDManipClientDC dc(this);
CComPtr<iDisplayList> displayList;
dispMgr->FindDisplayList(XBEAM_DISPLAY_LIST_ID,&displayList);
CComPtr<IBroker> pBroker;
EAFGetBroker(&pBroker);
PierIDType pierID = GetPierID();
GET_IFACE2(pBroker,IXBRProject,pProject);
GET_IFACE2(pBroker,IXBRPier,pPier);
GET_IFACE2(pBroker,IXBRSectionProperties,pSectProp);
// Model Upper Cross Beam (Elevation)
CComPtr<IPoint2d> point;
point.CoCreateInstance(CLSID_Point2d);
point->Move(0,0);
if ( pProject->GetPierType(pierID) != xbrTypes::pctExpansion )
{
CComPtr<iPointDisplayObject> doUpperXBeam;
doUpperXBeam.CoCreateInstance(CLSID_PointDisplayObject);
doUpperXBeam->SetID(m_DisplayObjectID++);
doUpperXBeam->SetPosition(point,FALSE,FALSE);
doUpperXBeam->SetSelectionType(g_selectionType);
CComPtr<IShape> upperXBeamShape;
pPier->GetUpperXBeamProfile(pierID,&upperXBeamShape);
CComPtr<iShapeDrawStrategy> upperXBeamDrawStrategy;
upperXBeamDrawStrategy.CoCreateInstance(CLSID_ShapeDrawStrategy);
upperXBeamDrawStrategy->SetShape(upperXBeamShape);
upperXBeamDrawStrategy->SetSolidLineColor(XBEAM_LINE_COLOR);
upperXBeamDrawStrategy->SetSolidFillColor(XBEAM_FILL_COLOR);
upperXBeamDrawStrategy->DoFill(TRUE);
doUpperXBeam->SetDrawingStrategy(upperXBeamDrawStrategy);
CComPtr<iShapeGravityWellStrategy> upper_xbeam_gravity_well;
upper_xbeam_gravity_well.CoCreateInstance(CLSID_ShapeGravityWellStrategy);
upper_xbeam_gravity_well->SetShape(upperXBeamShape);
doUpperXBeam->SetGravityWellStrategy(upper_xbeam_gravity_well);
displayList->AddDisplayObject(doUpperXBeam);
}
// Model Lower Cross Beam (Elevation)
CComPtr<iPointDisplayObject> doLowerXBeam;
doLowerXBeam.CoCreateInstance(CLSID_PointDisplayObject);
doLowerXBeam->SetID(m_DisplayObjectID++);
doLowerXBeam->SetPosition(point,FALSE,FALSE);
doLowerXBeam->SetSelectionType(g_selectionType);
CComPtr<IShape> lowerXBeamShape;
pPier->GetLowerXBeamProfile(pierID,&lowerXBeamShape);
CComPtr<iShapeDrawStrategy> lowerXBeamDrawStrategy;
lowerXBeamDrawStrategy.CoCreateInstance(CLSID_ShapeDrawStrategy);
lowerXBeamDrawStrategy->SetShape(lowerXBeamShape);
lowerXBeamDrawStrategy->SetSolidLineColor(XBEAM_LINE_COLOR);
lowerXBeamDrawStrategy->SetSolidFillColor(XBEAM_FILL_COLOR);
lowerXBeamDrawStrategy->DoFill(TRUE);
doLowerXBeam->SetDrawingStrategy(lowerXBeamDrawStrategy);
CComPtr<iShapeGravityWellStrategy> lower_xbeam_gravity_well;
lower_xbeam_gravity_well.CoCreateInstance(CLSID_ShapeGravityWellStrategy);
lower_xbeam_gravity_well->SetShape(lowerXBeamShape);
doLowerXBeam->SetGravityWellStrategy(lower_xbeam_gravity_well);
displayList->AddDisplayObject(doLowerXBeam);
// Section Cut
Float64 Lxb = pPier->GetXBeamLength(xbrTypes::xblTopLowerXBeam, pierID);
Lxb = pPier->ConvertCrossBeamToPierCoordinate(pierID,Lxb);
Float64 XxbCut = pPier->ConvertPierToCrossBeamCoordinate(pierID,m_pFrame->GetCurrentCutLocation());
CComPtr<iPointDisplayObject> doXBeamSection;
doXBeamSection.CoCreateInstance(CLSID_PointDisplayObject);
doXBeamSection->SetID(m_DisplayObjectID++);
doXBeamSection->SetPosition(point,FALSE,FALSE);
doXBeamSection->SetSelectionType(g_selectionType);
CComPtr<IShape> xbeamShape;
pSectProp->GetXBeamShape(pierID,xbrPointOfInterest(INVALID_ID,XxbCut),&xbeamShape);
CComQIPtr<IXYPosition> position(xbeamShape);
position->Offset(EndOffset+Lxb,0);
CComPtr<iShapeDrawStrategy> xbeamDrawStrategy;
xbeamDrawStrategy.CoCreateInstance(CLSID_ShapeDrawStrategy);
xbeamDrawStrategy->SetShape(xbeamShape);
xbeamDrawStrategy->SetSolidLineColor(XBEAM_LINE_COLOR);
xbeamDrawStrategy->SetSolidFillColor(XBEAM_FILL_COLOR);
xbeamDrawStrategy->DoFill(TRUE);
doXBeamSection->SetDrawingStrategy(xbeamDrawStrategy);
CComPtr<iShapeGravityWellStrategy> xbeam_section_gravity_well;
xbeam_section_gravity_well.CoCreateInstance(CLSID_ShapeGravityWellStrategy);
xbeam_section_gravity_well->SetShape(xbeamShape);
doXBeamSection->SetGravityWellStrategy(xbeam_section_gravity_well);
displayList->AddDisplayObject(doXBeamSection);
GET_IFACE2(pBroker,IEAFDisplayUnits,pDisplayUnits);
CString strSectionCutLabel;
strSectionCutLabel.Format(_T("Section @ %s"),::FormatDimension(XxbCut,pDisplayUnits->GetSpanLengthUnit()));
CComPtr<IPoint2d> pntBC;
position->get_LocatorPoint(lpBottomCenter,&pntBC);
pntBC->Offset(0,-WBFL::Units::ConvertToSysUnits(3.0,WBFL::Units::Measure::Feet));
CComPtr<iTextBlock> doLabel;
doLabel.CoCreateInstance(CLSID_TextBlock);
doLabel->SetText(strSectionCutLabel);
doLabel->SetBkMode(TRANSPARENT);
doLabel->SetTextAlign(TA_TOP | TA_CENTER);
doLabel->SetPosition(pntBC);
displayList->AddDisplayObject(doLabel);
}
void CXBeamRateView::UpdateColumnDisplayObjects()
{
CComPtr<iDisplayMgr> dispMgr;
GetDisplayMgr(&dispMgr);
CDManipClientDC dc(this);
CComPtr<iDisplayList> displayList;
dispMgr->FindDisplayList(COLUMN_DISPLAY_LIST_ID,&displayList);
CComPtr<IBroker> pBroker;
EAFGetBroker(&pBroker);
GET_IFACE2(pBroker,IXBRPier,pPier);
GET_IFACE2(pBroker,IXBRProject,pProject);
PierIDType pierID = GetPierID();
// Create a function that represents the bottom of the cross beam
// We will use it to make the top of the column match the bottom of the
// cross beam.
WBFL::Math::PiecewiseFunction fn;
CComPtr<IPoint2dCollection> points;
pPier->GetBottomSurface(pierID,xbrTypes::Stage1,&points);
CComPtr<IEnumPoint2d> enumPoints;
points->get__Enum(&enumPoints);
CComPtr<IPoint2d> pnt;
while ( enumPoints->Next(1,&pnt,nullptr) != S_FALSE )
{
Float64 x,y;
pnt->Location(&x,&y);
fn.AddPoint(x,y);
pnt.Release();
}
IndexType nColumns = pPier->GetColumnCount(pierID);
for (IndexType colIdx = 0; colIdx < nColumns; colIdx++ )
{
Float64 XxbCol = pPier->GetColumnLocation(pierID,colIdx);
Float64 XpCol = pPier->ConvertCrossBeamToPierCoordinate(pierID,XxbCol);
Float64 Ytop = pPier->GetTopColumnElevation(pierID,colIdx);
Float64 Ybot = pPier->GetBottomColumnElevation(pierID,colIdx);
CColumnData::ColumnShapeType colShapeType;
Float64 d1, d2;
CColumnData::ColumnHeightMeasurementType columnHeightType;
Float64 H;
pProject->GetColumnProperties(pierID,colIdx,&colShapeType,&d1,&d2,&columnHeightType,&H);
CComPtr<IPoint2d> pntTop, pntBot;
pntTop.CoCreateInstance(CLSID_Point2d);
pntTop->Move(XpCol,Ytop);
pntBot.CoCreateInstance(CLSID_Point2d);
pntBot->Move(XpCol,Ybot);
CComPtr<iPointDisplayObject> doTop;
doTop.CoCreateInstance(CLSID_PointDisplayObject);
doTop->Visible(FALSE);
doTop->SetPosition(pntTop,FALSE,FALSE);
CComQIPtr<iConnectable> connectable1(doTop);
CComPtr<iSocket> socket1;
connectable1->AddSocket(0,pntTop,&socket1);
CComPtr<iPointDisplayObject> doBot;
doBot.CoCreateInstance(CLSID_PointDisplayObject);
doBot->Visible(FALSE);
doBot->SetPosition(pntBot,FALSE,FALSE);
CComQIPtr<iConnectable> connectable2(doBot);
CComPtr<iSocket> socket2;
connectable2->AddSocket(0,pntBot,&socket2);
// Create the shape of the column
CComPtr<IPolyShape> columnShape;
columnShape.CoCreateInstance(CLSID_PolyShape);
Float64 X1,X2,X3;
pntTop->get_X(&X2);
X1 = X2-d1/2;
X3 = X2+d1/2;
Float64 Y1 = fn.Evaluate(X1);
Float64 Y2 = fn.Evaluate(X2);
Float64 Y3 = fn.Evaluate(X3);
columnShape->AddPoint(X1,Y1);
columnShape->AddPoint(X2,Y2);
columnShape->AddPoint(X3,Y3);
columnShape->AddPoint(X3,Ybot);
columnShape->AddPoint(X1,Ybot);
CComQIPtr<IShape> shape(columnShape);
CComPtr<iPointDisplayObject> doColumn;
doColumn.CoCreateInstance(CLSID_PointDisplayObject);
doColumn->SetID(m_DisplayObjectID++);
doColumn->SetPosition(pntTop,FALSE,FALSE);
doColumn->SetSelectionType(g_selectionType);
CComPtr<iShapeDrawStrategy> drawColumnStrategy;
drawColumnStrategy.CoCreateInstance(CLSID_ShapeDrawStrategy);
doColumn->SetDrawingStrategy(drawColumnStrategy);
drawColumnStrategy->SetShape(shape);
drawColumnStrategy->SetSolidLineColor(COLUMN_LINE_COLOR);
drawColumnStrategy->SetSolidLineWidth(COLUMN_LINE_WEIGHT);
drawColumnStrategy->SetSolidFillColor(COLUMN_FILL_COLOR);
drawColumnStrategy->DoFill(TRUE);
displayList->AddDisplayObject(doColumn);
}
}
void CXBeamRateView::UpdateRebarDisplayObjects()
{
CComPtr<iDisplayMgr> dispMgr;
GetDisplayMgr(&dispMgr);
CDManipClientDC dc(this);
CComPtr<iDisplayList> displayList;
dispMgr->FindDisplayList(REBAR_DISPLAY_LIST_ID,&displayList);
CComPtr<IBroker> pBroker;
EAFGetBroker(&pBroker);
GET_IFACE2(pBroker,IXBRPier,pPier);
PierIDType pierID = GetPierID();
GET_IFACE2(pBroker,IXBRRebar,pRebar);
// Elevation View
IndexType nRebarRows = pRebar->GetRebarRowCount(pierID);
for ( IndexType rowIdx = 0; rowIdx < nRebarRows; rowIdx++ )
{
CComPtr<IPoint2dCollection> points;
pRebar->GetRebarProfile(pierID,rowIdx,&points); // in Cross Beam Coordinates
CComPtr<iPolyLineDisplayObject> doRebar;
doRebar.CoCreateInstance(CLSID_PolyLineDisplayObject);
doRebar->SetID(m_DisplayObjectID++);
doRebar->AddPoints(points);
doRebar->put_PointType(plpNone);
doRebar->put_Color(REBAR_COLOR);
doRebar->put_Width(REBAR_LINE_WEIGHT);
doRebar->Commit();
displayList->AddDisplayObject(doRebar);
}
// Section View
Float64 Lxb = pPier->GetXBeamLength(xbrTypes::xblTopLowerXBeam, pierID);
Lxb = pPier->ConvertCrossBeamToPierCoordinate(pierID,Lxb);
Float64 XxbCut = pPier->ConvertPierToCrossBeamCoordinate(pierID,m_pFrame->GetCurrentCutLocation());
CComPtr<IRebarSection> rebarSection;
pRebar->GetRebarSection(pierID,xbrTypes::Stage2,xbrPointOfInterest(INVALID_ID,XxbCut),&rebarSection);
CComPtr<IEnumRebarSectionItem> enumSectionItems;
rebarSection->get__EnumRebarSectionItem(&enumSectionItems);
CComPtr<IRebarSectionItem> sectionItem;
while ( enumSectionItems->Next(1,§ionItem,nullptr) != S_FALSE )
{
CComPtr<IPoint2d> pntBar;
sectionItem->get_Location(&pntBar);
pntBar->Offset(EndOffset+Lxb,0);
CComPtr<iPointDisplayObject> doBar;
doBar.CoCreateInstance(CLSID_PointDisplayObject);
doBar->SetID(m_DisplayObjectID++);
doBar->SetPosition(pntBar,FALSE,FALSE);
displayList->AddDisplayObject(doBar);
sectionItem.Release();
}
}
void CXBeamRateView::UpdateStirrupDisplayObjects()
{
CComPtr<iDisplayMgr> dispMgr;