Removed C++17 nested namespace definitions. Should build on trusty again.

This commit is contained in:
Jim Evins
2017-11-24 15:49:26 -05:00
parent 4821e103bc
commit c9f2b91daf
129 changed files with 18995 additions and 18592 deletions
+184 -181
View File
@@ -24,220 +24,223 @@
#include <QPen>
namespace glabels::model
namespace glabels
{
//
// Private
//
namespace
namespace model
{
const double slopPixels = 2;
}
//
// Private
//
namespace
{
const double slopPixels = 2;
}
///
/// Constructor
///
ModelLineObject::ModelLineObject()
{
mOutline = nullptr;
///
/// Constructor
///
ModelLineObject::ModelLineObject()
{
mOutline = nullptr;
mHandles << new HandleP1( this );
mHandles << new HandleP2( this );
mHandles << new HandleP1( this );
mHandles << new HandleP2( this );
mLineWidth = 1.0;
mLineColorNode = ColorNode( QColor( 0, 0, 0 ) );
}
mLineWidth = 1.0;
mLineColorNode = ColorNode( QColor( 0, 0, 0 ) );
}
///
/// Constructor
///
ModelLineObject::ModelLineObject( const Distance& x0,
const Distance& y0,
const Distance& dx,
const Distance& dy,
const Distance& lineWidth,
const ColorNode& lineColorNode,
const QMatrix& matrix,
bool shadowState,
const Distance& shadowX,
const Distance& shadowY,
double shadowOpacity,
const ColorNode& shadowColorNode )
: ModelObject( x0, y0, dx, dy,
matrix,
shadowState, shadowX, shadowY, shadowOpacity, shadowColorNode )
{
mOutline = new Outline( this );
///
/// Constructor
///
ModelLineObject::ModelLineObject( const Distance& x0,
const Distance& y0,
const Distance& dx,
const Distance& dy,
const Distance& lineWidth,
const ColorNode& lineColorNode,
const QMatrix& matrix,
bool shadowState,
const Distance& shadowX,
const Distance& shadowY,
double shadowOpacity,
const ColorNode& shadowColorNode )
: ModelObject( x0, y0, dx, dy,
matrix,
shadowState, shadowX, shadowY, shadowOpacity, shadowColorNode )
{
mOutline = new Outline( this );
mHandles << new HandleNorthWest( this );
mHandles << new HandleNorth( this );
mHandles << new HandleNorthEast( this );
mHandles << new HandleEast( this );
mHandles << new HandleSouthEast( this );
mHandles << new HandleSouth( this );
mHandles << new HandleSouthWest( this );
mHandles << new HandleWest( this );
mHandles << new HandleNorthWest( this );
mHandles << new HandleNorth( this );
mHandles << new HandleNorthEast( this );
mHandles << new HandleEast( this );
mHandles << new HandleSouthEast( this );
mHandles << new HandleSouth( this );
mHandles << new HandleSouthWest( this );
mHandles << new HandleWest( this );
mLineWidth = lineWidth;
mLineColorNode = lineColorNode;
}
mLineWidth = lineWidth;
mLineColorNode = lineColorNode;
}
///
/// Copy constructor
///
ModelLineObject::ModelLineObject( const ModelLineObject* object )
: ModelObject(object)
{
mLineWidth = object->mLineWidth;
mLineColorNode = object->mLineColorNode;
}
///
/// Destructor
///
ModelLineObject::~ModelLineObject()
{
foreach( Handle* handle, mHandles )
///
/// Copy constructor
///
ModelLineObject::ModelLineObject( const ModelLineObject* object )
: ModelObject(object)
{
delete handle;
mLineWidth = object->mLineWidth;
mLineColorNode = object->mLineColorNode;
}
mHandles.clear();
}
///
/// Clone
///
ModelLineObject* ModelLineObject::clone() const
{
return new ModelLineObject( this );
}
///
/// Line Width Property Getter
///
Distance ModelLineObject::lineWidth() const
{
return mLineWidth;
}
///
/// Line Width Property Setter
///
void ModelLineObject::setLineWidth( const Distance& value )
{
if ( mLineWidth != value )
///
/// Destructor
///
ModelLineObject::~ModelLineObject()
{
mLineWidth = value;
emit changed();
foreach( Handle* handle, mHandles )
{
delete handle;
}
mHandles.clear();
}
}
///
/// Line Color Node Property Getter
///
ColorNode ModelLineObject::lineColorNode() const
{
return mLineColorNode;
}
///
/// Line Color Node Property Setter
///
void ModelLineObject::setLineColorNode( const ColorNode& value )
{
if ( mLineColorNode != value )
///
/// Clone
///
ModelLineObject* ModelLineObject::clone() const
{
mLineColorNode = value;
emit changed();
return new ModelLineObject( this );
}
///
/// Line Width Property Getter
///
Distance ModelLineObject::lineWidth() const
{
return mLineWidth;
}
///
/// Line Width Property Setter
///
void ModelLineObject::setLineWidth( const Distance& value )
{
if ( mLineWidth != value )
{
mLineWidth = value;
emit changed();
}
}
///
/// Line Color Node Property Getter
///
ColorNode ModelLineObject::lineColorNode() const
{
return mLineColorNode;
}
///
/// Line Color Node Property Setter
///
void ModelLineObject::setLineColorNode( const ColorNode& value )
{
if ( mLineColorNode != value )
{
mLineColorNode = value;
emit changed();
}
}
}
///
/// Can Line Color Capability Implementation
///
bool ModelLineObject::canLineColor()
{
return true;
}
///
/// Can Line Width Capability Implementation
///
bool ModelLineObject::canLineWidth()
{
return true;
}
///
/// Draw shadow of object
///
void ModelLineObject::drawShadow( QPainter* painter, bool inEditor, merge::Record* record ) const
{
QColor lineColor = mLineColorNode.color( record );
QColor shadowColor = mShadowColorNode.color( record );
shadowColor.setAlphaF( mShadowOpacity );
if ( lineColor.alpha() )
///
/// Can Line Color Capability Implementation
///
bool ModelLineObject::canLineColor()
{
painter->setPen( QPen( shadowColor, mLineWidth.pt() ) );
return true;
}
///
/// Can Line Width Capability Implementation
///
bool ModelLineObject::canLineWidth()
{
return true;
}
///
/// Draw shadow of object
///
void ModelLineObject::drawShadow( QPainter* painter, bool inEditor, merge::Record* record ) const
{
QColor lineColor = mLineColorNode.color( record );
QColor shadowColor = mShadowColorNode.color( record );
shadowColor.setAlphaF( mShadowOpacity );
if ( lineColor.alpha() )
{
painter->setPen( QPen( shadowColor, mLineWidth.pt() ) );
painter->drawLine( 0, 0, mW.pt(), mH.pt() );
}
}
///
/// Draw object itself
///
void ModelLineObject::drawObject( QPainter* painter, bool inEditor, merge::Record* record ) const
{
QColor lineColor = mLineColorNode.color( record );
painter->setPen( QPen( lineColor, mLineWidth.pt() ) );
painter->drawLine( 0, 0, mW.pt(), mH.pt() );
}
}
///
/// Draw object itself
///
void ModelLineObject::drawObject( QPainter* painter, bool inEditor, merge::Record* record ) const
{
QColor lineColor = mLineColorNode.color( record );
painter->setPen( QPen( lineColor, mLineWidth.pt() ) );
painter->drawLine( 0, 0, mW.pt(), mH.pt() );
}
///
/// Path to test for hover condition
///
QPainterPath ModelLineObject::hoverPath( double scale ) const
{
QPainterPath path;
if ( mLineColorNode.color().alpha() )
///
/// Path to test for hover condition
///
QPainterPath ModelLineObject::hoverPath( double scale ) const
{
//
// Build a thin rectangle representing line
//
double rPts = mLineWidth.pt()/2 + slopPixels / scale;
QPainterPath path;
double lengthPts = sqrt( mW.pt()*mW.pt() + mH.pt()*mH.pt() );
double dx = mH.pt() / lengthPts; // horizontal pitch of perpendicular line
double dy = mW.pt() / lengthPts; // vertical pitch of perpendicular line
if ( mLineColorNode.color().alpha() )
{
//
// Build a thin rectangle representing line
//
double rPts = mLineWidth.pt()/2 + slopPixels / scale;
double lengthPts = sqrt( mW.pt()*mW.pt() + mH.pt()*mH.pt() );
double dx = mH.pt() / lengthPts; // horizontal pitch of perpendicular line
double dy = mW.pt() / lengthPts; // vertical pitch of perpendicular line
path.moveTo( rPts*dx, - rPts*dy );
path.lineTo( mW.pt() + rPts*dx, mH.pt() - rPts*dy );
path.lineTo( mW.pt() - rPts*dx, mH.pt() + rPts*dy );
path.lineTo( - rPts*dx, rPts*dy );
path.moveTo( rPts*dx, - rPts*dy );
path.lineTo( mW.pt() + rPts*dx, mH.pt() - rPts*dy );
path.lineTo( mW.pt() - rPts*dx, mH.pt() + rPts*dy );
path.lineTo( - rPts*dx, rPts*dy );
path.closeSubpath();
path.closeSubpath();
}
return path;
}
return path;
}
} // namespace glabels::model
}