-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathGeometryTabController.cpp
More file actions
74 lines (59 loc) · 2.93 KB
/
GeometryTabController.cpp
File metadata and controls
74 lines (59 loc) · 2.93 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
/***********************************************************************************************************************
* OpenStudio(R), Copyright (c) OpenStudio Coalition and other contributors.
* See also https://openstudiocoalition.org/about/software_license/
***********************************************************************************************************************/
#include "GeometryTabController.hpp"
#include "GeometryTabView.hpp"
#include "GeometryPreviewController.hpp"
#include "GeometryPreviewView.hpp"
#include "GeometryEditorController.hpp"
#include "GeometryEditorView.hpp"
#include <openstudio/model/Model.hpp>
#include <openstudio/utilities/core/Assert.hpp>
// DLM: remove once editor is always enabled
#include <QProcessEnvironment>
namespace openstudio {
GeometryTabController::GeometryTabController(bool isIP, const model::Model& model)
: MainTabController(new GeometryTabView(model, "Geometry")), m_model(model), m_isIP(isIP) {
this->mainContentWidget()->addSubTab("3D View", VIEW);
// DLM: remove once editor is always enabled
//if (QProcessEnvironment::systemEnvironment().value("OPENSTUDIO_GEOMETRY_EDITOR") == QString("1")){
this->mainContentWidget()->addSubTab("Editor", EDITOR);
//}
connect(this->mainContentWidget(), &MainTabView::tabSelected, this, &GeometryTabController::setSubTab);
}
GeometryTabController::~GeometryTabController() {
disconnect(this->mainContentWidget(), &MainTabView::tabSelected, this, &GeometryTabController::setSubTab);
}
void GeometryTabController::setSubTab(int index) {
if (m_currentIndex == index) {
return;
} else {
m_currentIndex = index;
}
if (m_currentController) {
delete m_currentController;
}
switch (index) {
case VIEW: {
auto* previewController = new GeometryPreviewController(m_isIP, m_model);
//connect(this, &ConstructionsTabController::toggleUnitsClicked, static_cast<ModelSubTabView*>(defaultConstructionSetsController->subTabView()), &ModelSubTabView::toggleUnitsClicked);
//connect(defaultConstructionSetsController, &DefaultConstructionSetsController::downloadComponentsClicked, this, &ConstructionsTabController::downloadComponentsClicked);
//connect(defaultConstructionSetsController, &DefaultConstructionSetsController::openLibDlgClicked, this, &ConstructionsTabController::openLibDlgClicked);
this->mainContentWidget()->setSubTab(previewController->view());
m_currentController = previewController;
break;
}
case EDITOR: {
auto* editorController = new GeometryEditorController(m_isIP, m_model);
//connect(this, &ConstructionsTabController::toggleUnitsClicked, static_cast<ModelSubTabView*>(constructionsController->subTabView()), &ModelSubTabView::toggleUnitsClicked);
this->mainContentWidget()->setSubTab(editorController->view());
m_currentController = editorController;
break;
}
default:
OS_ASSERT(false);
break;
}
}
} // namespace openstudio