Added ellipse object.

This commit is contained in:
Jim Evins
2016-05-22 16:17:59 -04:00
parent 7c945d6ba7
commit 26e3aa37e3
8 changed files with 343 additions and 7 deletions
+41 -3
View File
@@ -23,7 +23,7 @@
#include "LabelModel.h"
#include "LabelModelObject.h"
#include "LabelModelBoxObject.h"
//#include "LabelObjectEllipse.h"
#include "LabelModelEllipseObject.h"
//#include "LabelObjectLine.h"
//#include "LabelObjectImage.h"
//#include "LabelObjectBarcode.h"
@@ -262,11 +262,11 @@ XmlLabelParser::parseObjects( const QDomElement &node )
{
list.append( parseObjectBoxNode( child.toElement() ) );
}
#if 0
else if ( tagName == "Object-ellipse" )
{
list.append( parseObjectEllipseNode( child.toElement() ) );
}
#if 0
else if ( tagName == "Object-line" )
{
list.append( parseObjectLineNode( child.toElement() ) );
@@ -354,7 +354,45 @@ XmlLabelParser::parseObjectBoxNode( const QDomElement &node )
LabelModelEllipseObject*
XmlLabelParser::parseObjectEllipseNode( const QDomElement &node )
{
return 0;
using namespace glabels;
LabelModelEllipseObject* object = new LabelModelEllipseObject();
/* position attrs */
object->setX0( XmlUtil::getLengthAttr( node, "x", 0.0 ) );
object->setY0( XmlUtil::getLengthAttr( node, "y", 0.0 ) );
/* size attrs */
object->setW( XmlUtil::getLengthAttr( node, "w", 0 ) );
object->setH( XmlUtil::getLengthAttr( node, "h", 0 ) );
/* line attrs */
object->setLineWidth( XmlUtil::getLengthAttr( node, "line_width", 1.0 ) );
{
QString key = XmlUtil::getStringAttr( node, "line_color_field", "" );
bool field_flag = !key.isEmpty();
uint32_t color = XmlUtil::getUIntAttr( node, "line_color", 0 );
object->setLineColorNode( ColorNode( field_flag, color, key ) );
}
/* fill attrs */
{
QString key = XmlUtil::getStringAttr( node, "line_color_field", "" );
bool field_flag = !key.isEmpty();
uint32_t color = XmlUtil::getUIntAttr( node, "fill_color", 0 );
object->setFillColorNode( ColorNode( field_flag, color, key ) );
}
/* affine attrs */
parseAffineAttrs( node, object );
/* shadow attrs */
parseShadowAttrs( node, object );
return object;
}