void gqbView::SaveAsImage(const wxString &fileName, wxBitmapType imgType) { updateModelSize(NULL, true); if (modelSize.GetWidth() == 0 || modelSize.GetHeight() == 0) { wxMessageBox(_("Nothing to be saved!"), _("Save As an image"), wxOK | wxICON_INFORMATION); return; } int width = 0, height = 0; GetVirtualSize(&width, &height); /* * Create the bitmap from the Explain window */ wxMemoryDC memDC; wxBitmap tempBitmap(width, height); memDC.SelectObject(tempBitmap); memDC.Clear(); // Draw the diagram on the bitmap (Memory Device Context) drawAll(memDC, false); memDC.SelectObject(wxNullBitmap); if (!tempBitmap.SaveFile(fileName, imgType)) { wxLogError(_("Could not write the file %s: Errcode=%d."), fileName.c_str(), wxSysErrorCode()); } }
bool gqbView::canSaveAsImage() { updateModelSize(NULL, true); return !(modelSize.GetWidth() == 0 || modelSize.GetHeight() == 0); }
void gqbView::OnRefresh(wxCommandEvent &ev) { updateModelSize(NULL, true); this->Update(); }
void gqbView::OnSize(wxSizeEvent &event) { updateModelSize(NULL, true); }
void bimWorld::CameraManipulator::updateModelSize() { auto manip = dynamic_cast<bimWorld::BIMCameraManipulator*>(getCameraManipulator()); manip->updateModelSize(); }