30 namespace wxGraphTools
36 m_bitmapControl =
new wxStaticBitmap(
this, wxID_ANY, bitmap);
39 wxBoxSizer* topsizer =
new wxBoxSizer(wxHORIZONTAL);
40 topsizer->Add(m_bitmapControl, wxEXPAND);
41 SetSizerAndFit(topsizer);
51 wxConfigBase* config = wxConfigBase::Get();
52 wxFileDialog dlg(
this,
54 config->Read(wxT(
"/actualPath"), wxT(
"")), wxT(
""),
55 _(
"Bitmap (*.bmp)|*.bmp|PNG-File (*.png)|*.png"),
56 wxFD_SAVE | wxFD_OVERWRITE_PROMPT, wxDefaultPosition);
57 dlg.SetDirectory(config->Read(wxT(
"/actualPath"), wxT(
"")));
58 dlg.SetFilterIndex(config->Read(wxT(
"/lastImageTypeIndex"), 0l));
59 if (dlg.ShowModal() == wxID_OK)
61 config->Write(wxT(
"/actualPath"), dlg.GetDirectory());
62 wxFileName filename(dlg.GetPath());
63 int imageType = dlg.GetFilterIndex();
64 config->Write(wxT(
"/lastImageTypeIndex"), imageType);
65 if (!filename.HasExt())
70 filename.SetExt(wxT(
"png"));
74 filename.SetExt(wxT(
"bmp"));
78 if (filename.FileExists())
80 int d = wxMessageBox(wxString::Format(_(
"File %s exists. Overwrite?"), filename.GetFullPath().c_str()),
81 _(
"Save image"), wxYES_NO | wxICON_QUESTION);
90 m_bitmapControl->GetBitmap().SaveFile(filename.GetFullPath(), wxBITMAP_TYPE_PNG);
94 m_bitmapControl->GetBitmap().SaveFile(filename.GetFullPath(), wxBITMAP_TYPE_BMP);
101 Graph::Graph(
int graphWidth,
int graphHeight, wxColour backgroundColour)
108 m_dc.SetBackground(wxBrush(backgroundColour));
111 m_dc.SetPen(wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT)));
112 m_dc.SetBrush(*wxTRANSPARENT_BRUSH);
121 m_dc.SelectObject(wxNullBitmap);
127 m_dc.DestroyClippingRegion();
147 m_dc.SetPen(wxPen(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT)));
148 for (
size_t i = 0; i < linesX; i++)
153 for (
size_t i = 0; i < linesY; i++)
161 void Graph::DrawLine(std::vector<hugin_utils::FDiff2D> points, wxColour colour,
int penWidth)
163 if (points.size() < 2)
167 wxPoint *polygonPoints =
new wxPoint[points.size()];
168 for (
size_t i = 0; i < points.size(); i++)
173 m_dc.SetPen(wxPen(colour, penWidth));
174 m_dc.DrawLines(points.size(), polygonPoints);
175 delete[]polygonPoints;
197 opts.
setHFOV(srcImage.getHFOV());
204 const double minLength = std::min<double>(srcImage.
getWidth(), srcImage.
getHeight()) / 2.0;
207 Graph graph(300, 200, wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
211 std::vector<hugin_utils::FDiff2D> points;
216 graph.
DrawLine(points, wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT), 1);
220 const double rMaxHorzVert = std::max<double>(srcImage.
getWidth(), srcImage.
getHeight()) / (2.0*minLength);
223 graph.
DrawLine(points, wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT), 1);
227 for (
size_t i = 0; i <
NRPOINTS; i++)
230 if (transform.
transform(x, y, r*minLength, 0))
234 r += maxR / (NRPOINTS - 1);
236 graph.
DrawLine(points, wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT), 2);
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