#include <VisRoot/VisRootBrowser/interface/VisHtmlRootBrowser.h>
Public Member Functions | |
void | browse (IgRepresentable *object) |
Begin browsing the object. | |
QByteArray | getJPGBuffer (void) |
void | modelChanged (VisRootModelEvent event) |
VisHtmlRootBrowser (IgState *state, IgSite *site, VisRootModel *model=0) | |
Static Public Member Functions | |
static const char * | catalogLabel (void) |
Private Attributes | |
TCanvas * | m_canvas |
VisRootModel * | m_model |
IgState * | m_state |
Definition at line 23 of file VisHtmlRootBrowser.h.
VisHtmlRootBrowser::VisHtmlRootBrowser | ( | IgState * | state, | |
IgSite * | site, | |||
VisRootModel * | model = 0 | |||
) |
Definition at line 29 of file VisHtmlRootBrowser.cc.
References ASSERT, VisRootModel::canvas(), VisRootModel::dispatcher(), m_canvas, m_model, and VisRootModel::ModelChanged.
00032 : m_state (state), 00033 m_canvas (new TCanvas ()), 00034 m_model (0) 00035 { 00036 if (!m_model) 00037 m_model = new VisRootModel (state); 00038 m_canvas->SetBatch (true); 00039 00040 m_model->canvas (m_canvas); 00041 VisRootModel::Dispatcher *modelDispatcher = 00042 m_model->dispatcher (VisRootModel::ModelChanged); 00043 00044 ASSERT (modelDispatcher); 00045 00046 }
void VisHtmlRootBrowser::browse | ( | IgRepresentable * | object | ) | [virtual] |
Begin browsing the object.
The implementation must represent object in all its models. object (its representation, that is) may then be made the current selection of this and all other browsers in the same IgSession as this browser. This last step should be implemented by broadcasting a IgSelectMessage on the session IgSelectionService; the browser itself can simply respond to the message as it is delivered to it.
object | The object to visualise. Even though the object is not const , the browser should not assume it can change it. All non-editor browsers should treat the object purely as const . Editors should treat the object as const as long as possible, preferably until the user explicitly requests the object to be changed. Thus, editors should make changes only to the representation until it is clear that the user is committed to making the changes to the object, too. |
Implements IgBrowser.
Definition at line 49 of file VisHtmlRootBrowser.cc.
References ASSERT, IgRepSet::lookup(), and m_model.
Referenced by VisWebRootService::browse().
00050 { 00051 // FIXME: can we just depend on model change event? 00052 VisRootRep *rep = dynamic_cast <VisRootRep *> ( 00053 IgRepSet::lookup (object, m_model, true)); 00054 00055 ASSERT (rep); 00056 }
const char * VisHtmlRootBrowser::catalogLabel | ( | void | ) | [static] |
QByteArray VisHtmlRootBrowser::getJPGBuffer | ( | void | ) |
Definition at line 65 of file VisHtmlRootBrowser.cc.
References ASSERT, VisRootModel::canvas(), f, EgammaValidation_cff::filename, lat::UUID::format(), lat::UUID::generateRandom(), and m_model.
Referenced by VisWebRootService::browse().
00066 { 00067 lat::UUID uuid = lat::UUID::generateRandom (); 00068 char *uuidBuffer = new char [37]; 00069 uuid.format (uuidBuffer); 00070 std::string filename (uuidBuffer); 00071 delete[] uuidBuffer; 00072 00073 m_model->canvas ()->SaveAs ((filename + ".jpg").c_str ()); 00074 00075 QFile f ((filename + ".jpg").c_str ()); 00076 ASSERT (f.exists ()); 00077 00078 bool opened = f.open (IO_ReadOnly); 00079 ASSERT (opened); 00080 00081 QByteArray tmpArray = f.readAll (); 00082 ASSERT (! tmpArray.isEmpty ()); 00083 f.remove (); 00084 return tmpArray; 00085 }
void VisHtmlRootBrowser::modelChanged | ( | VisRootModelEvent | event | ) |
TCanvas* VisHtmlRootBrowser::m_canvas [private] |
VisRootModel* VisHtmlRootBrowser::m_model [private] |
Definition at line 38 of file VisHtmlRootBrowser.h.
Referenced by browse(), getJPGBuffer(), and VisHtmlRootBrowser().
IgState* VisHtmlRootBrowser::m_state [private] |
Definition at line 36 of file VisHtmlRootBrowser.h.