Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
NodeSVG Class Reference
Inheritance diagram for NodeSVG:
Inheritance graph
[legend]
Collaboration diagram for NodeSVG:
Collaboration graph
[legend]

Public Types

typedef svg::tag_t tag_t
 
- Public Types inherited from NodeXML< svg::tag_t >
typedef svg::tag_t xml_tag_t
 
typedef NodeXML< svg::tag_t > xml_node_t
 
typedef drain::Path< std::string,'/'> path_t
 
typedef UnorderedMultiTree< xml_node_t, false, path_t > xml_tree_t
 
typedef std::map< xml_tag_t, xml_tag_t > xml_default_elem_map_t
 Helps creating child elements. Like children of HTML element UL should be LI.
 
- Public Types inherited from XML
enum  entity_t {
  AMPERSAND = '&' , LESS_THAN = '<' , EQUAL_TO = '=' , GREATER_THAN = '>' ,
  NONBREAKABLE_SPACE = ' ' , QUOTE = '"' , CURLY_LEFT = '{' , CURLY_RIGHT = '}' ,
  TAB = '\t' , NEWLINE = '\n' , DEGREE = 176
}
 
enum  tag_display_mode {
  FLEXIBLE_TAG = 0 , OPENING_TAG = 1 , CLOSING_TAG = 2 , EMPTY_TAG = OPENING_TAG | CLOSING_TAG ,
  NON_EMPTY_TAG , NO_TAG
}
 
typedef int intval_t
 
typedef std::map< std::string, FlexibleVariable > map_t
 
- Public Types inherited from AlignSVG
enum  Owner { OBJECT = 0 , ANCHOR = 1 }
 
enum  AlignClass { COMPOUND , FIXED , INDEPENDENT , NEUTRAL }
 Moved from Layput.
 
typedef Alignment< const AlignBase::Axis, AlignBase::Axis::HORZ > HorzAlign
 
typedef Alignment< const AlignBase::Axis, AlignBase::Axis::VERT > VertAlign
 
- Public Types inherited from AlignAnchorSVG
typedef AnchorElem anchor_t
 

Public Member Functions

 NodeSVG (svg::tag_t t=svg::UNDEFINED)
 Default constructor. Create a node of given type.
 
 NodeSVG (const NodeSVG &node)
 Copy constructor.
 
bool isAbstract () const
 
virtual bool isSingular () const override final
 If true, render always as single elem (without child elems)
 
NodeSVG & operator= (const NodeSVG &node)
 Copy data from a node. (Does not copy subtree.)
 
NodeSVG & operator= (const std::initializer_list< Variable::init_pair_t > &l)
 Copy data from a node. (Does not copy subtree.)
 
template<class T >
NodeSVG & operator= (const T &arg)
 
NodeSVG & operator= (xml_tag_t type)
 
const BBoxSVG & getBoundingBox () const
 Set attribute value, handling units in string arguments, like in "50%" or "640px".
 
BBoxSVG & getBoundingBox ()
 Get location (x,y) and geometry (width,height) of an object.
 
template<typename T >
void setBoundingBox (const drain::Box< T > &b)
 Set position (x,y), width and height of an object.
 
const Frame2D< svg::coord_t > & getGeometry () const
 Get location (x,y) and geometry (width,height) of an object.
 
Frame2D< svg::coord_t > & getGeometry ()
 Get location (x,y) and geometry (width,height) of an object.
 
const Point2D< svg::coord_t > & getLocation () const
 
Point2D< svg::coord_t > & getLocation ()
 
template<typename T >
void setViewBox (const drain::Box< T > &bb)
 
template<typename T >
void setViewBox (T &x, T &y, T &width, T &height)
 
template<typename T >
void setLocation (const drain::Point2D< T > &point)
 Set position (x,y) of an object.
 
template<typename T >
void setLocation (const T &x, const T &y)
 
template<typename T >
void setGeometry (const drain::Frame2D< T > &frame)
 
template<typename T >
void setGeometry (const T &w, const T &h)
 
template<typename T >
void setWidth (T w)
 
svg::coord_t getWidth () const
 
template<typename T >
void setMargin (T w)
 Set margin of a TEXT element (non-standard).
 
svg::coord_t getMargin () const
 Get margin of a TEXT element (non-standard).
 
template<typename T >
void setHeight (T h)
 
svg::coord_t getHeight () const
 
void setFontSize (svg::coord_t size, svg::coord_t elemHeight=0.0)
 Sets font size and also text elem "height".
 
virtual void specificAttributesToStream (std::ostream &ostr) const override
 Write transform, in addition to XML::ClassList.
 
