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 const std::string & getInternalTitle() const
Returns the internal title.
static DisplayController * instance()
Returns the pointer to the singleton instance.
The base class for the PlotterBase hierarchy.
std::string m_z_label
The attribute name for Z axis label.
virtual void setZMargin(double z)
An NTupleProjector is a projector that projects data from an DataSource object.
A base class of XML element controllers.
PlotterBase * createPlotter(const XmlElement *element)
Creates the plotter object from the XML element.
AxisModelXML class interface.
XmlElement * createElement(const TransformBase &view)
Returns a newly created XmlElement with attributes set for view.
virtual TransformBase * createObject(const XmlElement *element)
Creates an object derived from TransformBase.
void createAxisModels(const XmlElement *element, PlotterBase *plotter)
Re-creates AxisModelBase objects from the XML element.
AxisLoc getLabelLocation() const
A class that is does XML serialization and de-serialization of derived classes of TupleCut...
This Singleton class maintains a list of plotters.
A class XML creation and parsing of XmlElement for Transform class.
A abstract base class for font handling.
void setAttributes(XmlElement &tag, const AxisModelBase &plotter)
Sets the attributes of the XmlElement tag from information in the AxisModel object plotter...
void createCutChildren(XmlElement &, const CutPlotter &plotter)
Creates the child elements for the special case when the plotter is a derived class of CutPlotter...
void createChildren(XmlElement &, const PlotterBase &)
Creates the children elements.
XmlElement class interface.
int handleTextPlotter(const XmlElement *element, TextPlotter *plotter)
Handles the TextPlotter special attributes from the XML element.
virtual int getID() const =0
Returns the ID of the element, if it has one.
size_t ci_find(const string &str1, const string &str2)
Case insensitive find.
A singleton class that is the interface between GUI and the displays.
void setParentDataRep(hippodraw::DataRep *)
Sets the target DataRep of its own TextDataRep object.
virtual AxisModelBase * getAxisModel(Axes::Type axis) const
Returns the AxisModelBase derived class for the specified axis.
A Plotter class that plots one-dimensional TupleCut values.
TupleCutXML class interface.
bool isLog(const XmlElement *element)
Returns true if the element represents an axis model that is on a logarithmic scale.
A Plotter class that plots one-dimensional TupleCut values.
~PlotterBaseXML()
The destructor.
bool areDataSourcesSaved(const PlotterBase *)
Returns true if all the NTuple Objects used by the plotter are save to or read from a file...
Type convert(const std::string &axis)
Converts from string representation ot Axes::Type representation.
std::string m_axis
The attribute name of labeling an axis for the AxisModelBase elements.
virtual FontBase * labelFont(Axes::Type axes) const
What font is being used to override the default while drawing axis label.
TextPlotter class interface.
hippodraw::XyPlotter class interface
void setId(XmlElement &tag, int id)
Sets the unique identification of the object.
Given a range, calculates a model for an axis with a log scale.
A Plotter class that plots points in 2 dimensions and option a third dimension in color...
XmlController class interface.
PlotterBaseXML class interface.
void setCuts(const std::vector< const TupleCut * > &cuts)
Sets the TupleCut objects to be used by this plotter.
virtual PlotterBase * getObject(const XmlElement *element)
Returns the PlotterBase object represented by the element.
virtual PlotterBase * getParentPlotter() const
Returns the parent plotter.
const TupleCut * getTupleCut(int ref_id)
Returns pointer to the TupleCut from the xml reference Id.
A transform that transforms coordinates from one coordinate system to another.
static XmlDocument * m_xml_doc
The current document being generated or read.
void addDataRep(PlotterBase *plotter, DataRep *rep)
Adds DataRep rep to the PlotterBase plotter.
void handleCutPlotter(const XmlElement *element, CutPlotter *plotter)
Handles the Cut attributes from the XML element.
virtual TransformBase * getTransform() const
Returns the transform object used by the plotter.
A singleton class is the interface between an application and the list of FunctionRep objects contain...
void setTarget(DataRep *rep)
Sets the target for the FunctionRep.
static PlotterFactory * instance()
Returns the pointer to the singleton instance.
DisplayController class interface declaration.
void getCutTargets(const XmlElement *element, CutPlotter *plotter)
Searches for and connects up the target DataRep objects of the plotter.
std::string m_x_label
The attribute name for X axis label.
DataRep * getDataRep(int ref)
Returns a pointer to the DataRep from the xml reference Id.
A pure virtual base class of XML element wrapper.
A derived class of DataRep which is a base class for displaying a function.
A base class that is the interface between GUI and the XML serialization and deserialization.
hippodraw::NTupleProjector class interface
void createTextChildren(XmlElement &, const TextPlotter &plotter)
Creates the child elements for the special case when the plotter is a TextPlotter.
hippodraw::FunctionRep class interface
An xception class that is thrown when attempting to bind a DataRep to a NTuple with a column name tha...
Cut1DPlotter class interface.
PyArray_TYPES type(numeric::array arr)
hippodraw::DataRepXML class interface
const std::string & name() const
Returns the name of the plotter.
static FunctionController * instance()
Returns the pointer to the singleton instance.
A singleton class that is does XML serialization and de-serialization of derived classes of RepBase...
virtual XmlElement * getNode(const std::string &tagName) const =0
Returns the single direct child element node with name tagName.
void createFontElements(XmlElement &tag, const XyPlotter &plotter)
Creates all the font elements, if needed.
virtual const std::string & getInternalLabel(Axes::Type axis) const
Returns the internal label.
XmlElement * createElement(const hippodraw::DataRep &rep)
Returns a newly created XML element with its attributes set.
virtual void setTransform(TransformBase *)
Sets the transform object.
std::string m_pindex
The attribute name used to save and restore index of parent DataRep.
FontXML * m_font
The FontXML instance used by this object.
AxisLoc getScaleLocation() const
const std::vector< TupleCut > & getCuts() const
Returns the list of TupleCut objects used by this plotter.
An exception class that is thrown when the factory fails to find the request class by its name...
virtual void setBottomMargin(double bottom)
TupleCutXML * m_tuple_cut_xml
The TupleCutXML instance used by this object.
AxisModelLog class interface.
void createFontObjects(const XmlElement *, PlotterBase *plotter)
Creates the FontBase objects, if any.
A PlotterBase derived class that serves a base class for cut plotters.
void handleFunction(const XmlElement *element, hippodraw::DataRep *rep)
Handles the DataRep object if it is FunctionRep.
DataRepXML * m_datarep
The DataRepXML instance used by this object.
virtual void setLeftMargin(double left)
virtual XmlElement * createElement(const std::string &tagName)=0
Creates a new DOM element wrapper object and returns a pointer to it.
std::string m_title
The attribute name for the plot title.
const std::list< DataRep * > & getCutTargets() const
Get the list of targets.
PointRepXML class interface.
virtual const FontBase * titleFont() const
What font is being used to override the default while drawing title of plot.
XmlDocument class interface.
virtual DataRep * getDataRep(int index) const
Returns the specified DataRep or null pointer if it doesn't exits.
hippodraw::FunctionController class interface
The base class for data representations.
const hippodraw::DataRep * getParentDataRep() const
Returns the target DataRep of its own TextDataRep object.
XmlElement * createElement()
Creates a new element node.
A class that is does XML serialization and deserialization of derived classes of FontBase.
virtual void setEnableZ(bool yes=true)
Enables the Z axis, if plotter has one.
A class that is does XML serialization and de-serialization of derived classes of DataRep...
hippodraw::TupleCut class interface
hippodraw::Cut2DPlotter class interface
bool areDataSourcesSaved(const PlotterBase &plotter)
Returns true if all the NTuple objects used by the plotter are save to or read from a file...
const XmlElement * getNode(const XmlElement *element) const
Returns the single child node of element of the type that can be handled by this object.
virtual int getNumDataReps() const
Returns the number of DataRep objects contained in the plot.
TransformXML class interface.
void addCutTarget(DataRep *rep)
Adds a DataRep to the list of targets.
A Plotter class that draws text.
virtual int getParentDataRepIndex() const
Returns the index of the parent DataRep.
AxisLoc
The base class for the binner hierarchy.
AxisModelXML * m_axismodel
The AxisModelXML instance used by this object.
hippodraw::Axes::Type getAxis(const XmlElement *element, const std::string &tagname)
Returns the Axis attribute value.
virtual void setTopMargin(double top)
Set and get additional margin on top,bottom,left of the plotter.
The AxisModelBase class maintains the Range and scaling of an axis.
virtual void setAxisModel(AxisModelBase *, Axes::Type)=0
Sets the AxisModel on the specified axis.
virtual void appendChild(const XmlNode &child)=0
Appends a child element to the element.
The namespace for conversion to string.
virtual bool hasAxis(Axes::Type axis) const
Returns true if the plotter has an axis of specified type.
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...
Type * create(const std::string &name)
Creates a new object from a prototype named name.
PointRepXML * m_pointrep
The PointRepXML instance used by this object.
TransformXML * m_transform_xml
The TransfromXML instance used by this object.
virtual bool attribute(const std::string &name, bool &value) const =0
Sets value to the attribute name's value.
XmlController * m_controller
The singleton XML controller object.
void createAxisModel(XmlElement &, const PlotterBase &, hippodraw::Axes::Type axis)
Creates an axis model child element for the specified axis.
std::string m_y_label
The attribute name for Y axis label.
The class expresses a cut on a DataSource, i.e.
const std::string m_type
The attribute name for the type of object.
A class that is does XML serialization and de-serialization of derived classes of AxisModelBase with ...
void createFontElement(XmlElement &tag, const XyPlotter &plotter, hippodraw::Axes::Type axis)
Creates an element for label font.
PlotterBaseXML(const PlotterBaseXML &)
A private copy constructor in order to avoid copying.
The base class for the Projector hierarchy.
virtual void setAttribute(const std::string &name, bool value)=0
Sets attribute named name to the int value value.
virtual void fillNodeList(const std::string &tagName, std::list< XmlElement * > &nodeList) const =0
Fills the nodeList with elements with tag name tagName.