CMS 3D CMS Logo

VisHtmlRootBrowser Class Reference

#include <VisRoot/VisRootBrowser/interface/VisHtmlRootBrowser.h>

Inheritance diagram for VisHtmlRootBrowser:

IgBrowser

List of all members.

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
VisRootModelm_model
IgStatem_state


Detailed Description

Definition at line 23 of file VisHtmlRootBrowser.h.


Constructor & Destructor Documentation

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 }


Member Function Documentation

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.

Note:
The browser has to create a model and a rep of the object; even simple dummy ones will do. These can be discarded once the other browsers have been notified of the selection change.
See also:
See the class documentation for a more complete description.
Parameters:
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]

Definition at line 26 of file VisHtmlRootBrowser.cc.

00027 { return "HTMLRoot"; }

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  ) 

Definition at line 59 of file VisHtmlRootBrowser.cc.

00060 { 
00061 }


Member Data Documentation

TCanvas* VisHtmlRootBrowser::m_canvas [private]

Definition at line 37 of file VisHtmlRootBrowser.h.

Referenced by VisHtmlRootBrowser().

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.


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:35:29 2009 for CMSSW by  doxygen 1.5.4