void swapDataSVG (NodeSVG &node)
 Swaps XML properties and also alignment, anchors etc.
 
- Public Member Functions inherited from NodeXML< svg::tag_t >
const NodeXML< drain::image::SLD::tag_t >::xml_default_elem_map_t xml_default_elems
 
const NodeXML< image::SLD::tag_t >::xml_default_elem_map_t xml_default_elems
 
const NodeXML< Html::tag_t >::xml_default_elem_map_t xml_default_elems
 
const NodeXML< Html::tag_t >::xml_default_elem_map_t xml_default_elems
 
const NodeXML< int >::xml_default_elem_map_t xml_default_elems
 
 NodeXML ()
 Default constructor.
 
 NodeXML (const NodeXML &node)
 Copy constructor.
 
virtual const std::string & getTag () const override
 Default implementation of tag name retrieval based on drain::Enum<t>.
 
svg::tag_t getNativeType () const
 Change attributes, styles and classes of a node.
 
void set (const NodeXML< svg::tag_t > &node)
 
void set (const intval_t &type)
 
void set (const std::string &s)
 
void set (const char *s)
 
void set (const drain::Castable &s)
 
void set (const std::initializer_list< std::pair< const char *, const Variable > > &args)
 
void set (const std::map< std::string, V > &args)
 
void set (const std::string &key, const V &value)
 
NodeXML & operator= (const NodeXML &node)
 
NodeXML & operator= (const xml_tag_t &x)
 
NodeXML & operator= (const Castable &c)
 
NodeXML & operator= (const std::string &s)
 
NodeXML & operator= (const char *s)
 
NodeXML & operator= (const std::initializer_list< std::pair< const char *, const drain::Variable > > &l)
 
virtual std::ostream & nodeToStream (std::ostream &ostr, tag_display_mode mode=EMPTY_TAG) const override
 Dumps info. Future option: outputs leading and ending tag.
 
std::ostream & docTypeToStream (std::ostream &ostr)
 
- Public Member Functions inherited from XML
map_t & getMap ()
 
const map_t & getMap () const
 
 XML ()
 User may optionally filter attributes and CTEST with this using StringTools::replace(XML::encodingMap);.
 
 XML (const XML &)
 
template<class T >
void setType (const T &t)
 
void setType (intval_t t)
 
const intval_t & getType () const
 
bool typeIsSet () const
 Return true, if type is any of the arguments.
 
template<class T2 , class ... T3>
bool typeIs (const T2 &arg, const T3... args) const
 Return true, if type is any of the arguments.
 
const std::string & setId ()
 Makes ID a visible attribute.
 
const std::string & setId (const std::string &s)
 Makes ID a visible attribute, with a given value.
 
template<char C = '\0', typename ... TT>
const std::string & setId (const TT &...args)
 Concatenates arguments to an id.
 
const std::string & getId () const
 Returns ID of this element. Hopefully a unique ID...
 
bool isUndefined () const
 
bool isComment () const
 
bool isCText () const
 
bool isStyle () const
 
bool isScript () const
 
bool isScopePlain () const
 
bool isScopeJS () const
 
bool isScope () const
 
virtual bool isExplicit () const
 Tell if this element should always have an explicit closing tag even when empty, like <STYLE></STYLE>
 
void reset ()
 Keep the element type but clear style, class and string data.
 
virtual void swapXML (XML &node)
 
template<class ... T>
void setComment (const T &...args)
 Make this node a comment. Contained tree will not be deleted. In current version, attributes WILL be rendered.
 
template<class ... T>
void setCommentSafe (const T &...args)
 Sets XML style comment <--...--> of concatenated arguments.
 
virtual void setText (const std::string &s)
 Assign the text content of this node. If the node type is undefined, set it to CTEXT.
 
template<class ... T>
void setText (const T &...args)
 
template<class ... T>
void setTextSafe (const T &...args)
 Sets slightly converted text, ensuring some XML entities.
 
template<class ... T>
void setProgramComment (const T &...args)
 Sets text surrounded by C language comment marks.
 
virtual const std::string & getText () const
 
const std::string & getUrl ()
 
virtual void setUrl (const std::string &s)
 
template<class ... T>
void setName (const T &...args)
 
const FlexibleVariable & getName () const
 
virtual bool empty () const
 
bool hasAttribute (const std::string &key)
 
bool hasUserAttribute (const std::string &key)
 
const map_t & getAttributes () const
 
map_t & getAttributes ()
 
const drain::FlexibleVariable & getAttribute (const std::string &key) const
 
