1
/* This file is part of MAUS: http://micewww.pp.rl.ac.uk/projects/maus
3
* MAUS is free software: you can redistribute it and/or modify
4
* it under the terms of the GNU General Public License as published by
5
* the Free Software Foundation, either version 3 of the License, or
6
* (at your option) any later version.
8
* MAUS is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with MAUS. If not, see <http://www.gnu.org/licenses/>.
20
#include "TRootEmbeddedCanvas.h"
23
#include "src/common_cpp/Utils/Exception.hh"
24
#include "src/common_cpp/DataStructure/ImageData/CanvasWrapper.hh"
27
CanvasWrapper::CanvasWrapper() : _description(""), _canvas(NULL) {
30
CanvasWrapper::CanvasWrapper(const CanvasWrapper& data) : _canvas(NULL) {
34
CanvasWrapper& CanvasWrapper::operator=(const CanvasWrapper& rhs) {
37
_description = rhs._description;
40
if (rhs._canvas != NULL) {
41
_canvas = static_cast<TCanvas*>(rhs._canvas->Clone());
48
CanvasWrapper::~CanvasWrapper() {
53
void CanvasWrapper::SetCanvas(TCanvas* canvas) {
59
void CanvasWrapper::EmbedCanvas(TRootEmbeddedCanvas* embed) {
61
throw Exception(Exception::recoverable, "EmbeddedCanvas was NULL",
62
"CanvasWrapper::EmbedCanvas");
64
if (_canvas == NULL) {
65
throw Exception(Exception::recoverable, "Trying to adopt NULL canvas",
66
"CanvasWrapper::EmbedCanvas");
68
embed->AdoptCanvas(_canvas);
69
_canvas = NULL; // embed now owns the memory