All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines
Signals | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes
SciFigs::GridViewer Class Reference

A GridViewer is a layer to plot a 2D regular grid. More...

#include <GridViewer.h>

Inheritance diagram for SciFigs::GridViewer:
SciFigs::GridPlot SciFigs::GraphContentLayer QGpGuiTools::PropertyItem QGpCoreTools::XMLClass

List of all members.

Signals

void clicked (int ix, int iy)

Public Member Functions

virtual Rect boundingRect () const
 GridViewer (AxisWindow *parent=0)
virtual bool mouseReleaseEvent (QMouseEvent *e, int)
void setGrid (Grid2D< double > *grid)
virtual bool trackRectangle (int, double rx1, double ry1, double rx2, double ry2, Qt::KeyboardModifiers m)
virtual const QString & xml_tagName () const
 ~GridViewer ()

Static Public Attributes

static const QString xmlGridViewerTag = "GridViewer"

Protected Member Functions

virtual void paintData (const LayerPainterRequest &lp, QPainter &p, double dotpercm) const
virtual XMLMember xml_member (XML_MEMBER_ARGS)
virtual void xml_writeChildren (XML_WRITECHILDREN_ARGS) const

Protected Attributes

Grid2D< double > * _grid

Detailed Description

A GridViewer is a layer to plot a 2D regular grid.


Constructor & Destructor Documentation

References _grid, and TRACE.

                                          :
    GridPlot(parent)
{
  TRACE;
  _grid=new Grid2D<double>;
}

References _grid, and TRACE.

{
  TRACE;
  delete _grid;
}

Member Function Documentation

void SciFigs::GridViewer::clicked ( int  ix,
int  iy 
) [signal]

Referenced by mouseReleaseEvent().

bool SciFigs::GridViewer::mouseReleaseEvent ( QMouseEvent *  e,
int   
) [virtual]
void SciFigs::GridViewer::paintData ( const LayerPainterRequest lp,
QPainter &  p,
double  dotpercm 
) const [protected, virtual]
void SciFigs::GridViewer::setGrid ( Grid2D< double > *  grid)

Sets current grid and takes ownership of grid.

References _grid, and TRACE.

{
  TRACE;
  LayerLocker ll(this);
  delete _grid;
  _grid=grid;
}
bool SciFigs::GridViewer::trackRectangle ( int  ,
double  rx1,
double  ry1,
double  rx2,
double  ry2,
Qt::KeyboardModifiers  m 
) [virtual]

Re-implement this function to offer XML restore (children and properties) support to your class.

From tag and map (with contains the attibute value) return a unique identifier under the format of a XMLMember. XMLMember is initialized with 3 types of contructors:

  • An integer: id number of a property
  • A XMLClass * : a child of this object identified by tag
  • Default constructor: error, unknow child or property

Map of attributes can be inspected in this way (can be achived also in xml_setProperty()):

    static const QString tmp("childrenName");
    XMLRestoreAttributeIterator it=map.find(tmp);
    if(it!=map.end()) {
      // found attribute "childrenName"
    }

If the map of attributes is not used:

    Q_UNUSED(attributes);
    if(tag=="x1") return XMLMember(0);
    else if(tag=="y1") return XMLMember(1);
    else if(tag=="x2") return XMLMember(2);
    else if(tag=="y2") return XMLMember(3);
    else return XMLMember(XMLMember::Unknown);

Arithmetic operations + and - apply to XMLMember to avoid confusion of property id numbers between inherited objects. Offset 3 corresponds to the number of properties defined in this object.

    if(tag=="anInteger") return XMLMember(0);
    else if(tag=="aString") return XMLMember(1);
    else if(tag=="aDouble") return XMLMember(2);
    return AbstractLine::xml_member(tag, attributes, context)+3;

For the arguments of this function use Macro XML_MEMBER_ARGS.

Reimplemented from SciFigs::GridPlot.

References _grid, SciFigs::XMLSciFigs::data(), and TRACE.

{
  TRACE;
  XMLSciFigs * scifigsContext=static_cast<XMLSciFigs *>(context);
  if(scifigsContext->data()) {
    if(tag=="Grid2D") return XMLMember(_grid);
  }
  return GridPlot::xml_member(tag, attributes, context);
}
virtual const QString& SciFigs::GridViewer::xml_tagName ( ) const [inline, virtual]

Reimplemented from SciFigs::GridPlot.

{return xmlGridViewerTag;}
void SciFigs::GridViewer::xml_writeChildren ( XML_WRITECHILDREN_ARGS  ) const [protected, virtual]

Reimplemented from SciFigs::GridPlot.

References _grid, SciFigs::XMLSciFigs::data(), TRACE, and QGpCoreTools::XMLClass::xml_save().

{
  TRACE;
  XMLSciFigs * scifigsContext=static_cast<XMLSciFigs *>(context);
  if(scifigsContext->data()) {
    _grid->xml_save(s, context);
  }
  GridPlot::xml_writeChildren(s, context);
}

Member Data Documentation

Grid2D<double>* SciFigs::GridViewer::_grid [protected]
const QString SciFigs::GridViewer::xmlGridViewerTag = "GridViewer" [static]

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines