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