Cinder  0.8.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members
cinder::svg::Node Class Referenceabstract

Base class for an element of an SVG Document. More...

#include <Svg.h>

Inheritance diagram for cinder::svg::Node:
[legend]

Public Member Functions

 Node (const Node *parent)
 
virtual ~Node ()
 
class DocgetDoc () const
 Returns the svg::Doc this Node is an element of. More...
 
const NodegetParent () const
 Returns the immediate parent of this node. More...
 
const std::stringgetId () const
 Returns the ID of this Node when present. More...
 
std::string getDomPath () const
 Returns a DOM-style path to this node. More...
 
const StylegetStyle () const
 Returns the style elements defined on this Node but not inherited from ancestors. More...
 
void setStyle (const Style &style)
 Sets the style defined on this Node but not inherited from ancestors. More...
 
Style calcInheritedStyle () const
 Returns the node's Style, including attributes inherited from its ancestors for attributes it does not specify. More...
 
virtual bool containsPoint (const Vec2f &pt) const
 Returns whether the point pt is inside of the Node's shape. More...
 
void render (Renderer &renderer) const
 Renders the node and its descendants. More...
 
virtual const NodefindInAncestors (const std::string &elementId) const
 Finds the node with ID elementId amongst this Node's ancestors. Returns NULL on failure. More...
 
Paint findPaintInAncestors (const std::string &paintName) const
 Finds the svg::Paint node with ID elementId amongst this Node's ancestors. Returns a default svg::Paint instance on failure. More...
 
bool specifiesTransform () const
 Returns whether this Node specifies a transformation. More...
 
MatrixAffine2f getTransform () const
 Returns the local transformation of this node. Returns identity if the Node's transform isn't specified. More...
 
void setTransform (const MatrixAffine2f &transform)
 Sets the local transformation of this node. More...
 
void unspecifyTransform ()
 Removes the local transformation of this node, effectively making it the identity matrix. More...
 
MatrixAffine2f getTransformInverse () const
 Returns the inverse of the local transformation of this node. Returns identity if the Node's transform isn't specified. More...
 
MatrixAffine2f getTransformAbsolute () const
 Returns the absolute transformation of this node, which includes inherited transformations. More...
 
MatrixAffine2f getTransformAbsoluteInverse () const
 Returns the inverse of the absolute transformation of this node, which includes inherited transformations. More...
 
Rectf getBoundingBox () const
 Returns the local bounding box of the Node. Calculated and cached the first time it is requested. More...
 
Rectf getBoundingBoxAbsolute () const
 Returns the absolute bounding box of the Node. Calculated and cached the first time it is requested. More...
 
virtual Shape2d getShape () const
 Returns a Shape2d representing the node in local coordinates. Not supported for Text. More...
 
Shape2d getShapeAbsolute () const
 Returns a Shape2d representing the node in absolute coordinates. Not supported for Text. More...
 
const PaintgetFill () const
 Returns node's fill, or the first among its ancestors when it has none. More...
 
const PaintgetStroke () const
 Returns node's stroke, or the first among its ancestors when it has none. More...
 
float getOpacity () const
 Returns node's opacity, or the first among its ancestors when it has none. More...
 
float getFillOpacity () const
 Returns node's fill opacity, or the first among its ancestors when it has none. More...
 
float getStrokeOpacity () const
 Returns node's stroke opacity, or the first among its ancestors when it has none. More...
 
FillRule getFillRule () const
 Returns node's fill rule, or the first among its ancestors when it has none. More...
 
LineCap getLineCap () const
 Returns node's line cap, or the first among its ancestors when it has none. More...
 
LineJoin getLineJoin () const
 Returns node's line join, or the first among its ancestors when it has none. More...
 
float getStrokeWidth () const
 Returns node's stroke width, or the first among its ancestors when it has none. More...
 
const std::vector< std::string > & getFontFamilies () const
 Returns node's font families, or the first among its ancestors when it has none. More...
 
Value getFontSize () const
 Returns node's font size, or the first among its ancestors when it has none. More...
 
