-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPyViews.cpp
More file actions
153 lines (135 loc) · 4.85 KB
/
PyViews.cpp
File metadata and controls
153 lines (135 loc) · 4.85 KB
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
#include "stdafx.h"
#include "PyViews.h"
#include "PyStabilityGraphViewController.h"
#include "PyEffectivePrestressGraphViewController.h"
#include "PyConcretePropertiesGraphViewController.h"
#include "PyDeflectionHistoryGraphViewController.h"
#include "PyStressHistoryGraphViewController.h"
#include "PyAnalysisResultsGraphViewController.h"
#include "PySegmentAnalysisResultsGraphViewController.h"
#include "PyGirderPropertiesGraphViewController.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////
void CPyViews::Init(IBroker* pBroker)
{
m_pBroker = pBroker;
m_pBroker->GetInterface(IID_IViews, (IUnknown**)&m_pViews); // can't use GET_IFACE because it will create a local variable that goes out of scope
}
void CPyViews::Reset()
{
m_pViews.Release();
}
CPyBridgeModelView CPyViews::CreateBridgeModelView()
{
CComPtr<IBridgeModelViewController> controller;
m_pViews->CreateBridgeModelView(&controller);
GET_IFACE(ISelection, pSelection);
CPyBridgeModelView view;
view.Init(controller, pSelection);
return view;
}
CPyGirderModelView CPyViews::CreateGirderView()
{
CComPtr<IGirderModelViewController> controller;
m_pViews->CreateGirderView(CGirderKey(ALL_GROUPS, 0), &controller);
CPyGirderModelView view;
view.Init(controller);
return view;
}
CPyLoadsView CPyViews::CreateLoadsView()
{
CComPtr<ILoadsViewController> controller;
m_pViews->CreateLoadsView(&controller);
CPyLoadsView view;
view.Init(controller);
return view;
}
void CPyViews::CreateLibraryEditorView()
{
m_pViews->CreateLibraryEditorView();
}
void CPyViews::CreateGraphView(IndexType idx)
{
m_pViews->CreateGraphView(idx);
}
CPyViewControllerBase* CPyViews::CreateGraphViewByName(LPCSTR strName)
{
USES_CONVERSION;
CComPtr<IEAFViewController> controller;
m_pViews->CreateGraphView(A2T(strName),&controller);
return CreateGraphContollerWrapper(controller);
}
void CPyViews::CreateReport(IndexType idx,bool bPrompt)
{
m_pViews->CreateReportView(idx,bPrompt);
}
CPyViewControllerBase* CPyViews::CreateGraphContollerWrapper(IEAFViewController* pController) const
{
CComQIPtr<IStabilityGraphViewController> stabilityGraphController(pController);
CComQIPtr<IEffectivePrestressGraphViewController> effectivePrestressGraphController(pController);
CComQIPtr<IConcretePropertiesGraphViewController> concretePropertiesController(pController);
CComQIPtr<IDeflectionHistoryGraphViewController> deflectionHistoryController(pController);
CComQIPtr<IStressHistoryGraphViewController> stressHistoryController(pController);
CComQIPtr<IAnalysisResultsGraphViewController> analysisResultsController(pController);
CComQIPtr<ISegmentAnalysisResultsGraphViewController> segmentAnalysisResultsController(pController);
CComQIPtr<IGirderPropertiesGraphViewController> girderPropertiesController(pController);
if (stabilityGraphController)
{
auto controller = std::make_unique<CPyStabilityGraphViewController>();
controller->Init(stabilityGraphController);
return controller.release();
}
else if (effectivePrestressGraphController)
{
auto controller = std::make_unique<CPyEffectivePrestressGraphViewController>();
controller->Init(effectivePrestressGraphController);
return controller.release();
}
else if (concretePropertiesController)
{
auto controller = std::make_unique<CPyConcretePropertiesGraphViewController>();
controller->Init(concretePropertiesController);
return controller.release();
}
else if (deflectionHistoryController)
{
auto controller = std::make_unique<CPyDeflectionHistoryGraphViewController>();
controller->Init(deflectionHistoryController);
return controller.release();
}
else if (stressHistoryController)
{
auto controller = std::make_unique<CPyStressHistoryGraphViewController>();
controller->Init(stressHistoryController);
return controller.release();
}
else if (analysisResultsController)
{
auto controller = std::make_unique<CPyAnalysisResultsGraphViewController>();
controller->Init(analysisResultsController);
return controller.release();
}
else if (segmentAnalysisResultsController)
{
auto controller = std::make_unique<CPySegmentAnalysisResultsGraphViewController>();
controller->Init(segmentAnalysisResultsController);
return controller.release();
}
else if (girderPropertiesController)
{
auto controller = std::make_unique<CPyGirderPropertiesGraphViewController>();
controller->Init(girderPropertiesController);
return controller.release();
}
else
{
ATLASSERT(false); // should never get here... is there a new type of graph controller?
PyErr_SetString(PyExc_NameError, "Graph controller not available");
PyErr_Print();
return nullptr;
}
}