/** ******************************************************************************* * @file parserSVG/Group.cpp * @brief Basic Group parsing (Sources) * @author Edouard DUPIN * @date 21/03/2012 * @par Project * parserSVG * * @par Copyright * Copyright 2011 Edouard DUPIN, all right reserved * * This software is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY. * * Licence summary : * You can modify and redistribute the sources code and binaries. * You can send me the bug-fix * * Term of the licence in in the file licence.txt. * ******************************************************************************* */ #include #include #include #include #include #include #include #include #include #include #include #include #include svg::Group::Group(PaintState parentPaintState) : svg::Base(parentPaintState) { } svg::Group::~Group(void) { } bool svg::Group::Parse(TiXmlNode * node, agg::trans_affine& parentTrans, Vector2D& sizeMax) { // parse ... Vector2D pos; Vector2D size; ParseTransform(node); ParsePosition(node, pos, size); ParsePaintAttr(node); SVG_VERBOSE("parsed G1. trans : (" << m_transformMatrix.sx << "," << m_transformMatrix.shy << "," << m_transformMatrix.shx << "," << m_transformMatrix.sy << "," << m_transformMatrix.tx << "," << m_transformMatrix.ty << ")"); // add the property of the parrent modifications ... m_transformMatrix *= parentTrans; SVG_VERBOSE("parsed G2. trans : (" << m_transformMatrix.sx << "," << m_transformMatrix.shy << "," << m_transformMatrix.shx << "," << m_transformMatrix.sy << "," << m_transformMatrix.tx << "," << m_transformMatrix.ty << ")"); sizeMax.x = 0; sizeMax.y = 0; Vector2D tmpPos; // parse all sub node : for(TiXmlNode * child = node->FirstChild(); NULL != child; child = child->NextSibling() ) { svg::Base *elementParser = NULL; if (child->Type()==TiXmlNode::TINYXML_COMMENT) { // nothing to do, just proceed to next step } else { etk::UString localValue = child->Value(); if (localValue == "g") { elementParser = new svg::Group(m_paint); } else if (localValue == "a") { // TODO ... } else if (localValue == "path") { elementParser = new svg::Path(m_paint); } else if (localValue == "rect") { elementParser = new svg::Rectangle(m_paint); } else if (localValue == "circle") { elementParser = new svg::Circle(m_paint); } else if (localValue == "ellipse") { elementParser = new svg::Ellipse(m_paint); } else if (localValue == "line") { elementParser = new svg::Line(m_paint); } else if (localValue == "polyline") { elementParser = new svg::Polyline(m_paint); } else if (localValue == "polygon") { elementParser = new svg::Polygon(m_paint); } else if (localValue == "text") { elementParser = new svg::Text(m_paint); } else { SVG_ERROR("(l "<Row()<<") node not suported : \""<Row()<<") error on node: \""<Parse(child, m_transformMatrix, tmpPos)) { SVG_ERROR("(l "<Row()<<") error on node: \""<AggDraw(myRenderer, basicTrans); } } }