drain::FlexibleVariable & getAttribute (const std::string &key)
 
template<class V >
V getAttribute (const std::string &key, const V &defaultValue) const
 
std::string getAttribute (const std::string &key, const char *defaultValue) const
 
const drain::FlexibleVariable & getUserAttribute (const std::string &key) const
 
drain::FlexibleVariable & getUserAttribute (const std::string &key)
 
template<class V >
V getUserAttribute (const std::string &key, const V &defaultValue) const
 
std::string getUserAttribute (const std::string &key, const char *defaultValue) const
 
virtual void setAttribute (const std::string &key, const std::string &value)
 Default implementation. Needed for handling units in strings, like "50%" or "640px".
 
virtual void setAttribute (const std::string &key, const char *value)
 Default implementation. Needed for handling units in strings, like "50%" or "640px".
 
template<class ... TT>
void setAttribute (const std::string &key, const TT &... args)
 "Final" implementation.
 
template<class ... TT>
void setUserAttribute (const std::string &key, const TT &... args)
 
void removeAttribute (const std::string &s)
 
const StyleXML & getStyle () const
 
Variable & getStyle (const std::string &key)
 
template<class T >
T getStyle (const std::string &key, const T &defaultValue) const
 
void setStyle (const StyleXML &s)
 
void setStyle (const std::string &value)
 
void setStyle (const char *value)
 
void setStyle (const std::string &key, const std::string &value)
 
template<class V >
void setStyle (const std::string &key, const std::initializer_list< V > &l)
 Set style of an element.
 
template<class ... TT>
void setStyle (const std::string &key, const TT &... args)
 For element/class/id, assign ...
 
void setStyle (const std::initializer_list< std::pair< const char *, const drain::Variable > > &args)
 
template<class V >
void setStyle (const std::map< std::string, V > &args)
 
const ClassListXML & getClasses () const
 
template<typename ... TT>
void addClass (const TT &... args)
 
void addClass (const ClassListXML &clist)
 
template<class V >
bool hasClass (const V &cls) const
 
template<class V >
void removeClass (const V &cls)
 
void clearClasses ()
 
- Public Member Functions inherited from AlignSVG
template<typename OBJ , typename A , typename V >
void setAlign (const OBJ &owner, const A &axis, const V &value)
 Low-level, "atomic" setter of alignment for OBJECT itself or its ANCHOR object.
 
void setAlign (const AlignBase::Axis &axis, const AlignBase::Pos &pos, MutualAlign::Topol topol=MutualAlign::Topol::INSIDE)
 Set a single alignment setting. "Intermediate-level": axis and pos are given separately.
 
template<typename ... T, typename AX , AlignBase::Axis A>
void setAlign (const Alignment< AX, A > &align, const T... args)
 NEW High-level, user friendlier interface for setting INSIDE the alignments for both OBJECT itself and its ANCHOR object.
 
template<typename AX1 , AlignBase::Axis A1, typename AX2 , AlignBase::Axis A2>
void setAlign (const Alignment< AX1, A1 > &align1, const Alignment< AX2, A2 > &align2)
 
template<typename AX1 , AlignBase::Axis A1>
void setAlign (const CompleteAlignment< AX1, A1 > &align1)
 
template<typename AX , AlignBase::Axis A>
void setAlign (const Alignment< AX, A > &align1, const Alignment< AX, A > &align2)
 Compiler trap: unimplemented for two of same kind: either HorzAlign or VertAlign twice.
 
template<typename T >
void setAlign (const std::string &align, const T &topol)
 High-level, user friendlier interface for setting the alignments for both OBJECT itself and its ANCHOR object.
 
void setAlign (const std::string &align)
 High-level, user friendly interface for setting the alignments for both OBJECT itself and its ANCHOR object.
 
void setAlign (AlignClass cls)
 
bool isAligned () const
 Returns true, if any setting is set...
 
void resetAlign ()
 
void swapAlign (AlignSVG &align)
 
template<typename P , typename A >
AlignBase::Pos & getAlignPos (const P &pos, const A &axis)
 Return alignment setting of an object along horizontal or vertical axis .
 
template<typename P , typename A >
const AlignBase::Pos & getAlignPos (const P &pos, const A &axis) const
 Return alignment setting of an object along horizontal or vertical axis .
 
void confToStream (std::ostream &ostr) const
 
const std::string & getAlignStr () const
 
void swapAlign ()
 
template<typename OBJ , typename A >
AlignBase::Pos & getAlignPos (const OBJ &owner, const A &axis)
 Dictionary of horizontal (LEFT,CENTER,RIGHT) flags.
 
