74
89
m_pParent = pParent;
75
90
m_fileSpecs = fileSpecs;
77
93
~DropTargetSelectImages()
97
void SetEnable(bool enabled) {
80
101
bool OnDropFiles(wxCoord /*x*/, wxCoord /*y*/, const wxArrayString& filenames)
82
105
wxArrayString images;
83
std::list<std::string> listaPaths;
84
106
for(wxArrayString::const_iterator it = filenames.begin(); it!= filenames.end(); it++)
86
108
if(wxDirExists((*it))) {
87
//se leen los ficheros dicom del directorio
89
if (dir.Open((*it))) {
90
for (std::list<std::string>::iterator itSpecs = m_fileSpecs.begin(); itSpecs != m_fileSpecs.end(); ++itSpecs) {
92
bool cont = dir.GetFirst(&wxPathFich, wxString::FromUTF8((*itSpecs).c_str()));
94
wxPathFich=dir.GetName()+ wxFileName::GetPathSeparator(wxPATH_NATIVE) +wxPathFich;
95
images.push_back(wxPathFich);
96
cont = dir.GetNext(&wxPathFich);
99
#if !defined(_WINDOWS)
100
for (std::list<std::string>::iterator itSpecs = m_fileSpecs.begin(); itSpecs != m_fileSpecs.end(); ++itSpecs) {
102
bool cont = dir.GetFirst(&wxPathFich, wxString::FromUTF8((*itSpecs).c_str()).Upper());
104
wxPathFich=dir.GetName()+ wxFileName::GetPathSeparator(wxPATH_NATIVE) +wxPathFich;
105
images.push_back(wxPathFich);
106
cont = dir.GetNext(&wxPathFich);
109
m_pParent->ScanPath((*it));
111
110
} else if(wxFileExists((*it))){
112
111
wxFileName filename((*it));
113
112
wxString extensionFile = filename.GetExt().Lower();
127
126
SelectImagesImportation* m_pParent;
128
127
std::list<std::string> m_fileSpecs;
132
SelectImagesImportation::SelectImagesImportation(wxWindow* pParent,std::string& dirTemp, IWizard* pWizard, bool reescalar, GnkPtr<GIL::IModeloIntegracion>& pModeloIntegracion, const std::list<std::string>& fileSpecs, const wxString& defaultFilter) : SelectImagesImportationBase(pParent), IPasoWizard(pWizard)
130
/////////////////////////////////////////////////////TIMER DIRECTORY
131
class TimerDirectory: public wxTimer {
133
TimerDirectory(SelectImagesImportation* pSelectImages)
135
m_pSelectImages = pSelectImages;
142
void SetPath(const std::string& path, bool monitorize)
144
m_path = wxString::FromUTF8(path.c_str());
145
m_monitorize = monitorize;
148
virtual void Notify()
151
if (m_pSelectImages->ScanPath(m_path)) {
152
this->Start(1000, true);
154
wxMessageBox(_("Path of the location doesn't exists"), _("Info"), wxOK | wxICON_INFORMATION, m_pSelectImages);
157
m_pSelectImages->AddImage(m_path);
164
SelectImagesImportation* m_pSelectImages;
168
////////////////////////////////////////////////////////
170
SelectImagesImportation::SelectImagesImportation(wxWindow* pParent,std::string& dirTemp, IWizard* pWizard, GnkPtr<GIL::IModeloIntegracion>& pModeloIntegracion, const std::list<std::string>& fileSpecs, const wxString& defaultFilter) : SelectImagesImportationBase(pParent), IPasoWizard(pWizard)
134
172
SetScrollbars(10, 10, 50, 50, 0, 0, false);
135
173
AdjustScrollbars();
136
174
m_firstAttach = true;
175
m_pwxImagePreview = new wxImage();
138
std::list<std::string> m_fileSpecs = fileSpecs;
177
m_fileSpecs = fileSpecs;
139
178
if (defaultFilter.IsEmpty()) {
140
179
#if defined(_WIN32) || defined(__WXMAC__)
141
180
m_pDefaultFilter =_("Images (*.jpg;*.jpeg;*.bmp;*.png;*.tif;*.tiff)|*.jpg;*.jpeg;*.bmp;*.png;*.tif;*.tiff|JPEG Images (*.jpg;*.jpeg)|*.jpg;*.jpeg|BMP Images (*.bmp)|*.bmp|PNG Images (*.png)|*.png|TIFF Images (*.tif;*.tiff)|*.tif;*.tiff|All files(*.*)|*.*");
170
208
for (GNC::GCS::IEntorno::MapaUbicaciones::iterator it = mapa.begin(); it != mapa.end(); it++) {
171
209
GIL::Ubicacion& u = (*it).second;
173
m_pButtonsBar->AddTool(idButton, wxString::FromUTF8(u.Titulo.c_str()), GinkgoResourcesManager::IconosMenus::GetIcoImportar(), wxString::FromUTF8(u.Descripcion.c_str()));
211
m_pButtonsBar->AddTool(idButton, wxString::FromUTF8(u.Titulo.c_str()), GinkgoResourcesManager::IconosMenus::GetIcoImportar(), wxString::FromUTF8(u.Descripcion.c_str()), wxITEM_CHECK);
174
212
m_pButtonsBar->Connect(idButton++, wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler(SelectImagesImportation::OnUbicacionClick), NULL, this);
177
215
m_pButtonsBar->Realize();
178
216
m_pSizerButtons->Add(m_pButtonsBar, 1, wxEXPAND| wxALL, 0);
180
m_pImagenes->SetDropTarget(new DropTargetSelectImages(this, m_fileSpecs));
218
ButtonsBar* pToolPreview = new ButtonsBar(m_pPreviewPanel, barColor, fontBar);
219
pToolPreview->AddTool(ID_BUTTON_HIDE,_("Back"), GinkgoResourcesManager::Adquisicion::GetIcoAdquirirArchivo(),_("Back"));
220
pToolPreview->Connect(ID_BUTTON_HIDE,wxEVT_COMMAND_TOOL_CLICKED, wxCommandEventHandler( SelectImagesImportation::OnHidePreview),NULL,this);
222
pToolPreview->Realize();
223
m_pPreviewPanel->GetSizer()->Insert(0,pToolPreview,0,wxEXPAND);
224
m_pPreviewPanel->Layout();
182
226
m_pImagenes->Connect(wxEVT_COMMAND_THUMBNAIL_LEFT_DCLICK,wxCommandEventHandler(SelectImagesImportation::OnThumbLeftDClickSelected),NULL,this);
227
m_pImagenes->Connect(wxEVT_COMMAND_THUMBNAIL_RIGHT_CLICK,wxCommandEventHandler(SelectImagesImportation::OnThumbRightClickSelected),NULL,this);
183
228
m_pImagenes->Connect(wxEVT_KEY_DOWN, wxKeyEventHandler(SelectImagesImportation::OnImagenesKeyDown),NULL,this);
230
m_pTimerDirectory = new TimerDirectory(this);
231
m_pDropTarget = new DropTargetSelectImages(this, m_fileSpecs);
232
m_pImagenes->SetDropTarget(m_pDropTarget);
185
234
m_panelStep0->Layout();
194
243
SelectImagesImportation::~SelectImagesImportation()
245
if (m_pTimerDirectory != NULL) {
246
delete m_pTimerDirectory;
247
m_pTimerDirectory = NULL;
249
GIL::Ubicacion* pUbicacion = GetUbicacionSelected();
250
if (pUbicacion != NULL && pUbicacion->CleanAfter) {
251
/*//remove content from ubicacion directory...
253
wxArrayString paths=this->GetSelectedPaths();
254
for (wxArrayString::iterator it = paths.begin(); it != paths.end(); ++it) {
258
if (m_pwxImagePreview != NULL)
260
delete m_pwxImagePreview;
261
m_pwxImagePreview = NULL;
196
263
m_pImagenes->Disconnect(wxEVT_COMMAND_THUMBNAIL_LEFT_DCLICK,wxCommandEventHandler(SelectImagesImportation::OnThumbLeftDClickSelected),NULL,this);
197
264
m_pImagenes->Disconnect(wxEVT_KEY_DOWN, wxKeyEventHandler(SelectImagesImportation::OnImagenesKeyDown),NULL,this);
200
void SelectImagesImportation::OnThumbLeftDClickSelected(wxCommandEvent& event)
202
while(m_pImagenes->GetSelection()!=-1){
203
m_pImagenes->Delete(m_pImagenes->GetSelection());
208
267
void SelectImagesImportation::OnImagenesKeyDown(wxKeyEvent &event)
210
269
if (event.GetKeyCode() == WXK_DELETE || event.GetKeyCode() == WXK_BACK) {
211
while(m_pImagenes->GetSelection()!=-1){
212
m_pImagenes->Delete(m_pImagenes->GetSelection());
270
DeleteSelectedThumbnails();
214
271
event.Skip(false);
218
275
event.Skip(true);
279
void SelectImagesImportation::OnDeleteSelectedThumbnails(wxCommandEvent &)
281
DeleteSelectedThumbnails();
284
void SelectImagesImportation::DeleteSelectedThumbnails()
286
bool deleteFromDisk = false;
287
///if monitoring... ask
288
GIL::Ubicacion* pUbicacion = GetUbicacionSelected();
289
if (pUbicacion != NULL) {
290
if (pUbicacion->Monitorize) {
291
int answer = wxMessageBox(_("Are you sure to delete this file from disk?"),_("Delete"), wxYES_NO , this);
292
if (answer == wxYES) {
293
deleteFromDisk = true;
299
while(m_pImagenes->GetSelection()!=-1){
300
if (deleteFromDisk) {
301
wxThumbnailItem* item = m_pImagenes->GetItem(m_pImagenes->GetSelection());
303
wxRemoveFile(item->GetFilename());
306
m_pImagenes->Delete(m_pImagenes->GetSelection());
310
void SelectImagesImportation::OnPreviewClick(wxCommandEvent &)
315
void SelectImagesImportation::OnThumbLeftDClickSelected(wxCommandEvent& event)
321
void SelectImagesImportation::OnThumbRightClickSelected(wxCommandEvent& event)
324
wxArrayInt selection = m_pImagenes->GetSelections();
325
if (selection.size() == 0) {
330
wxMenuItem* pRotateLeft = new wxMenuItem(&contextual, ID_BUTTON_DELETE, _("Delete selected items"));
331
contextual.Connect(ID_BUTTON_DELETE, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( SelectImagesImportation::OnDeleteSelectedThumbnails),NULL,this);
332
contextual.Append(pRotateLeft);
333
m_pImagenes->PopupMenu(&contextual);
337
void SelectImagesImportation::ShowPreview()
339
// Si hacemos doble click ampliamos la imagen para una mejor visualizacion
340
if (m_pImagenes->GetSelections().size() != 1)
342
wxMessageBox(_("You must select an image"), _("Info"), wxOK | wxICON_INFORMATION, this);
346
wxBusyInfo info(_("Generating preview..."));
347
wxThumbnailItem* item = m_pImagenes->GetItem(m_pImagenes->GetSelection());
353
m_pPreviewPanel->Show();
354
m_pButtonsBar->Hide();
355
m_pPreview->SetFocus();
356
m_pButtonRemoveAll->Hide();
357
m_pButtonPreview->Hide();
360
wxString pathTmp = item->GetFilename();
361
m_pwxImagePreview->LoadFile(pathTmp);
363
vtkSmartPointer<vtkImageData> data = vtkSmartPointer<vtkImageData>::New();
364
double spacing[3] = {1.0f,1.0f,1.0f};
365
double origin[3] = {0.0f,0.0f,0.0f};
367
data->SetDimensions(m_pwxImagePreview->GetWidth(), m_pwxImagePreview->GetHeight(), 1);
368
data->SetNumberOfScalarComponents(3);
369
data->SetScalarTypeToUnsignedChar();
370
data->SetSpacing(spacing[0],spacing[1],spacing[2]);
371
data->SetOrigin(origin[0],origin[1],origin[2]);
373
vtkSmartPointer<vtkUnsignedCharArray> dataImagen = vtkSmartPointer<vtkUnsignedCharArray>::New();
374
dataImagen->SetNumberOfComponents(3);
375
unsigned int size = data->GetDimensions()[0] * data->GetDimensions()[1];
376
dataImagen->SetArray(m_pwxImagePreview->GetData(),size,1);
378
data->GetPointData()->SetScalars(dataImagen);
380
m_pPreview->SetInput(data);
381
m_pPreview->GetView()->SetInteractionStyle(vtkGinkgoImageViewer::ZOOM_WITH_SELECT_INTERACTION);
384
m_panelStep0->Layout();
385
m_panelStep0->Refresh();
389
void SelectImagesImportation::OnHidePreview(wxCommandEvent& )
394
void SelectImagesImportation::HidePreview()
396
if (!m_pImagenes->IsShown())
400
m_pPreviewPanel->Hide();
401
m_pButtonRemoveAll->Show();
402
m_pButtonPreview->Show();
403
m_pButtonsBar->Show();
405
m_panelStep0->Layout();
406
m_panelStep0->Refresh();
222
411
void SelectImagesImportation::OnRemoveAll(wxCommandEvent &event){
223
m_pImagenes->Clear();
412
m_pImagenes->SelectAll();
413
DeleteSelectedThumbnails();
227
417
void SelectImagesImportation::OnSelectFiles(wxCommandEvent & )
232
void SelectImagesImportation::AddImage() {
420
m_pDropTarget->SetEnable(true);
421
m_pTimerDirectory->Stop();
233
422
std::string pathDefecto;
234
423
GNC::GCS::ConfigurationController::Instance()->readStringUser("/GinkgoCore/Importacion", "PathDefecto", pathDefecto);
235
424
wxString wxPathDefecto = wxString::FromUTF8(pathDefecto.c_str());
283
472
pItem = new wxImageThumbnailItem(fileName);
285
474
m_pImagenes->Insert( pItem, m_pImagenes->GetCount());
290
wxArrayString SelectImagesImportation::GetSelectedPaths(){
480
bool SelectImagesImportation::ScanPath(const wxString& path)
482
//se leen los ficheros dicom del directorio
483
if (!wxDirExists(path)) {
488
if (dir.Open(path)) {
489
wxArrayString images;
490
for (std::list<std::string>::iterator itSpecs = m_fileSpecs.begin(); itSpecs != m_fileSpecs.end(); ++itSpecs) {
492
bool cont = dir.GetFirst(&wxPathFich, wxString::FromUTF8((*itSpecs).c_str()));
494
wxPathFich=dir.GetName()+ wxFileName::GetPathSeparator(wxPATH_NATIVE) +wxPathFich;
495
images.push_back(wxPathFich);
496
cont = dir.GetNext(&wxPathFich);
499
#if !defined(_WINDOWS)
500
for (std::list<std::string>::iterator itSpecs = m_fileSpecs.begin(); itSpecs != m_fileSpecs.end(); ++itSpecs) {
502
bool cont = dir.GetFirst(&wxPathFich, wxString::FromUTF8((*itSpecs).c_str()).Upper());
504
wxPathFich=dir.GetName()+ wxFileName::GetPathSeparator(wxPATH_NATIVE) +wxPathFich;
505
images.push_back(wxPathFich);
506
cont = dir.GetNext(&wxPathFich);
515
wxArrayString SelectImagesImportation::GetSelectedPaths()
291
517
wxArrayString resultado;
292
518
for(int i=0;i<m_pImagenes->GetCount();++i){
293
519
wxThumbnailItem* item=dynamic_cast<wxThumbnailItem*>(m_pImagenes->GetItem(i));
298
524
return resultado;
527
void SelectImagesImportation::UnCheckAll()
529
for (int i = 1; i < m_pButtonsBar->GetToolCount(); i++) {
530
//uncheck ubicaciones
531
m_pButtonsBar->ToggleTool(i, false);
533
m_pButtonsBar->Refresh(true);
301
536
void SelectImagesImportation::OnUbicacionClick(wxCommandEvent& event)
303
538
int id = event.GetId();
541
m_pTimerDirectory->Stop();
542
m_pDropTarget->SetEnable(true);
544
GNC::GCS::IEntorno::MapaUbicaciones& mapa = GNC::Entorno::Instance()->GetUbicaciones();
545
GNC::GCS::IEntorno::MapaUbicaciones::iterator it = mapa.begin();
546
for (int i = 1; i != id && it != mapa.end(); i++, ++it);
547
if ((*it).second.Monitorize && !m_pButtonsBar->GetToolToggled(id)) {
548
//if uncheck a monitorize change to normal mode
550
m_pTimerDirectory->Stop();
551
m_pDropTarget->SetEnable(true);
553
SetUbicacion(&(*it).second, id);
558
void SelectImagesImportation::SetUbicacion(GIL::Ubicacion* ubicacion, int id)
561
m_pTimerDirectory->Stop();
562
m_pButtonsBar->ToggleTool(id, true);
563
if (!ubicacion->Monitorize) {
564
m_pDropTarget->SetEnable(true);
565
m_pTimerDirectory->SetPath(ubicacion->Ruta, false);
567
m_pDropTarget->SetEnable(false);
568
m_pImagenes->Clear();
569
m_pTimerDirectory->SetPath(ubicacion->Ruta,true);
571
if (ubicacion->CleanBefore) {
573
if (dir.Open(FROMPATH(ubicacion->Ruta))) {
575
bool cont = dir.GetFirst(&fileName);
577
fileName=dir.GetName()+ wxFileName::GetPathSeparator(wxPATH_NATIVE) +fileName;
578
if(wxFile::Exists(fileName)){
579
if (wxRemoveFile(fileName)) {
580
cont = dir.GetNext(&fileName);
588
m_pTimerDirectory->Start(100, true);
591
GIL::Ubicacion* SelectImagesImportation::GetUbicacionSelected()
304
593
GNC::GCS::IEntorno::MapaUbicaciones& mapa = GNC::Entorno::Instance()->GetUbicaciones();
305
594
GNC::GCS::IEntorno::MapaUbicaciones::iterator it = mapa.begin();
306
for (int i = 1; i != id && it != mapa.end(); i++, ++it);
307
GIL::Ubicacion& u = (*it).second;
308
wxString pathUbicacionWx = wxString::FromUTF8(u.Ruta.c_str());
309
AddImage(pathUbicacionWx);
595
for (int i = 1; i < m_pButtonsBar->GetToolCount() && it != mapa.end(); i++, ++it) {
596
if (m_pButtonsBar->GetToolToggled(i)) {
597
return &(*it).second;
312
603
//region "Metodos heredados de Ipasowizard"
314
605
void SelectImagesImportation::Attach(wxSizer *sizer){
315
606
if (m_firstAttach) {
316
wxCommandEvent openDialogEvent(wxEVT_COMMAND_TOOL_CLICKED, 0);
317
m_pButtonsBar->AddPendingEvent(openDialogEvent);
607
//maybe an ubication, maybe a normal path...
608
std::string lastLocation;
609
GNC::GCS::ConfigurationController::Instance()->readStringUser("/GinkgoCore/Importacion", "LastLocation", lastLocation);
610
GNC::GCS::IEntorno::MapaUbicaciones& mapa = GNC::Entorno::Instance()->GetUbicaciones();
611
GNC::GCS::IEntorno::MapaUbicaciones::iterator it = mapa.begin();
613
for (; id < m_pButtonsBar->GetToolCount() && it != mapa.end(); id++, ++it) {
614
if ((*it).first == lastLocation) {
618
if (it == mapa.end()) {
619
//opens select file dialog...
620
wxCommandEvent openDialogEvent(wxEVT_COMMAND_TOOL_CLICKED, 0);
621
m_pButtonsBar->AddPendingEvent(openDialogEvent);
623
SetUbicacion(&(*it).second, id);
318
625
m_firstAttach = false;
628
GIL::Ubicacion* pUbicacion = GetUbicacionSelected();
629
if (pUbicacion != NULL && pUbicacion->Monitorize) {
630
m_pTimerDirectory->Start(100,true);
321
633
sizer->Add(this, 1, wxEXPAND);
322
634
this->GetParent()->Layout();
325
637
void SelectImagesImportation::Detach(wxSizer *sizer){
638
m_pTimerDirectory->Stop();
327
640
sizer->Detach(this);
328
641
sizer->GetContainingWindow()->Layout();
359
678
m_pListaFicheros->clear();
361
wxString wxDirTemp = FROMPATH(m_dirTemp);
363
int dims[2] = {-1,-1};
364
//dimensiones del mas grande
365
GNC::GCS::Vector vectorMaximo(-1.0,-1.0);
366
GNC::GCS::Vector vectorOrigen(0.0,0.0);
368
bool redimensionar = false;
370
//se leen las imagenes para ver que tengan la misma dimension
371
for(wxArrayString::iterator it=paths.begin();it!=paths.end();++it){
372
if(!wxFileName::FileExists((*it))){
373
wxString str(_("The file"));
374
wxMessageBox(str <<(*it) <<_(" doesn't exist"), _("Info"),
375
wxOK | wxICON_INFORMATION, this);
376
m_pListaFicheros->clear();
377
//el fichero no existe
679
GIL::Ubicacion* pUbicacion = GetUbicacionSelected();
681
if (pUbicacion != NULL) {
682
GNC::GCS::ConfigurationController::Instance()->writeStringUser("/GinkgoCore/Importacion", "LastLocation", pUbicacion->Titulo);
684
GNC::GCS::ConfigurationController::Instance()->deleteEntryUser("/GinkgoCore/Importacion", "LastLocation");
688
for(wxArrayString::iterator it=paths.begin();it!=paths.end();++it){
689
if(!wxFileName::FileExists((*it))){
690
wxString str(_("The file"));
691
wxMessageBox(str <<(*it) <<_(" doesn't exist"), _("Info"),
692
wxOK | wxICON_INFORMATION, this);
693
m_pListaFicheros->clear();
694
//el fichero no existe
698
wxString wxDirTmp = FROMPATH(m_dirTemp);
699
wxFileName fileName((*it));
700
//if files will be cleaned at the end, we have to copy it in temporally folder
701
if (pUbicacion != NULL && pUbicacion->CleanAfter) {
702
wxString nombreImagenTemporal = wxDirTmp + wxFileName::GetPathSeparator() + fileName.GetName() + wxString::Format(wxT("%d"),rand()) + wxT(".jpg");
703
while(wxFile::Exists(nombreImagenTemporal))
383
if(dims[0]==-1 && dims[1]==-1){
384
dims[0]=img.GetWidth();
385
dims[1]=img.GetHeight();
386
vectorMaximo.x =(double) std::max<double>(img.GetWidth(),img.GetHeight());
387
vectorMaximo.y =(double) std::min<double>(img.GetWidth(),img.GetHeight());
389
if(!( (dims[0] == img.GetWidth() && dims[1] == img.GetHeight()) || (dims[1] == img.GetWidth() && dims[0] == img.GetHeight()) )){
390
redimensionar = true;
391
GNC::GCS::Vector v1((double)std::max<double>(img.GetWidth(),img.GetHeight()),(double)std::min<double>(img.GetWidth(),img.GetHeight()));
392
if(!v1.DentroDeBoundingBox(vectorOrigen,vectorMaximo)){
393
vectorMaximo.x = std::max<double>(vectorMaximo.x,v1.x);
394
vectorMaximo.y = std::max<double>(vectorMaximo.y,v1.y);
399
wxFileName fileName((*it));
400
std::string path(TOPATH((*it)));
401
m_pListaFicheros->push_back(path);
403
wxString str(_("The file"));
404
wxMessageBox(str <<(*it) <<_(" couldn't be readed"), _("Info"),
405
wxOK | wxICON_INFORMATION, this);
406
m_pListaFicheros->clear();
411
//por ultimo si hay que redimensionar se redimensionan proporcionalmente y se rellena con negros
412
if (redimensionar && m_reescalar){
413
int answer = wxMessageBox(_("All images must have the same dimensions.\nDo you want to continue resizing the images to the size of the largest?"),_("Different dimensions between images"), wxYES_NO , this);
414
if (answer == wxNO) {
415
m_pListaFicheros->clear();
416
//el fichero no existe
419
wxBusyInfo infoDlg(_("Scaling images, may take a while ..."), this);
420
for(ListaFicheros::iterator it = m_pListaFicheros->begin(); it!= m_pListaFicheros->end(); it++){
421
wxImage img(FROMPATH((*it)));
422
if(!( (vectorMaximo.x == img.GetWidth() && vectorMaximo.y == img.GetHeight()) || (vectorMaximo.x == img.GetWidth() && vectorMaximo.y == img.GetHeight()) )){
423
//primero se rescala proporcionalmente
425
if(img.GetHeight() > img.GetWidth()){
426
scale = (double)vectorMaximo.x / img.GetHeight();
428
scale = (double)vectorMaximo.x / img.GetWidth();
430
img = img.Rescale(img.GetWidth()*scale,img.GetHeight()*scale,wxIMAGE_QUALITY_HIGH);
431
//se cambia el tamaño hasta el maximo
432
if(img.GetHeight() > img.GetWidth()){
433
wxPoint punto((vectorMaximo.y / 2) - ((float)img.GetWidth()/2),0);
434
img = img.Resize(wxSize(vectorMaximo.y,vectorMaximo.x),punto,0,0,0);
436
wxPoint punto(0,(vectorMaximo.y / 2) - ((float)img.GetHeight()/2));
437
img = img.Resize(wxSize(vectorMaximo.x,vectorMaximo.y),punto,0,0,0);
440
wxFileName fileName(FROMPATH((*it)));
441
wxString nombreImagenTemporal = wxDirTemp + wxFileName::GetPathSeparator() + fileName.GetName() + wxString::Format(wxT("%d"),rand()) + wxT(".jpg");
442
while(wxFile::Exists(nombreImagenTemporal))
444
//si existe se busca uno que no exista
445
nombreImagenTemporal= wxDirTemp + wxFileName::GetPathSeparator() + fileName.GetName() + wxString::Format(wxT("%d"),rand()) + wxT(".jpg");
447
img.SetOption(wxIMAGE_OPTION_QUALITY,100);
448
img.SaveFile(nombreImagenTemporal);
449
(*it) = TOPATH(nombreImagenTemporal);
456
for(wxArrayString::iterator it=paths.begin();it!=paths.end();++it){
457
if(!wxFileName::FileExists((*it))){
458
wxString str(_("The file"));
459
wxMessageBox(str <<(*it) <<_(" doesn't exist"), _("Info"),
460
wxOK | wxICON_INFORMATION, this);
461
m_pListaFicheros->clear();
462
//el fichero no existe
466
wxFileName fileName((*it));
705
//si existe se busca uno que no exista
706
nombreImagenTemporal= wxDirTmp + wxFileName::GetPathSeparator() + fileName.GetName() + wxString::Format(wxT("%d"),rand()) + wxT(".jpg");
708
wxCopyFile((*it), nombreImagenTemporal);
709
std::string path(TOPATH(nombreImagenTemporal));
710
m_pListaFicheros->push_back(path);
467
712
std::string path(TOPATH((*it)));
468
713
m_pListaFicheros->push_back(path);