18
18
#include <api/controllers/ihistorycontroller.h>
19
19
#include <visualizator/wxvtk/gvistacompleja.h>
20
20
#include <api/dicom/dcmdictionary.h>
21
#include <api/internationalization/internationalization.h>
21
#include <api/internationalization/internationalization.h>
22
#include <eventos/scgenerated.h>
23
#include <api/controllers/ieventscontroller.h>
24
#include <api/ivista.h>
25
#include <resources/ginkgoresourcesmanager.h>
26
#include <main/gui/pacsupload/pacsuploaddialog.h>
27
#include <main/controllers/commandcontroller.h>
28
#include <commands/sendpacscommand.h>
23
30
#include "previewpanelvisualizator.h"
25
34
namespace GNKVisualizator {
27
36
//////////////////////BEGIN D&D/////////////////////////
99
//////////////////////BEGIN MENU/////////////////////////
100
class EXTAPI wxLeafPanelDefaultHandler: public wxEvtHandler
103
wxLeafPanelDefaultHandler(wxEvtHandler* pParent, GVistaCompleja* view, long seriesPk): m_pParent(pParent),
108
m_pParent->Connect(PACS_UPLOAD, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( wxLeafPanelDefaultHandler::OnPacsUpload),NULL,this);
110
virtual ~wxLeafPanelDefaultHandler()
112
m_pParent->Disconnect(PACS_UPLOAD, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( wxLeafPanelDefaultHandler::OnPacsUpload),NULL,this);
115
virtual void OnPacsUpload(wxCommandEvent& event)
117
std::list<long> viewSeries;
118
viewSeries.insert(viewSeries.begin(), GView->GetView()->GetEstudio()->OpenedSeries.begin(), GView->GetView()->GetEstudio()->OpenedSeries.end());
119
std::list<long> selectedSeries;
120
selectedSeries.push_back(SeriesPk);
122
GNC::GUI::PACSUploadDialog dlg(GView->GetView()->GetWindow(), viewSeries, selectedSeries);
124
if (dlg.ShowModal() == wxID_OK) {
125
std::list<long> listOfSeries;
126
listOfSeries = dlg.GetSelectedSeries();
127
if (!listOfSeries.empty()) {
128
GADAPI::SendPACSCommand* pCmd = new GADAPI::SendPACSCommand(dlg.GetSelectedServer(), "", listOfSeries);
129
GNC::GCS::ICommandController::Instance()->ProcessAsync(_Std("Uploading to the PACS ..."),pCmd, NULL);
135
GVistaCompleja* GView;
137
wxEvtHandler* m_pParent;
139
//////////////////////END MENU/////////////////////////
90
141
class IPreviewLeafVisualizator : public GNC::GUI::IPreviewLeaf
98
149
virtual void OnShowMenu(wxWindow* pParent)
152
wxMenuItem* pItem = popupMenu.Append(PACS_UPLOAD, _("Upload series to PACS..."));
154
pItem->SetBitmaps(GinkgoResourcesManager::MenuIcons::GetIcoSendToPACS());
156
pItem->SetBitmap(GinkgoResourcesManager::MenuIcons::GetIcoSendToPACS());
158
wxLeafPanelDefaultHandler menuHandler(pParent, VisualizatorView, seriesPk);
159
pParent->PopupMenu(&popupMenu);
101
161
virtual void OnPreviewDClick(wxWindow* pParent)
121
GNKVisualizator::GUI::PreviewPanelVisualizator::PreviewPanelVisualizator(GNC::GCS::IVista* pView, wxWindow* pParent) : GNC::GUI::PreviewPanel(pView, pParent)
181
GNKVisualizator::GUI::PreviewPanelVisualizator::PreviewPanelVisualizator(GNC::GCS::IVista* pView, GVistaCompleja* pParent) : GNC::GUI::PreviewPanel(pView, pParent)
184
GNC::GCS::IEventsController::Instance()->Registrar(this, GNC::GCS::Events::SCGeneratedEvent(m_pView));
126
187
GNKVisualizator::GUI::PreviewPanelVisualizator::~PreviewPanelVisualizator()
134
void GNKVisualizator::GUI::PreviewPanelVisualizator::LoadModel(GVistaCompleja* pParent, GNC::GCS::Ptr<GNKVisualizator::VisualizatorStudy>& pStudy)
195
void GNKVisualizator::GUI::PreviewPanelVisualizator::LoadModel()
136
197
if (pRoot != NULL) {
201
GNC::GCS::Ptr<GNC::GCS::IStudyContext>& pStudy = m_pView->GetEstudio();
202
GVistaCompleja* GView = dynamic_cast<GVistaCompleja*>(GetParent());
139
204
pRoot = new GNKVisualizator::GUI::IPreviewNodeVisualizator(std::string(wxString::Format(_("%d series"), pStudy->OpenedSeries.size()).ToUTF8()));
140
205
for (std::vector<long>::iterator it = pStudy->OpenedSeries.begin(); it != pStudy->OpenedSeries.end(); ++it)
143
208
GNC::GCS::IHistoryController::FileModel fileModel = GNC::GCS::IHistoryController::Instance()->GetFrameOfReference((*it));
144
209
std::ostringstream ostr;
145
210
ostr << seriesModel.series_modality << " (" << seriesModel.num_instances << ")";
146
GNC::GUI::IPreviewLeaf* pLeaf = new GNKVisualizator::GUI::IPreviewLeafVisualizator(pParent, (*it), seriesModel.series_desc, ostr.str());
211
GNC::GUI::IPreviewLeaf* pLeaf = new GNKVisualizator::GUI::IPreviewLeafVisualizator(GView, (*it), seriesModel.series_desc, ostr.str());
147
212
pLeaf->SetFilePk(fileModel.pk);
148
213
pRoot->AddChild(pLeaf);
150
215
GNC::GUI::PreviewPanel::LoadModel(pRoot);
220
void GNKVisualizator::GUI::PreviewPanelVisualizator::ProcesarEvento(GNC::GCS::Events::IEvent* evt)
222
GNC::GUI::PreviewPanel::ProcesarEvento(evt);
224
switch(evt->GetCodigoEvento()) {
225
case ginkgoEVT_Core_SCGenerated:
227
GNC::GCS::Events::SCGeneratedEvent* pSCGenEvt = dynamic_cast<GNC::GCS::Events::SCGeneratedEvent*>(evt);
228
if(pSCGenEvt != NULL) {
229
GNC::GCS::Ptr<GNC::GCS::IStudyContext>& pStudy = m_pView->GetEstudio();
230
for (std::list<long>::const_iterator itNew = pSCGenEvt->GetSeriesId().begin(); itNew != pSCGenEvt->GetSeriesId().end(); ++itNew) {
231
bool newSeries = true;
232
for (std::vector<long>::const_iterator itOpened = pStudy->OpenedSeries.begin(); itOpened != pStudy->OpenedSeries.end(); ++itOpened) {
233
if ((*itOpened) == (*itNew)) {
239
pStudy->OpenedSeries.push_back((*itNew));