template<typename OBJ , typename A >
const AlignBase::Pos & getAlignPos (const OBJ &owner, const A &axis) const
 
- Public Member Functions inherited from AlignAnchorSVG
template<class T >
void setMyAlignAnchor (const T &value)
 
template<AlignBase::Axis AX, class T >
void setMyAlignAnchor (const T &value)
 
template<class T >
void setDefaultAlignAnchor (const T &value)
 
template<AlignBase::Axis AX, class T >
void setDefaultAlignAnchor (const T &value)
 
template<AlignBase::Axis AX>
const anchor_t & getMyAlignAnchor () const
 Store anchor object/symbol for aligning this object.
 
template<AlignBase::Axis AX>
const anchor_t & getDefaultAlignAnchor () const
 
template<AlignBase::Axis AX>
anchor_t & getMyAlignAnchor ()
 
template<AlignBase::Axis AX>
anchor_t & getDefaultAlignAnchor ()
 
void swapAnchors (AlignAnchorSVG &anchors)
 

Public Attributes

TransformSVG transform
 
- Public Attributes inherited from XML
std::string ctext
 

Static Public Attributes

static std::string xlink
 In opening SVG tag, referred to by attribute "xmlns:xlink".
 
static std::string svg_decl
 In opening SVG tag, referred to by attributes "xmlns" and "xmlns:svg".
 
- Static Public Attributes inherited from NodeXML< svg::tag_t >
static const xml_default_elem_map_t xml_default_elems
 
- Static Public Attributes inherited from XML
static const intval_t UNDEFINED = 0
 
static const intval_t COMMENT = 1
 
static const intval_t CTEXT = 2
 
static const intval_t SCRIPT = 3
 
static const intval_t STYLE = 4
 
static const intval_t STYLE_SELECT = 5
 
static const intval_t JAVASCRIPT = 6
 
static const intval_t SCOPE = 8
 
static const intval_t SCOPE_CURLY = SCOPE|CURLY
 
static const intval_t XMLBASE = 10
 
static const std::string USER_ATTR_PREFIX = "data-"
 In XML variants, like SVG, it is possible to use any user defined attributes using prefix "data-" .
 
static int nextID = 0
 
- Static Public Attributes inherited from AlignSVG
static const HorzAlign LEFT
 Alias for {HORZ:MIN}.
 
static const HorzAlign CENTER
 Alias for {HORZ:MID}.
 
static const HorzAlign RIGHT
 Alias for {HORZ:MAX}.
 
static const HorzAlign HORZ_FILL
 Alias for {HORZ:FILL}.
 
static const HorzAlign UNDEFINED_HORZ
 
static const VertAlign TOP
 Alias for {VERT:MIN}.
 
static const VertAlign MIDDLE
 Alias for {VERT:MID}.
 
static const VertAlign BOTTOM
 Alias for {VERT:MAX}.
 
static const VertAlign VERT_FILL
 Alias for {VERT:FILL}.
 
static const VertAlign UNDEFINED_VERT
 

Protected Member Functions

virtual void handleType () override final
 
virtual void updateAlign () override
 
virtual void setAlignClass (AlignClass cls) override final
 
- Protected Member Functions inherited from NodeXML< svg::tag_t >
NodeXML< int >::xmldoc_attrib_map_t xmldoc_attribs
 
- Protected Member Functions inherited from XML
bool typeIs () const
 
- Protected Member Functions inherited from AlignSVG
template<typename P , typename A , typename V >
void modifyAlign (const P &owner, const A &axis, const V &value)
 Change alignment configuration without updating the alignStr.
 
void updateAlignStr ()
 

Protected Attributes

BBoxSVG box
 
- Protected Attributes inherited from XML
intval_t type = XML::UNDEFINED
 
std::string id
 
std::string url
 
StyleXML style
 
ClassListXML classList
 
- Protected Attributes inherited from AlignSVG
bitvect_t alignment = 0
 
std::string alignStr
 
align_conf_t alignments = align_conf_t(2, align_vect_t(2, AlignBase::Pos::UNDEFINED_POS))
 
- Protected Attributes inherited from AlignAnchorSVG
anchor_t myAnchorHorz
 
anchor_t myAnchorVert
 
anchor_t defaultAnchorHorz
 
anchor_t defaultAnchorVert
 

Additional Inherited Members

- Static Public Member Functions inherited from NodeXML< svg::tag_t >
static const std::string & getTag (const svg::tag_t &type)
 
static std::ostream & docToStream (std::ostream &ostr, const V &tree)
 
