30#include "wx/busyinfo.h"
96 vigra::BRGBImage* preview=
new vigra::BRGBImage();
97 vigra::BImage* mask =
new vigra::BImage();
98 vigra::ImageImportInfo::ICCProfile iccProfile;
116 vigra::copyImage(vigra::srcImageRange(*preview), vigra::destImage(*
scaledPreview, offset));
117 vigra::copyImage(vigra::srcImageRange(*mask), vigra::destImage(*
scaledMask, offset));
144 return (wxThread::ExitCode)0;
152#define THUMBNAIL_SIZE 128
174 wxXmlResource::Get()->LoadDialog(
this,
parent,
"browse_pto_dialog");
222 int width =
config->Read(wxString::Format(
"/BrowsePTODialog/ColumnWidth%d",
j), -1);
223 if (width != -1 && width > 5)
242 wxCommandEvent
event;
263 config->Write(wxString::Format(
"/BrowsePTODialog/ColumnWidth%d",
j),
m_listCtrl->GetColumnWidth(
j));
278 if (index >= 0 && index <
m_ptoInfo.size())
332 if (!activeImages.empty())
353 if (!
img0.getExifDate().empty())
363 imgs.erase(imgs.begin());
364 for (
const auto& img : imgs)
376 if (info.
start.IsValid())
394 if (info.
start.IsValid())
429 if (info.
start.IsValid())
467 SetTitle(wxString::Format(
_(
"Browse project files in %s"),
m_dirCtrl->GetPath().c_str()));
473 for (
size_t i = 0;
i < files.size(); ++
i)
500 if (e.GetIndex() >= 0)
516 const int newCol = e.GetColumn();
553 const int index = e.GetInt();
575 if (e.GetSelection() == 0)
604 if (index >= 0 && index <
m_ptoInfo.size())
657#define SORTASCENDING(functionName, var) \
658int wxCALLBACK functionName(wxIntPtr item1, wxIntPtr item2, wxIntPtr sortData)\
660 std::vector<PanoInfo>* data = (std::vector<PanoInfo>*)(sortData);\
661 return GreaterComparisonOperator(data->at(item1).var, data->at(item2).var);\
663#define SORTDESCENDING(functionName, var) \
664int wxCALLBACK functionName(wxIntPtr item1, wxIntPtr item2, wxIntPtr sortData)\
666 std::vector<PanoInfo>* data = (std::vector<PanoInfo>*)(sortData);\
667 return SmallerComparisonOperator(data->at(item1).var, data->at(item2).var);\
687#define SORTASCENDING(functionName, var) \
688int wxCALLBACK functionName(wxIntPtr item1, wxIntPtr item2, wxIntPtr sortData)\
690 std::vector<PanoInfo>* data = (std::vector<PanoInfo>*)(sortData);\
691 return data->at(item1).var.CmpNoCase(data->at(item2).var);\
693#define SORTDESCENDING(functionName, var) \
694int wxCALLBACK functionName(wxIntPtr item1, wxIntPtr item2, wxIntPtr sortData)\
696 std::vector<PanoInfo>* data = (std::vector<PanoInfo>*)(sortData);\
697 return -(data->at(item1).var.CmpNoCase(data->at(item2).var));\
710 std::vector<PanoInfo>* data = (std::vector<PanoInfo>*)(
sortData);
718 std::vector<PanoInfo>* data = (std::vector<PanoInfo>*)(
sortData);
727 std::vector<PanoInfo>* data = (std::vector<PanoInfo>*)(
sortData);
728 if (data->at(
item1).start.IsLaterThan(data->at(
item2).start))
732 if (data->at(
item1).start.IsEarlierThan(data->at(
item2).start))
741 std::vector<PanoInfo>* data = (std::vector<PanoInfo>*)(
sortData);
742 if (data->at(
item1).start.IsEarlierThan(data->at(
item2).start))
746 if (data->at(
item1).start.IsLaterThan(data->at(
item2).start))
756 std::vector<PanoInfo>* data = (std::vector<PanoInfo>*)(
sortData);
757 if (data->at(
item1).duration.IsLongerThan(data->at(
item2).duration))
761 if (data->at(
item1).duration.IsShorterThan(data->at(
item2).duration))
770 std::vector<PanoInfo>* data = (std::vector<PanoInfo>*)(
sortData);
771 if (data->at(
item1).duration.IsShorterThan(data->at(
item2).duration))
775 if (data->at(
item1).duration.IsLongerThan(data->at(
item2).duration))
941 wxThread::This()->Sleep(1);
954 vigra::BRGBImage preview;
956 vigra::ImageImportInfo::ICCProfile iccProfile;
959 wxImage image(preview.width(), preview.height(), (
unsigned char*)preview.data(), (
unsigned char*)mask.data(),
true);
int wxCALLBACK SortDateAscending(wxIntPtr item1, wxIntPtr item2, wxIntPtr sortData)
int GreaterComparisonOperator(const Type &a, const Type &b)
int SmallerComparisonOperator(const Type &a, const Type &b)
wxDEFINE_EVENT(wxEVT_COMMAND_THUMBNAILTHREAD_UPDATE, wxCommandEvent)
int wxCALLBACK SortDateDesending(wxIntPtr item1, wxIntPtr item2, wxIntPtr sortData)
wxDECLARE_EVENT(wxEVT_COMMAND_THUMBNAILTHREAD_UPDATE, wxCommandEvent)
int wxCALLBACK SortFieldOfViewDescending(wxIntPtr item1, wxIntPtr item2, wxIntPtr sortData)
#define SORTDESCENDING(functionName, var)
#define SORTASCENDING(functionName, var)
int wxCALLBACK SortDurationAscending(wxIntPtr item1, wxIntPtr item2, wxIntPtr sortData)
options wxIntPtr wxIntPtr sortData
options getSize().area()) int wxCALLBACK SortFieldOfViewAscending(wxIntPtr item1
int wxCALLBACK SortDurationDesending(wxIntPtr item1, wxIntPtr item2, wxIntPtr sortData)
Definition of dialog to browse directory with pto files.
bool GenerateThumbnail(const std::string pto_filename, const wxSize size, vigra::BRGBImage &panoImage, vigra::BImage &panoMask, vigra::ImageImportInfo::ICCProfile &iccProfile)
generate thumbnail image for given pto_filename
generate thumbnail from given pto file
Dialog for browsing pto files.
friend class ThumbnailThread
void OnShowOnMap(wxCommandEvent &e)
show current pano on Openstreetmap
wxString GetSelectedPath()
return last selected path
BrowsePTOFilesDialog(wxWindow *parent, const wxString startDirectory)
Constructor, read from xrc ressource; restore last uses settings and position.
void GeneratePreview(int index)
generate preview for pto file with index
void OnDirectoryChanged(wxTreeEvent &e)
directory changed, load files from new directory
std::vector< PanoInfo > m_ptoInfo
info about the pto file
wxSplitterWindow * m_splitter2
wxStaticText * m_labelControl
void UpdateItemTexts(long newStyle)
update all item texts
ThumbnailThread * m_thumbnailThread
background thumbnail creater thread
void FillPanoInfo(const PanoInfo &info, long index)
add a new item to wxListCtrl and populate all columns
void OnThumbnailUpdate(wxCommandEvent &e)
for notifing from ThumbnailThread about new generated thumbnail generated thumbnail is transfered in ...
wxImageList m_thumbnails
image list with all thumbnails
void OnListMouseMove(wxMouseEvent &e)
mouse move handler to update tooltips
wxGenericDirCtrl * m_dirCtrl
wxString GetSelectedProject()
return full path of selected project
void OnFileChanged(wxListEvent &e)
new file selected, generate preview for new file
long TranslateIndex(const long index)
translate the index to the index of m_ptoInfo
void EndThumbnailThread()
end background thumbnail creating thread
void SortItems()
sort the items according to selected column
void OnListColClick(wxListEvent &e)
click on header to sort by column
~BrowsePTOFilesDialog()
destructor, saves position
wxStaticBitmap * m_previewCtrl
void OnListTypeChanged(wxCommandEvent &e)
Change display of wxListCtrl.
void OnDblClickListCtrl(wxMouseEvent &e)
double click does open file
wxSplitterWindow * m_splitter1
PanoInfo ParsePTOFile(const wxFileName file)
read the given pto file and add all information to wxListCtrl
wxCriticalSection m_ThreadCS
critical section to synchronize with ThumbnailThread
void OnOk(wxCommandEvent &e)
Saves current expression when closing dialog with Ok.
unsigned int getWidth() const
PanoramaOptions::ProjectionFormat getProjection() const
unsigned int getHeight() const
get panorama height
const PanoramaOptions & getOptions() const
returns the options for this panorama
bool ReadPTOFile(const std::string &filename, const std::string &prefix="")
read pto file from the given filename into Panorama object it does some checks on the file and issues...
SrcPanoImage getSrcImage(unsigned imgNr) const
get a description of a source image
UIntSet getActiveImages() const
get active images
std::size_t getNrOfImages() const
number of images.
All variables of a source image.
static double calcFocalLength(SrcPanoImage::Projection proj, double hfov, double crop, vigra::Size2D imageSize)
calcualte focal length, given crop factor and hfov
bool readEXIF()
try to fill out information about the image, by examining the exif data
static MainFrame * Get()
hack.. kind of a pseudo singleton...
class to store some information about a pto file on disc
HuginBase::PanoramaOptions options
wxString focalLengthString
helper class to transfer thumbnail data from worker thread to GUI thread
wxImage * GetwxImage() const
ThreadImage(vigra::BRGBImage *thumbnail, vigra::BImage *mask)
vigra::BRGBImage * m_preview
background thread to generate thumbnails of all pto files
BrowsePTOFilesDialog * m_parentDialog
ThumbnailThread(BrowsePTOFilesDialog *parentDialog, const wxArrayString &fileList, const wxSize size)
bool HasMonitorProfile() const
return true if we found a suitable monitor profile and could loading it
static huginApp * Get()
hack.. kind of a pseudo singleton...
void CorrectImage(wxImage &image, const vigra::ImageImportInfo::ICCProfile &iccProfile, const cmsHPROFILE &monitorProfile)
apply color correction to given image using input iccProfile and monitor profile
std::set< unsigned int > UIntSet
WXIMPEX wxString GetFormattedTimeSpan(const wxTimeSpan &timeSpan)
bool FileExists(const std::string &filename)
checks if file exists
bool stringToDouble(const STR &str_, double &dest)
convert a string to a double, ignore localisation.
void StoreFramePosition(wxTopLevelWindow *frame, const wxString &basename, const bool ignoreMaximize)
std::string getPathPrefix(const std::string &filename)
Get the path to a filename.
void RestoreFramePosition(wxTopLevelWindow *frame, const wxString &basename, const bool ignoreMaximize)
std::vector< deghosting::BImagePtr > threshold(const std::vector< deghosting::FImagePtr > &inputImages, const double threshold, const uint16_t flags)
Threshold function used for creating alpha masks for images.