~ubuntu-branches/ubuntu/trusty/ginkgocadx/trusty

« back to all changes in this revision

Viewing changes to src/visualizator/visualizator/controllers/visualizatorcontroller.cpp

  • Committer: Package Import Robot
  • Author(s): Dmitry Smirnov
  • Date: 2013-07-21 11:58:53 UTC
  • mfrom: (7.2.1 sid)
  • Revision ID: package-import@ubuntu.com-20130721115853-44e7n1xujqglu78e
Tags: 3.4.0.928.29+dfsg-1
* New upstream release [July 2013]
  + new B-D: "libjsoncpp-dev".
  + new patch "unbundle-libjsoncpp.patch" to avoid building bundled
    "libjsoncpp-dev".
  + new patch "fix-wx.patch" to avoid FTBFS due to missing
    "-lwx_gtk2u_html-2.8".
* Removed unnecessary versioned Build-Depends.
* Removed obsolete lintian override.
* Reference get-orig-source implementation for orig.tar clean-up and
  DFSG-repackaging.
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#include <visualizator/dialogos/contenedorherramientas.h>
24
24
#include <main/gui/import/generaldata.h>
25
25
#include <main/gui/import/importationdata.h>
 
26
#include <main/gui/history3/synchronizedialog.h>
26
27
#include "../vistas/vista2d.h"
27
28
#include "../vistas/waveformview.h"
28
29
#include <visualizator/estudios/visualizatorstudy.h>
44
45
 
45
46
#include <api/controllers/icontroladorcarga.h>
46
47
#include <main/controllers/controladorcarga.h>
47
 
#include <main/controllers/controladorcomandos.h>
 
48
#include <main/controllers/commandcontroller.h>
48
49
#include <main/controllers/historycontroller.h>
49
50
#include <main/controllers/hangingprotocolcontroller.h>
50
 
#include <visualizator/commands/pdfextractercommand.h>
 
51
#include <commands/pdfextractercommand.h>
51
52
#include <commands/comandopacs.h>
52
53
 
53
54
#include <vector>
201
202
        return (importationUID == EXT_IMPORTER_SID);
202
203
}
203
204
 
 
205
//helper opening...
 
206
GNC::GCS::IVista* OpenMedicalImageViewer(const std::set<long>& seriesPk, wxWindow* pParent, GNC::GCS::IEntorno* pEntorno, GNC::GCS::IModuleController* pModule, const GNC::GCS::Ptr<GNC::GCS::Layout>& hangingLayout)
 
207
{
 
208
        wxWindowDisabler disabler;
 
209
        GNC::GCS::Ptr<GNKVisualizator::VisualizatorStudy> estudio = new GNKVisualizator::VisualizatorStudy();
 
210
        estudio->OpenedSeries.insert(estudio->OpenedSeries.begin(), seriesPk.begin(), seriesPk.end());
 
211
        estudio->Module = pModule;
 
212
        estudio->hangingLayout = hangingLayout;
 
213
        estudio->ParentWindow = pParent;
 
214
        estudio->InitializeContext(*seriesPk.begin());
 
215
        GNC::GCS::IVista* pVista = new GNKVisualizator::Vista2D(estudio);
 
216
        pEntorno->GetControladorVistas()->Registrar(pVista);
 
217
        pEntorno->GetControladorCarga()->CargaAsincrona(pVista);
 
218
        return pVista;
 
219
}
 
220
 