static std::ostream & docTypeToStream (std::ostream &ostr)
 Write the XML definition beginning any XML document.
 
- Static Public Member Functions inherited from XML
static const std::map< char, std::string > & getKeyConversionMap ()
 Characters that must be avoided in XML attribute keys: space, tab, =.
 
static const std::map< char, std::string > & getAttributeConversionMap ()
 Characters that must be avoided in XML attribute values: ".
 
static const std::map< char, std::string > & getCTextConversionMap ()
 Characters to avoid in XML free text: <, >, {, },.
 
static int getCount ()
 
static int getNewIndex ()
 
template<class N >
static std::ostream & toStream (std::ostream &ostr, const UnorderedMultiTree< N > &tree, int indent=0)
 
template<class N >
static std::ostream & styleToStream (std::ostream &ostr, const UnorderedMultiTree< N > &tree, int indent=0)
 
template<class N >
static std::ostream & textToStream (std::ostream &ostr, const UnorderedMultiTree< N > &tree, int indent=0)
 
static const std::map< char, std::string > & getEntityMap ()
 Handy map for converting characters to XML entities. Example: '&' -> "&amp;".
 
template<class V >
static void xmlAttribToStream (std::ostream &ostr, const std::string &key, const V &value)
 Handy map for converting characters to XML entities. Example: '&' -> "&amp;".
 
template<typename N >
static N & xmlAssignNode (N &dst, const N &src)
 Assign tree node (data) to another.
 
- Protected Types inherited from NodeXML< svg::tag_t >
typedef std::list< std::pair< std::string, std::string > > xmldoc_attrib_map_t
 Control constant variables of (note: templated, through Node<T>::)
 
- Protected Types inherited from AlignSVG
typedef int bitvect_t
 
typedef std::vector< AlignBase::Pos > align_vect_t
 
typedef std::vector< align_vect_t > align_conf_t
 
- Static Protected Member Functions inherited from AlignAnchorSVG
static void adjustAnchor (AnchorElem &anchor, const std::string &value)
 
static void adjustAnchor (AnchorElem &anchor, const char *value)
 
static void adjustAnchor (AnchorElem &anchor, const AnchorElem &elem)
 
static void adjustAnchor (AnchorElem &anchor, const ClassXML &cls)
 
template<class T >
static void adjustAnchor (AnchorElem &anchor, const T &value)
 
- Static Protected Attributes inherited from NodeXML< svg::tag_t >
static xmldoc_attrib_map_t xmldoc_attribs
 
- Static Protected Attributes inherited from XML
static const intval_t XML_LIKE = 0
 
static const intval_t CURLY = 1
 
static const intval_t PARENTHESES = 2
 
static const intval_t BRACES = 3
 
static const StyleXML curlyStyleXML
 
static const std::string SCOPE_BEGIN
 
static const std::string SCOPE_END
 
static const std::string COMMENT_BEGIN
 
static const std::string COMMENT_END
 

Member Function Documentation

◆ getBoundingBox()

const BBoxSVG & getBoundingBox ( ) const
inline

Set attribute value, handling units in string arguments, like in "50%" or "640px".

Get location (x,y) and geometry (width,height) of an object.

◆ handleType()

void handleType ( )
finaloverrideprotectedvirtual

Reimplemented from XML.

◆ isSingular()

virtual bool isSingular ( ) const
inlinefinaloverridevirtual

If true, render always as single elem (without child elems)

Reimplemented from XML.

◆ setAlignClass()

virtual void setAlignClass ( AlignClass  cls)
inlinefinaloverrideprotectedvirtual

Implements AlignSVG.

◆ setGeometry()

template<typename T >
void setGeometry ( const T &  w,
const T &  h 
)
inline

Future option: std::string args.

◆ setHeight()

template<typename T >
void setHeight ( T  h)
inline

Future option: std::string arg, allowing units.

◆ setLocation()

template<typename T >
void setLocation ( const T &  x,
const T &  y 
)
inline

Future option: std::string args.

◆ setWidth()

template<typename T >
void setWidth ( T  w)
inline

Future option: std::string arg, allowing units.

◆ specificAttributesToStream()

void specificAttributesToStream ( std::ostream &  ostr) const
overridevirtual

Write transform, in addition to XML::ClassList.

Writes special attributes:

  • class="..." as defined XMK::specificAttributesToStream()
  • transform="..." geometric transformations – only if defined.

Reimplemented from XML.

◆ updateAlign()

void updateAlign ( )
overrideprotectedvirtual

Reimplemented from AlignSVG.


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