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