bool isVisible () const
 Returns whether this Node is visible, or the first among its ancestors when unspecified. More...
 
bool isDisplayNone () const
 Returns whether the Display property of this Node is set to 'None', preventing rendering of the node and its children. More...
 

Protected Member Functions

 Node (const Node *parent, const XmlTree &xml)
 
virtual bool isDrawable () const
 
void startRender (Renderer &renderer, const Style &style) const
 
void finishRender (Renderer &renderer, const Style &style) const
 
virtual void renderSelf (Renderer &renderer) const =0
 
virtual Rectf calcBoundingBox () const
 
void parseStyle (const std::string &value)
 

Static Protected Member Functions

static Paint parsePaint (const char *value, bool *specified, const Node *parentNode)
 
static MatrixAffine2f parseTransform (const std::string &value)
 
static bool parseTransformComponent (const char **c, MatrixAffine2f *result)
 
static std::string findStyleValue (const std::string &styleString, const std::string &key)
 

Protected Attributes

const NodemParent
 
std::string mId
 
Style mStyle
 
bool mSpecifiesTransform
 
MatrixAffine2f mTransform
 
bool mBoundingBoxCached
 
Rectf mBoundingBox
 

Friends

class Group
 
class Use
 

Detailed Description

Base class for an element of an SVG Document.

Constructor & Destructor Documentation

cinder::svg::Node::Node ( const Node parent)
virtual cinder::svg::Node::~Node ( )
virtual
cinder::svg::Node::Node ( const Node parent,
const XmlTree xml 
)
protected

Member Function Documentation

Doc * cinder::svg::Node::getDoc ( ) const

Returns the svg::Doc this Node is an element of.

const Node* cinder::svg::Node::getParent ( ) const

Returns the immediate parent of this node.

const std::string& cinder::svg::Node::getId ( ) const

Returns the ID of this Node when present.

string cinder::svg::Node::getDomPath ( ) const

Returns a DOM-style path to this node.

const Style& cinder::svg::Node::getStyle ( ) const

Returns the style elements defined on this Node but not inherited from ancestors.

void cinder::svg::Node::setStyle ( const Style style)

Sets the style defined on this Node but not inherited from ancestors.

Style cinder::svg::Node::calcInheritedStyle ( ) const

Returns the node's Style, including attributes inherited from its ancestors for attributes it does not specify.

virtual bool cinder::svg::Node::containsPoint ( const Vec2f pt) const
virtual

Returns whether the point pt is inside of the Node's shape.

Reimplemented in cinder::svg::Image, cinder::svg::Polyline, cinder::svg::Polygon, cinder::svg::Rect, cinder::svg::Path, cinder::svg::Ellipse, and cinder::svg::Circle.

void cinder::svg::Node::render ( Renderer renderer) const

Renders the node and its descendants.

const Node * cinder::svg::Node::findInAncestors ( const std::string elementId) const
virtual

Finds the node with ID elementId amongst this Node's ancestors. Returns NULL on failure.

Reimplemented in cinder::svg::Group.

Paint cinder::svg::Node::findPaintInAncestors ( const std::string paintName) const

Finds the svg::Paint node with ID elementId amongst this Node's ancestors. Returns a default svg::Paint instance on failure.

bool cinder::svg::Node::specifiesTransform ( ) const

Returns whether this Node specifies a transformation.

MatrixAffine2f cinder::svg::Node::getTransform ( ) const

Returns the local transformation of this node. Returns identity if the Node's transform isn't specified.

void cinder::svg::Node::setTransform ( const MatrixAffine2f transform)

Sets the local transformation of this node.

void cinder::svg::Node::unspecifyTransform ( )

Removes the local transformation of this node, effectively making it the identity matrix.

MatrixAffine2f cinder::svg::Node::getTransformInverse ( ) const

Returns the inverse of the local transformation of this node. Returns identity if the Node's transform isn't specified.

MatrixAffine2f cinder::svg::Node::getTransformAbsolute ( ) const

