Public Member Functions | Protected Attributes

hipp::HippShape Class Reference
[SVG Shapes]

Abstract base class for shapes in Hipp. More...

#include <HippShape.h>

Inheritance diagram for hipp::HippShape:
hipp::HippBackground hipp::HippEllipse hipp::HippLine hipp::HippPolyline hipp::HippRectangle

List of all members.

Public Member Functions

 HippShape ()
 ~HippShape ()
virtual void LoadObject (const xercesc::Attributes &attrs, const XMLCh *const localnam)
 Loads the shape from a set of SVG attributes and the SVG tag name, provided by Xerces-C.
virtual void LoadObject (const XMLCh *const chars)
 Loads information associated with the shape from character data.
virtual std::ostream & SaveObject (std::ostream &stream)
virtual void cloneMeta (HippShape *hs) const
virtual const wxRect & getBounds () const =0
virtual wxRect getFullBounds () const
virtual bool containsPoint (wxPoint p) const =0
virtual void OnDraw (Cairo::RefPtr< Cairo::Context > context, bool isHaptic=true) const
virtual HippShapeclone () const =0
virtual void move (int diffX, int diffY)=0
virtual void zoom (double scaleX, double scaleY)=0
wxString getDescription () const
wxString getTitle () const
wxString getTitleOrUntitled () const
void setDescription (wxString desc)
void setTitle (wxString title)
void toggleFill ()
bool isFilled () const
int getLineWidth () const
virtual void setLineWidth (int w)
void setSoundFile (wxString soundfile)
wxString getSoundFile () const
void setColourWhite (bool c)
bool getColourWhite () const
bool hasSound () const
bool hasMetaInfo () const
virtual ShapeType getShapeType ()=0

Protected Attributes

wxString m_title
wxString m_desc
wxString m_soundfile
bool colourWhite
wxColour m_filling
int lineWidth

Detailed Description

Abstract base class for shapes in Hipp.

Author:
David Kadish

Shapes are the building blocks of Hipp documents. They know how to represent themselves in the .svg xml format (HippShape::LoadObject and HippShape::SaveObject) and in the HippView (HippShape::OnDraw).

Todo:

Create shapes for Ellipse, Rectangle, Path, etc.

Figure out how to properly import and convert Path objects that are really shapes

Author:
David Kadish

Shapes are the building blocks of Hipp documents. They know how to represent themselves in the .svg xml format (HippShape::LoadObject and HippShape::SaveObject) and in the HippView (HippShape::OnDraw).

Todo:

Create shapes for Ellipse, Rectangle, Path, etc.

Figure out how to properly import and convert Path objects that are really shapes


Constructor & Destructor Documentation

HippShape::HippShape (  ) 
HippShape::~HippShape (  ) 

Member Function Documentation

virtual HippShape* hipp::HippShape::clone (  )  const [pure virtual]
void HippShape::cloneMeta ( HippShape hs  )  const [virtual]
virtual bool hipp::HippShape::containsPoint ( wxPoint  p  )  const [pure virtual]
virtual const wxRect& hipp::HippShape::getBounds (  )  const [pure virtual]
bool hipp::HippShape::getColourWhite (  )  const [inline]
wxString hipp::HippShape::getDescription (  )  const [inline]
wxRect HippShape::getFullBounds (  )  const [virtual]
int hipp::HippShape::getLineWidth (  )  const [inline]
virtual ShapeType hipp::HippShape::getShapeType (  )  [pure virtual]
wxString hipp::HippShape::getSoundFile (  )  const [inline]
wxString hipp::HippShape::getTitle (  )  const [inline]
wxString hipp::HippShape::getTitleOrUntitled (  )  const [inline]
bool HippShape::hasMetaInfo (  )  const
bool HippShape::hasSound (  )  const
bool hipp::HippShape::isFilled (  )  const [inline]
void hipp::HippShape::LoadObject ( const XMLCh *const   chars  )  [virtual]

Loads information associated with the shape from character data.

This version of the LoadObject function is called when the shape encounters the character data inside a <title> or <desc> tag. The appropriate variable is set to the HippShape::awaiting_data pointer in the other version of HippShape::LoadObject. Then, the next character data that comes along is that

Todo:
What happens if there is an empty set of character data in one of the tags? This probably breaks. This should look for the SVGHandler::endElement instead of setting HippShape::awaiting_data to NULL inside this function.
void hipp::HippShape::LoadObject ( const xercesc::Attributes &  attrs,
const XMLCh *const   localname 
) [virtual]

Loads the shape from a set of SVG attributes and the SVG tag name, provided by Xerces-C.

Hipp uses a Xerces-C SAX2 XML parser to traverse a .svg input file. When a known shape is encountered, LoadObject is called with the attributes that are found. The HippShape implementation checks for <title> and <desc> tags, which are universally available to shapes. This function should be overridden in derived classes to load the appropriate object.

Reimplemented in hipp::HippBackground, hipp::HippEllipse, hipp::HippLine, hipp::HippPolyline, and hipp::HippRectangle.

virtual void hipp::HippShape::move ( int  diffX,
int  diffY 
) [pure virtual]
void HippShape::OnDraw ( Cairo::RefPtr< Cairo::Context >  context,
bool  isHaptic = true 
) const [virtual]
virtual std::ostream& hipp::HippShape::SaveObject ( std::ostream &  stream  )  [virtual]
void hipp::HippShape::setColourWhite ( bool  c  )  [inline]
void hipp::HippShape::setDescription ( wxString  desc  )  [inline]
virtual void hipp::HippShape::setLineWidth ( int  w  )  [inline, virtual]
void hipp::HippShape::setSoundFile ( wxString  soundfile  )  [inline]
void hipp::HippShape::setTitle ( wxString  title  )  [inline]
void hipp::HippShape::toggleFill (  )  [inline]
virtual void hipp::HippShape::zoom ( double  scaleX,
double  scaleY 
) [pure virtual]

Member Data Documentation

bool hipp::HippShape::colourWhite [protected]
int hipp::HippShape::lineWidth [protected]
wxString hipp::HippShape::m_desc [protected]
wxColour hipp::HippShape::m_filling [protected]
wxString hipp::HippShape::m_soundfile [protected]
wxString hipp::HippShape::m_title [protected]

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