204
221
/* Abre un estudio de manera no interactiva desde un directorio y devuelve su controlador específico */
205
222
GNC::GCS::IVista* GNKVisualizator::ControladorAtencionPrimaria::OpenView(int modo, GNC::GCS::IHistoryController::SeriesModelList& series, GNC::GCS::Ptr<GNC::GCS::HangingProtocol> hangingProtocol)
206
223
{
213
230
 
214
231
        //si no se soporta alguna modalidad pues se ignora
215
232
        std::set<long> pkSeries;
 
233
        bool wadoLinked = false;
216
234
        {
217
235
                for(GNC::GCS::IHistoryController::SeriesModelList::iterator it = series.begin(); it!= series.end(); ++it){
218
236
                        for (GNC::GCS::IHistoryController::StringList::iterator itTsyntax = (*it).tsuids.begin(); itTsyntax != (*it).tsuids.end(); ++itTsyntax) {
219
237
                                if(m_ListaModos[modo]->SupportsModalityFile((*it).series_modality, (*itTsyntax)))
220
238
                                {
221
239
                                        pkSeries.insert((*it).pk);
 
240
                                        if ((*it).location == GNC::GCS::IHistoryController::TL_WadoLinked) {
 
241
                                                wadoLinked = true;
 
242
                                        }
222
243
                                }
223
244
                        }
224
245
                }
225
246
        }
226
247
 
 
248
        if (wadoLinked) {
 
249
                //show dialog then download and open again
 
250
                std::list<long> listOfPk;
 
251
                listOfPk.insert(listOfPk.begin(), pkSeries.begin(), pkSeries.end());
 
252
                GNC::GUI::SynchronizeDialog dlg(m_pEntorno->GetVentanaRaiz(), listOfPk, this, modo, hangingProtocol);
 
253
                dlg.ShowModal();
 
254
                return NULL;
 
255
        }
227
256
        
228
257
        //first of all open pdf...
229
258
        std::set<long> tmpPk = pkSeries;
230
259
        pkSeries.clear();
231
260
        for(std::set<long>::iterator it = tmpPk.begin(); it!= tmpPk.end(); ++it)
232
261
        {
233
 
                GNC::GCS::IHistoryController::FileModelList fileModels;
 
262
                GNC::GCS::IHistoryController::LightFileModelList fileModels;
234
263
                GNC::GCS::HistoryController::Instance()->GetSeriesSortedFileModels((*it), fileModels);
235
264
                if (fileModels.size() == 0)
236
265
                {
240
269
                //if it's pdf...
241
270
                std::list<std::string> paths;
242
271
                bool isPdf = false;
243
 
                for (GNC::GCS::IHistoryController::FileModelList::iterator itFile = fileModels.begin(); itFile != fileModels.end(); ++itFile) 
 
272
                for (GNC::GCS::IHistoryController::LightFileModelList::iterator itFile = fileModels.begin(); itFile != fileModels.end(); ++itFile) 
244
273
                {
245
274
                        paths.push_back((*itFile).real_path);
246
275
                        if ((*itFile).sopcuid == GKUID_EncapsulatedPDFStorage) {
248
277
                        }
249
278
                }
250
279
                if (isPdf) {
251
 
                        GNKVisualizator::GADAPI::PDFExtracterCommandParameters* pParams = new GNKVisualizator::GADAPI::PDFExtracterCommandParameters(paths);
252
 
                        GNKVisualizator::GADAPI::PDFExtracterCommand* pCmd = new GNKVisualizator::GADAPI::PDFExtracterCommand(pParams);
253
 
                        m_pEntorno->GetControladorComandos()->ProcessAsync("Extracting...", pCmd, NULL);
 
280
                        GADAPI::PDFExtracterCommandParameters* pParams = new GADAPI::PDFExtracterCommandParameters(paths);
 
281
                        GADAPI::PDFExtracterCommand* pCmd = new GADAPI::PDFExtracterCommand(pParams);
 
282
                        m_pEntorno->GetCommandController()->ProcessAsync("Extracting...", pCmd, NULL);
254
283
                        continue;
255
284
                } else {
256
285
                        pkSeries.insert((*it));
257
286
                }
258
287
        }
259
288
 
260
 
        
261
289
        GNC::GCS::IControladorVistas* pCtrlVistas = m_pEntorno->GetControladorVistas();
262
290
        wxWindow* pVentanaPadre = NULL;
263
291
 
264
292
        if (m_ListaModos[modo]->GetDescripcion() == _Std("Medical Image Viewer") && !pkSeries.empty()) 
265
293
        {
266
 
                {//comienza la deshabilitacion
267
 
                        pVentanaPadre = pCtrlVistas->GetRootWindow();
268
 
                        pCtrlVistas->Freeze();
269
 
                        try{
270
 
                                wxWindowDisabler disabler;
271
 
                                GNC::GCS::Ptr<GNKVisualizator::VisualizatorStudy> estudio = new GNKVisualizator::VisualizatorStudy();
272
 
                                estudio->OpenedSeries.insert(estudio->OpenedSeries.begin(), pkSeries.begin(), pkSeries.end());
273
 
                                estudio->Module = this;
274
 
                                estudio->hangingProtocol = hangingProtocol;
275
 
                                estudio->ParentWindow = pVentanaPadre;
276
 
                                estudio->InitializeContext(*pkSeries.begin());
277
 
                                pVista = new GNKVisualizator::Vista2D(estudio);
278
 
                                pCtrlVistas->Registrar(pVista);
279
 
                        }
280
 
                        catch(GNC::GCS::VistaException &ex){
281
 
                                if (pVista != NULL) {
282
 
                                        pCtrlVistas->Destruir(pVista);
283
 
                                }
284
 
                                pCtrlVistas->Thaw();
285
 
                                wxString mensaje = wxString::FromUTF8(ex.GetCause().c_str());
286
 
                                wxMessageDialog dialogo( m_pEntorno->GetVentanaRaiz(), mensaje, _("Error opening study"),  wxOK | wxICON_INFORMATION);
287
 
                                dialogo.ShowModal();
288
 
                                return NULL;
289
 
                        }
290
 
                        catch (...) {
291
 
                                if (pVista != NULL) {
292
 
                                        pCtrlVistas->Destruir(pVista);
293
 
                                }
294
 
                                pCtrlVistas->Thaw();
295
 
                                wxMessageDialog dialogo( m_pEntorno->GetVentanaRaiz(), _("Error opening study"), _("Error opening study"),  wxOK | wxICON_INFORMATION);
296
 
                                dialogo.ShowModal();
297
 
                                return NULL;
298
 
                        }
299
 
                        pCtrlVistas->Thaw();
300
 
                }//fin deshabilitacion
301
 
                if (pVista == NULL ) {
302
 
                        pCtrlVistas->Freeze();
303
 
                        pCtrlVistas->Destruir(pVista);
304
 
                        pCtrlVistas->Thaw();
305
 
                        return NULL;
306
 
                }
307
 
                else {
308
 
                        m_pEntorno->GetControladorCarga()->CargaAsincrona(pVista);
309
 
                }
 
294
                {//comienza la deshabilitacion
 
295
                        pVentanaPadre = pCtrlVistas->GetRootWindow();
 
296
                        pCtrlVistas->Freeze();
 
297
                        try{
 
298
                                if (hangingProtocol.IsValid() && !hangingProtocol->getLayouts().empty())  {
 
299
                                        for (GNC::GCS::HangingProtocol::TListOfLayouts::const_iterator it = hangingProtocol->getLayouts().begin(); it != hangingProtocol->getLayouts().end(); ++it)
 
300
                                        {
 
301
                                                pVista = OpenMedicalImageViewer(pkSeries, pVentanaPadre, m_pEntorno, this, (*it));
 
302
                                        }
 
303
                                } else {
 
304
                                        pVista = OpenMedicalImageViewer(pkSeries, pVentanaPadre, m_pEntorno, this, NULL);
 
305
                                }
 
306
                                
 
307
                        }
 
308
                        catch(GNC::GCS::VistaException &ex){
 
309
                                if (pVista != NULL) {
 
310
                                        pCtrlVistas->Destruir(pVista);
 
311
                                }
 
312
                                pCtrlVistas->Thaw();
 
313
                                wxString mensaje = wxString::FromUTF8(ex.GetCause().c_str());
 
314
                                wxMessageDialog dialogo( m_pEntorno->GetVentanaRaiz(), mensaje, _("Error opening study"),  wxOK | wxICON_INFORMATION);
 
315
                                dialogo.ShowModal();
 
316
                                return NULL;
 
317
                        }
 
318
                        catch (...) {
 
319
                                if (pVista != NULL) {
 
320
                                        pCtrlVistas->Destruir(pVista);
 
321
                                }
 
322
                                pCtrlVistas->Thaw();
 
323
                                wxMessageDialog dialogo( m_pEntorno->GetVentanaRaiz(), _("Error opening study"), _("Error opening study"),  wxOK | wxICON_INFORMATION);
 
324
                                dialogo.ShowModal();
 
325
                                return NULL;
 
326
                        }
 
327
                        pCtrlVistas->Thaw();
 
328
                }//fin deshabilitacion
310
329
        }
311
330
        else if (m_ListaModos[modo]->GetDescripcion() == _Std("Waveform viewer") && !pkSeries.empty()) 
312
331
        {
363
382
        return pVista;
364
383
}
365
384
 
366
 
 
367
 
 
368
385
bool GNKVisualizator::ControladorAtencionPrimaria::SoportaImportacion() const
369
386
{
370
387
        return m_pEntorno->GetControladorPermisos()->Get("atencionprimaria", "dicomizador");