-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCViewTreeJson.cpp
More file actions
156 lines (138 loc) · 6.24 KB
/
CViewTreeJson.cpp
File metadata and controls
156 lines (138 loc) · 6.24 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
154
155
156
#include "pch.h"
#include "CViewTreeJson.h"
#include "ModelViewerView.h"
#include "MainFrm.h"
#include <string>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
CViewTreeJson::CViewTreeJson() noexcept
{
}
CViewTreeJson::~CViewTreeJson()
{
}
BEGIN_MESSAGE_MAP(CViewTreeJson, CTreeCtrl)
ON_NOTIFY_REFLECT(TVN_SELCHANGING, &CViewTreeJson::OnTvnSelchanging)
ON_NOTIFY_REFLECT(TVN_SELCHANGED, &CViewTreeJson::OnTvnSelchanged)
END_MESSAGE_MAP()
BOOL CViewTreeJson::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult)
{
BOOL bRes = CTreeCtrl::OnNotify(wParam, lParam, pResult);
NMHDR* pNMHDR = (NMHDR*)lParam;
ASSERT(pNMHDR != nullptr);
#pragma warning(suppress : 26454)
if (pNMHDR && pNMHDR->code == TTN_SHOW && GetToolTips() != nullptr)
{
GetToolTips()->SetWindowPos(&wndTop, -1, -1, -1, -1, SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOSIZE);
}
return bRes;
}
void CViewTreeJson::OnTvnSelchanging(NMHDR* pNMHDR, LRESULT* pResult)
{
LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR);
// TODO: ここにコントロール通知ハンドラー コードを追加します。
*pResult = 0;
}
static bool bflag = false;
void CViewTreeJson::OnTvnSelchanged(NMHDR* pNMHDR, LRESULT* pResult)
{
LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR);
auto selected_item = pNMTreeView->itemNew.hItem;
if (selected_item != NULL)
{
CMainFrame* p_frame = (CMainFrame*)AfxGetMainWnd();
if (p_frame)
{
CModelViewerView* p_view = (CModelViewerView*)p_frame->GetActiveView();
if (p_view)
{
p_view->m_selected_list.clear();
}
std::string* showData = nullptr;
showData = (std::string*)this->GetItemData(selected_item);
if (showData)
{
std::string str_uid(*showData);
std::vector<std::string> selected_topology;
// SurfaceWeldingのtopPartとbottomPart
auto surface_welding_find_it = p_view->m_id_to_surface_weldings.find(str_uid);
if (surface_welding_find_it != p_view->m_id_to_surface_weldings.end())
{
for (const auto& part : surface_welding_find_it->second.parts)
{
// LineWeldingPartのprimaryEdge取得
auto line_welding_part_find_it = p_view->m_id_to_line_welding_parts.find(part);
if (line_welding_part_find_it != p_view->m_id_to_line_welding_parts.end())
{
selected_topology.emplace_back(line_welding_part_find_it->second.primaryEdge);
selected_topology.emplace_back(line_welding_part_find_it->second.secondaryEdge);
}
}
str_uid.clear();
}
// SideWeldingのtopPartとbottomPart
auto side_welding_find_it = p_view->m_id_to_side_weldings.find(str_uid);
if (side_welding_find_it != p_view->m_id_to_side_weldings.end())
{
// LineWeldingPartのprimaryEdge取得
auto line_welding_part_find_it = p_view->m_id_to_line_welding_parts.find(side_welding_find_it->second.topPart);
if (line_welding_part_find_it != p_view->m_id_to_line_welding_parts.end())
{
selected_topology.emplace_back(line_welding_part_find_it->second.primaryEdge);
selected_topology.emplace_back(line_welding_part_find_it->second.secondaryEdge);
}
line_welding_part_find_it = p_view->m_id_to_line_welding_parts.find(side_welding_find_it->second.bottomPart);
if (line_welding_part_find_it != p_view->m_id_to_line_welding_parts.end())
{
selected_topology.emplace_back(line_welding_part_find_it->second.primaryEdge);
selected_topology.emplace_back(line_welding_part_find_it->second.secondaryEdge);
}
str_uid.clear();
}
// LineWeldingPartのprimaryEdge取得
auto line_welding_part_find_it = p_view->m_id_to_line_welding_parts.find(str_uid);
if (line_welding_part_find_it != p_view->m_id_to_line_welding_parts.end())
{
selected_topology.emplace_back(line_welding_part_find_it->second.primaryEdge);
selected_topology.emplace_back(line_welding_part_find_it->second.secondaryEdge);
str_uid.clear();
}
if (!str_uid.empty())
{
selected_topology.emplace_back(str_uid);
}
for (const auto& str_uid : selected_topology)
{
auto face_find_it = p_view->m_uid_to_face_map.find(str_uid);
if (face_find_it != p_view->m_uid_to_face_map.end())
{
p_view->m_selected_list.add(face_find_it->second);
}
else
{
auto edge_find_it = p_view->m_uid_to_edge_map.find(str_uid);
if (edge_find_it != p_view->m_uid_to_edge_map.end())
{
p_view->m_selected_list.add(edge_find_it->second);
}
else
{
auto vertex_find_it = p_view->m_uid_to_vertex_map.find(str_uid);
if (vertex_find_it != p_view->m_uid_to_vertex_map.end())
{
p_view->m_selected_list.add(vertex_find_it->second);
}
}
}
}
//p_frame->m_wndAvroView.m_dlgAvroProperty.m_propertyEdit = p_view->GetPropertyById(str_uid).c_str();
//p_frame->m_wndAvroView.m_dlgAvroProperty.UpdateData(FALSE);
//p_frame->m_wndAvroView.m_dlgAvroProperty.Invalidate();
}
p_view->Invalidate();
}
}
}