Returns the absolute transformation of this node, which includes inherited transformations.

MatrixAffine2f cinder::svg::Node::getTransformAbsoluteInverse ( ) const

Returns the inverse of the absolute transformation of this node, which includes inherited transformations.

Rectf cinder::svg::Node::getBoundingBox ( ) const

Returns the local bounding box of the Node. Calculated and cached the first time it is requested.

Rectf cinder::svg::Node::getBoundingBoxAbsolute ( ) const

Returns the absolute bounding box of the Node. Calculated and cached the first time it is requested.

virtual Shape2d cinder::svg::Node::getShape ( ) const
virtual
Shape2d cinder::svg::Node::getShapeAbsolute ( ) const

Returns a Shape2d representing the node in absolute coordinates. Not supported for Text.

const Paint & cinder::svg::Node::getFill ( ) const

Returns node's fill, or the first among its ancestors when it has none.

const Paint & cinder::svg::Node::getStroke ( ) const

Returns node's stroke, or the first among its ancestors when it has none.

float cinder::svg::Node::getOpacity ( ) const

Returns node's opacity, or the first among its ancestors when it has none.

float cinder::svg::Node::getFillOpacity ( ) const

Returns node's fill opacity, or the first among its ancestors when it has none.

float cinder::svg::Node::getStrokeOpacity ( ) const

Returns node's stroke opacity, or the first among its ancestors when it has none.

FillRule cinder::svg::Node::getFillRule ( ) const

Returns node's fill rule, or the first among its ancestors when it has none.

LineCap cinder::svg::Node::getLineCap ( ) const

Returns node's line cap, or the first among its ancestors when it has none.

LineJoin cinder::svg::Node::getLineJoin ( ) const

Returns node's line join, or the first among its ancestors when it has none.

float cinder::svg::Node::getStrokeWidth ( ) const

Returns node's stroke width, or the first among its ancestors when it has none.

const vector< string > & cinder::svg::Node::getFontFamilies ( ) const

Returns node's font families, or the first among its ancestors when it has none.

Value cinder::svg::Node::getFontSize ( ) const

Returns node's font size, or the first among its ancestors when it has none.

bool cinder::svg::Node::isVisible ( ) const

Returns whether this Node is visible, or the first among its ancestors when unspecified.

bool cinder::svg::Node::isDisplayNone ( ) const

Returns whether the Display property of this Node is set to 'None', preventing rendering of the node and its children.

virtual bool cinder::svg::Node::isDrawable ( ) const
protectedvirtual
void cinder::svg::Node::startRender ( Renderer renderer,
const Style style 
) const
protected
void cinder::svg::Node::finishRender ( Renderer renderer,
const Style style 
) const
protected
virtual void cinder::svg::Node::renderSelf ( Renderer renderer) const
protectedpure virtual
virtual Rectf cinder::svg::Node::calcBoundingBox ( ) const
protectedvirtual
Paint cinder::svg::Node::parsePaint ( const char *  value,
bool *  specified,
const Node parentNode 
)
staticprotected
MatrixAffine2f cinder::svg::Node::parseTransform ( const std::string value)
staticprotected
bool cinder::svg::Node::parseTransformComponent ( const char **  c,
MatrixAffine2f result 
)
staticprotected
std::string cinder::svg::Node::findStyleValue ( const std::string styleString,
const std::string key 
)
staticprotected
void cinder::svg::Node::parseStyle ( const std::string value)
protected

Friends And Related Function Documentation

friend class Group
friend
friend class Use
friend

Member Data Documentation

const Node* cinder::svg::Node::mParent
protected
std::string cinder::svg::Node::mId
protected
Style cinder::svg::Node::mStyle
protected
bool cinder::svg::Node::mSpecifiesTransform
protected
MatrixAffine2f cinder::svg::Node::mTransform
protected
bool cinder::svg::Node::mBoundingBoxCached
mutableprotected
Rectf cinder::svg::Node::mBoundingBox
mutableprotected

The documentation for this class was generated from the following files: