31 namespace wxGraphTools
37 m_bitmapControl =
new wxStaticBitmap(
this, wxID_ANY, bitmap);
40 wxBoxSizer* topsizer =
new wxBoxSizer(wxHORIZONTAL);
41 topsizer->Add(m_bitmapControl, wxEXPAND);
42 SetSizerAndFit(topsizer);
52 wxConfigBase* config = wxConfigBase::Get();
53 wxFileDialog dlg(GetParent(),
55 config->Read(
"/actualPath", wxEmptyString), wxEmptyString,
56 _(
"Bitmap (*.bmp)|*.bmp|PNG-File (*.png)|*.png"),
57 wxFD_SAVE | wxFD_OVERWRITE_PROMPT, wxDefaultPosition);
58 dlg.SetDirectory(config->Read(
"/actualPath", wxEmptyString));
59 dlg.SetFilterIndex(config->Read(
"/lastImageTypeIndex", 0l));
60 if (dlg.ShowModal() == wxID_OK)
62 config->Write(
"/actualPath", dlg.GetDirectory());
63 wxFileName filename(dlg.GetPath());
64 int imageType = dlg.GetFilterIndex();
65 config->Write(
"/lastImageTypeIndex", imageType);
66 if (!filename.HasExt())
71 filename.SetExt(
"png");
75 filename.SetExt(
"bmp");
79 if (filename.FileExists())
89 m_bitmapControl->GetBitmap().SaveFile(filename.GetFullPath(), wxBITMAP_TYPE_PNG);
93 m_bitmapControl->GetBitmap().SaveFile(filename.GetFullPath(), wxBITMAP_TYPE_BMP);
100 Graph::Graph(
int graphWidth,
int graphHeight, wxColour backgroundColour)
107 m_dc.SetBackground(wxBrush(backgroundColour));
110 m_dc.SetPen(wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT)));
111 m_dc.SetBrush(*wxTRANSPARENT_BRUSH);
120 m_dc.SelectObject(wxNullBitmap);
126 m_dc.DestroyClippingRegion();
146 m_dc.SetPen(wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT)));
147 for (
size_t i = 0; i < linesX; i++)
152 for (
size_t i = 0; i < linesY; i++)
160 void Graph::DrawLine(std::vector<hugin_utils::FDiff2D> points, wxColour colour,
int penWidth)
162 if (points.size() < 2)
166 wxPoint *polygonPoints =
new wxPoint[points.size()];
167 for (
size_t i = 0; i < points.size(); i++)
172 m_dc.SetPen(wxPen(colour, penWidth));
173 m_dc.DrawLines(points.size(), polygonPoints);
174 delete[]polygonPoints;
196 opts.
setHFOV(srcImage.getHFOV());
203 const double minLength = std::min<double>(srcImage.
getWidth(), srcImage.
getHeight()) / 2.0;
206 Graph graph(300, 200, wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
210 std::vector<hugin_utils::FDiff2D> points;
215 graph.
DrawLine(points, wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT), 1);
219 const double rMaxHorzVert = std::max<double>(srcImage.
getWidth(), srcImage.
getHeight()) / (2.0*minLength);
222 graph.
DrawLine(points, wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT), 1);
226 for (
size_t i = 0; i <
NRPOINTS; i++)
229 if (transform.
transform(x, y, r*minLength, 0))
233 r += maxR / (NRPOINTS - 1);
235 graph.
DrawLine(points, wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT), 2);
bool AskUserOverwrite(const wxString &filename, const wxString &caption, wxWindow *parent)
ask user if the given file should be overwritten, return true if the user confirmed the overwritting ...
void setHeight(unsigned int h)
set panorama height
int getHeight() const
Get the height of the image in pixels.
vigra::pair< typename ROIImage< Image, Mask >::image_const_traverser, typename ROIImage< Image, Mask >::ImageConstAccessor > srcImage(const ROIImage< Image, Mask > &img)
int getWidth() const
Get the width of the image in pixels.
void setHFOV(double h, bool keepView=true)
set the horizontal field of view.
include file for the hugin project
All variables of a source image.
void setProjection(ProjectionFormat f)
set the Projection format and adjust the hfov/vfov if nessecary
void setWidth(unsigned int w, bool keepView=true)
set panorama width keep the HFOV, if keepView=true