14 #include "msdevstudio/MSconfig.h" 56 :
BaseXML (
"PlotterBase", controller ),
59 m_x_label (
"xlabel" ),
60 m_y_label (
"ylabel" ),
61 m_z_label (
"zlabel" ),
110 = dynamic_cast <
const XyPlotter & > ( plotter );
118 if ( transform != 0 ) {
125 for (
int i = 0; i < number; i++ ) {
138 = dynamic_cast <
const CutPlotter & > ( plotter );
147 if ( plotter.
name() ==
"TextPlotter" ) {
150 = dynamic_cast <
const TextPlotter & > ( plotter );
163 const vector < TupleCut > & cuts = plotter.
getCuts ();
164 for (
unsigned int i = 0; i < cuts.size (); i++ ) {
170 const list < DataRep * > & targets = plotter.
getCutTargets ();
171 #ifdef ITERATOR_MEMBER_DEFECT 174 list < DataRep * >::const_iterator first = targets.begin();
176 for ( ; first != targets.end(); ++first ) {
178 const void * addr = reinterpret_cast <
const void * > ( rep );
195 const void * addr = reinterpret_cast <
const void * > ( rep );
213 const string t (
"t" );
214 element -> setAttribute (
m_axis, t );
215 m_font -> setAttributes ( *element, *font );
220 for (
unsigned int i = 0; i < 3; i++ ) {
251 element -> setAttribute (
m_axis, s );
252 m_font -> setAttributes ( *element, *font );
266 if ( model == 0 )
return;
279 element -> setAttribute (
m_axis, tmp );
288 const void * addr = reinterpret_cast <
const void * > ( & plotter );
299 tag -> setAttribute (
m_title, title );
300 tag -> setAttribute (
m_x_label, x_label );
301 tag -> setAttribute (
m_y_label, y_label );
302 tag -> setAttribute (
m_z_label, z_label );
306 const void * addr = reinterpret_cast <
const void * > ( parent );
308 tag -> setAttribute (
"ref", ref );
310 tag -> setAttribute (
m_pindex, index );
322 if ( plotter == 0 )
return 0;
325 if ( element != 0 ) {
333 list < XmlElement * > nodelist;
339 #ifdef ITERATOR_MEMBER_DEFECT 342 list < XmlElement * > ::const_iterator first = nodelist.begin ();
343 for ( ; first != nodelist.end(); ++first ) {
345 int id = element->
getID ();
348 string what (
"Unable to find data representation" );
358 if ( cutplotter != 0 ) {
359 cutplotter -> addTupleCut ( rep );
364 if ( textplotter != 0 ) {
377 list < XmlElement * > nodelist;
379 if ( nodelist.empty () == false ) {
383 list < XmlElement * > ::const_iterator first = nodelist.begin ();
385 while ( first != nodelist.end () ) {
388 m_font -> setAttributes ( element, font );
391 xypl -> setTitleFont ( font );
394 xypl -> setLabelFont ( font, axis );
404 list < XmlElement * > nodelist;
406 if ( nodelist.empty () == false ) {
408 #ifdef ITERATOR_MEMBER_DEFECT 411 list < XmlElement * > :: const_iterator first = nodelist.begin();
412 for ( ; first != nodelist.end (); ++first ) {
415 if ( axis ==
Axes::Z ) plotter -> setEnableZ (
true );
422 std::swap ( tmp, model );
438 bool has_Z = type ==
"XYColorPlotter";
439 if ( type ==
"XYPlotter" ||
440 type ==
"XYColorPlotter" ) {
446 plotter = factory->
create ( type );
448 int id = element -> getID ();
454 ok = element -> attribute (
m_title, value );
455 plotter -> setTitle ( value );
459 ok = element -> attribute (
m_x_label, value );
460 plotter -> setLabel (
Axes::X, value );
464 ok = element -> attribute (
m_y_label, value );
465 plotter -> setLabel (
Axes::Y, value );
469 ok = element -> attribute (
m_z_label, value );
470 plotter -> setLabel (
Axes::Z, value );
475 ok = element -> attribute (
m_pindex, index );
477 plotter -> setParentDataRepIndex ( index );
491 list < XmlElement * > nodelist;
493 if ( nodelist.empty() )
return;
495 #ifdef ITERATOR_MEMBER_DEFECT 498 list < XmlElement * > :: const_iterator first = nodelist.begin();
499 for ( ; first != nodelist.end(); ++first ) {
501 int ref = element->
getID ();
508 const vector < TupleCut > & cuts = plotter -> getCuts ();
509 for (
unsigned int i = 0; i < cuts.size(); i++ ) {
510 projector -> addCut ( &cuts[i] );
512 target -> setDirty (
true );
524 if ( frep == 0 )
return;
527 int id = element->
getID ();
540 vector < const TupleCut * > cuts;
543 list < XmlElement * > node_list;
545 list < XmlElement * >::const_iterator first = node_list.begin();
547 while ( first != node_list.end() ) {
551 element -> attribute (
"axis", a );
553 const string & label = plotter -> getLabel ( axis );
555 int id = element->
getID ();
558 tc -> setLabel ( label );
559 cuts.push_back ( tuplecut );
561 if ( tuplecut != 0 ) {
562 cuts.push_back ( tuplecut );
576 int id = element->
getID ();
virtual bool attribute(const std::string &name, bool &value) const =0
Sets value to the attribute name's value.
TupleCutXML class interface.
static DisplayController * instance()
Returns the pointer to the singleton instance.
virtual PlotterBase * getParentPlotter() const
Returns the parent plotter.
XmlController * m_controller
The singleton XML controller object.
A Plotter class that plots one-dimensional TupleCut values.
Given a range, calculates a model for an axis with a log scale.
void fillNodeList(const XmlElement *element, std::list< XmlElement * > &nodelist)
Fills the nodelist with immediate child nodes of element with nodes that can be handled by this objec...
A abstract base class for font handling.
Cut1DPlotter class interface.
hippodraw::NTupleProjector class interface
A base class that is the interface between GUI and the XML serialization and deserialization.
void handleCutPlotter(const XmlElement *element, CutPlotter *plotter)
Handles the Cut attributes from the XML element.
TransformXML class interface.
void createFontObjects(const XmlElement *, PlotterBase *plotter)
Creates the FontBase objects, if any.
static XmlDocument * m_xml_doc
The current document being generated or read.
AxisModelXML class interface.
hippodraw::XyPlotter class interface
int handleTextPlotter(const XmlElement *element, TextPlotter *plotter)
Handles the TextPlotter special attributes from the XML element.
virtual PlotterBase * getObject(const XmlElement *element)
Returns the PlotterBase object represented by the element.
void handleFunction(const XmlElement *element, hippodraw::DataRep *rep)
Handles the DataRep object if it is FunctionRep.
std::string m_title
The attribute name for the plot title.
virtual void setBottomMargin(double bottom)
const TupleCut * getTupleCut(int ref_id)
Returns pointer to the TupleCut from the xml reference Id.
std::string m_z_label
The attribute name for Z axis label.
A base class of XML element controllers.
TupleCutXML * m_tuple_cut_xml
The TupleCutXML instance used by this object.
const std::vector< TupleCut > & getCuts() const
Returns the list of TupleCut objects used by this plotter.
A Plotter class that plots one-dimensional TupleCut values.
const XmlElement * getNode(const XmlElement *element) const
Returns the single child node of element of the type that can be handled by this object.
const std::string m_type
The attribute name for the type of object.
TextPlotter class interface.
virtual void setAxisModel(AxisModelBase *, Axes::Type)=0
Sets the AxisModel on the specified axis.
void addDataRep(PlotterBase *plotter, DataRep *rep)
Adds DataRep rep to the PlotterBase plotter.
AxisModelLog class interface.
virtual int getNumDataReps() const
Returns the number of DataRep objects contained in the plot.
XmlElement * createElement(const hippodraw::DataRep &rep)
Returns a newly created XML element with its attributes set.
virtual const std::string & getInternalTitle() const
Returns the internal title.
A singleton class that is the interface between GUI and the displays.
virtual void setLeftMargin(double left)
DataRep * getDataRep(int ref)
Returns a pointer to the DataRep from the xml reference Id.
PointRepXML class interface.
void setCuts(const std::vector< const TupleCut * > &cuts)
Sets the TupleCut objects to be used by this plotter.
void setAttributes(XmlElement &tag, const AxisModelBase &plotter)
Sets the attributes of the XmlElement tag from information in the AxisModel object plotter...
A Plotter class that draws text.
std::string m_pindex
The attribute name used to save and restore index of parent DataRep.
const std::string & name() const
Returns the name of the plotter.
void createFontElements(XmlElement &tag, const XyPlotter &plotter)
Creates all the font elements, if needed.
hippodraw::FunctionRep class interface
DataRepXML * m_datarep
The DataRepXML instance used by this object.
FontXML * m_font
The FontXML instance used by this object.
The base class for data representations.
The namespace for conversion to string.
PlotterBaseXML class interface.
hippodraw::TupleCut class interface
void createCutChildren(XmlElement &, const CutPlotter &plotter)
Creates the child elements for the special case when the plotter is a derived class of CutPlotter...
A class that is does XML serialization and deserialization of derived classes of FontBase.
bool areDataSourcesSaved(const PlotterBase *)
Returns true if all the NTuple Objects used by the plotter are save to or read from a file...
virtual int getParentDataRepIndex() const
Returns the index of the parent DataRep.
void createChildren(XmlElement &, const PlotterBase &)
Creates the children elements.
hippodraw::FunctionController class interface
Type * create(const std::string &name)
Creates a new object from a prototype named name.
void createAxisModels(const XmlElement *element, PlotterBase *plotter)
Re-creates AxisModelBase objects from the XML element.
virtual void setAttribute(const std::string &name, bool value)=0
Sets attribute named name to the int value value.
Type convert(const std::string &axis)
Converts from string representation ot Axes::Type representation.
static FunctionController * instance()
Returns the pointer to the singleton instance.
bool areDataSourcesSaved(const PlotterBase &plotter)
Returns true if all the NTuple objects used by the plotter are save to or read from a file...
A class XML creation and parsing of XmlElement for Transform class.
The base class for the PlotterBase hierarchy.
virtual FontBase * labelFont(Axes::Type axes) const
What font is being used to override the default while drawing axis label.
TransformXML * m_transform_xml
The TransfromXML instance used by this object.
virtual void setTopMargin(double top)
Set and get additional margin on top,bottom,left of the plotter.
virtual void setEnableZ(bool yes=true)
Enables the Z axis, if plotter has one.
AxisLoc
The base class for the binner hierarchy.
PyArray_TYPES type(numeric::array arr)
DisplayController class interface declaration.
void addCutTarget(DataRep *rep)
Adds a DataRep to the list of targets.
static PlotterFactory * instance()
Returns the pointer to the singleton instance.
virtual void setTransform(TransformBase *)
Sets the transform object.
void setTarget(DataRep *rep)
Sets the target for the FunctionRep.
The base class for the Projector hierarchy.
virtual const FontBase * titleFont() const
What font is being used to override the default while drawing title of plot.
A pure virtual base class of XML element wrapper.
XmlDocument class interface.
AxisLoc getScaleLocation() const
void createFontElement(XmlElement &tag, const XyPlotter &plotter, hippodraw::Axes::Type axis)
Creates an element for label font.
An NTupleProjector is a projector that projects data from an DataSource object.
An exception class that is thrown when the factory fails to find the request class by its name...
A transform that transforms coordinates from one coordinate system to another.
This Singleton class maintains a list of plotters.
A PlotterBase derived class that serves a base class for cut plotters.
A class that is does XML serialization and de-serialization of derived classes of AxisModelBase with ...
virtual XmlElement * createElement(const std::string &tagName)=0
Creates a new DOM element wrapper object and returns a pointer to it.
const std::list< DataRep *> & getCutTargets() const
Get the list of targets.
void getCutTargets(const XmlElement *element, CutPlotter *plotter)
Searches for and connects up the target DataRep objects of the plotter.
const hippodraw::DataRep * getParentDataRep() const
Returns the target DataRep of its own TextDataRep object.
A singleton class is the interface between an application and the list of FunctionRep objects contain...
XmlController class interface.
virtual XmlElement * getNode(const std::string &tagName) const =0
Returns the single direct child element node with name tagName.
A class that is does XML serialization and de-serialization of derived classes of DataRep...
PlotterBase * createPlotter(const XmlElement *element)
Creates the plotter object from the XML element.
void createAxisModel(XmlElement &, const PlotterBase &, hippodraw::Axes::Type axis)
Creates an axis model child element for the specified axis.
XmlElement * createElement(const TransformBase &view)
Returns a newly created XmlElement with attributes set for view.
A Plotter class that plots points in 2 dimensions and option a third dimension in color...
AxisLoc getLabelLocation() const
bool isLog(const XmlElement *element)
Returns true if the element represents an axis model that is on a logarithmic scale.
hippodraw::DataRepXML class interface
PlotterBaseXML(const PlotterBaseXML &)
A private copy constructor in order to avoid copying.
hippodraw::Axes::Type getAxis(const XmlElement *element, const std::string &tagname)
Returns the Axis attribute value.
void setParentDataRep(hippodraw::DataRep *)
Sets the target DataRep of its own TextDataRep object.
void createTextChildren(XmlElement &, const TextPlotter &plotter)
Creates the child elements for the special case when the plotter is a TextPlotter.
hippodraw::Cut2DPlotter class interface
PointRepXML * m_pointrep
The PointRepXML instance used by this object.
An xception class that is thrown when attempting to bind a DataRep to a NTuple with a column name tha...
A singleton class that is does XML serialization and de-serialization of derived classes of RepBase...
virtual TransformBase * getTransform() const
Returns the transform object used by the plotter.
size_t ci_find(const string &str1, const string &str2)
Case insensitive find.
void setId(XmlElement &tag, int id)
Sets the unique identification of the object.
virtual const std::string & getInternalLabel(Axes::Type axis) const
Returns the internal label.
std::string m_axis
The attribute name of labeling an axis for the AxisModelBase elements.
virtual DataRep * getDataRep(int index) const
Returns the specified DataRep or null pointer if it doesn't exits.
virtual int getID() const =0
Returns the ID of the element, if it has one.
virtual AxisModelBase * getAxisModel(Axes::Type axis) const
Returns the AxisModelBase derived class for the specified axis.
virtual bool hasAxis(Axes::Type axis) const
Returns true if the plotter has an axis of specified type.
std::string m_x_label
The attribute name for X axis label.
XmlElement class interface.
XmlElement * createElement()
Creates a new element node.
std::string m_y_label
The attribute name for Y axis label.
~PlotterBaseXML()
The destructor.
A derived class of DataRep which is a base class for displaying a function.
The AxisModelBase class maintains the Range and scaling of an axis.
virtual void appendChild(const XmlNode &child)=0
Appends a child element to the element.
virtual TransformBase * createObject(const XmlElement *element)
Creates an object derived from TransformBase.
The class expresses a cut on a DataSource, i.e.
AxisModelXML * m_axismodel
The AxisModelXML instance used by this object.
A class that is does XML serialization and de-serialization of derived classes of TupleCut...
virtual void fillNodeList(const std::string &tagName, std::list< XmlElement * > &nodeList) const =0
Fills the nodeList with elements with tag name tagName.
virtual void setZMargin(double z)