Added object layer to view. Added draw methods to objects.

This commit is contained in:
Jim Evins
2015-08-12 12:09:11 -04:00
parent 527d2e73dc
commit 781f299394
7 changed files with 121 additions and 75 deletions
+18 -22
View File
@@ -20,10 +20,8 @@
#include "LabelModelObject.h"
#include <QGraphicsDropShadowEffect>
#include <QTransform>
#include <QFont>
#include <QGraphicsItem>
#include <algorithm>
#include "ColorNode.h"
@@ -903,30 +901,28 @@ namespace glabels
///
/// Update Representative Graphics Item with Object's Transformation Matrix
/// Draw object + shadow
///
void LabelModelObject::updateGraphicsItemMatrix( QGraphicsItem* graphicsItem )
void LabelModelObject::draw( QPainter* painter, bool inEditor, MergeRecord* record ) const
{
graphicsItem->setTransform( mMatrix );
painter->save();
painter->translate( mX0, mY0 );
if ( mShadowState )
{
painter->save();
painter->translate( mShadowX, mShadowY );
painter->setTransform( mMatrix, true );
drawShadow( painter, inEditor, record );
painter->restore();
}
painter->setTransform( mMatrix, true );
drawObject( painter, inEditor, record );
painter->restore();
}
///
/// Update Representative Graphics Item with Object's Shadow Properties
///
void LabelModelObject::updateGraphicsItemShadow( QGraphicsItem* graphicsItem )
{
QGraphicsDropShadowEffect *shadowEffect = new QGraphicsDropShadowEffect();
QColor color = mShadowColorNode.color();
color.setAlphaF( mShadowOpacity );
shadowEffect->setColor( color );
shadowEffect->setOffset( mShadowX, mShadowY );
shadowEffect->setBlurRadius( 0 );
graphicsItem->setGraphicsEffect( shadowEffect );
}
}