void Template::switchTemplateFile(const QString& new_path, bool load_file) { if (template_state == Loaded) { setTemplateAreaDirty(); unloadTemplateFile(); } template_path = new_path; template_file = QFileInfo(new_path).fileName(); template_relative_path = QString(); template_state = Template::Unloaded; if (load_file) loadTemplateFile(false); }
bool Template::configureAndLoad(QWidget* dialog_parent, MapView* view) { bool center_in_view = true; if (!preLoadConfiguration(dialog_parent)) return false; if (!loadTemplateFile(true)) return false; if (!postLoadConfiguration(dialog_parent, center_in_view)) { unloadTemplateFile(); return false; } // If the template is not georeferenced, position it at the viewport midpoint if (!isTemplateGeoreferenced() && center_in_view) { auto offset = MapCoord { calculateTemplateBoundingBox().center() }; setTemplatePosition(view->center() - offset); } return true; }
OgrTemplate::~OgrTemplate() { if (template_state == Loaded) unloadTemplateFile(); }
TemplateImage::~TemplateImage() { if (template_state == Loaded) unloadTemplateFile(); }
TemplateTrack::~TemplateTrack() { if (template_state == Loaded) unloadTemplateFile(); }