VIEW_OVERLAY: add missing code and missing poly graphic overloaded primitives.
Some graphic primitives were already in VIEW_OVERLAY, without code. A few graphic overloaded primitives (Polygon and Polyline) where missing.
This commit is contained in:
parent
85775d522c
commit
253b14b871
|
@ -57,6 +57,22 @@ struct VIEW_OVERLAY::COMMAND_LINE : public VIEW_OVERLAY::COMMAND
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct VIEW_OVERLAY::COMMAND_RECTANGLE : public VIEW_OVERLAY::COMMAND
|
||||||
|
{
|
||||||
|
COMMAND_RECTANGLE( const VECTOR2D& aP0, const VECTOR2D& aP1 ) :
|
||||||
|
m_p0( aP0 ), m_p1( aP1 )
|
||||||
|
{}
|
||||||
|
|
||||||
|
virtual void Execute( VIEW* aView ) const override
|
||||||
|
{
|
||||||
|
aView->GetGAL()->DrawRectangle( m_p0, m_p1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
VECTOR2D m_p0;
|
||||||
|
VECTOR2D m_p1;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
struct VIEW_OVERLAY::COMMAND_CIRCLE : public VIEW_OVERLAY::COMMAND
|
struct VIEW_OVERLAY::COMMAND_CIRCLE : public VIEW_OVERLAY::COMMAND
|
||||||
{
|
{
|
||||||
COMMAND_CIRCLE( const VECTOR2D& aCenter, double aRadius ) :
|
COMMAND_CIRCLE( const VECTOR2D& aCenter, double aRadius ) :
|
||||||
|
@ -94,6 +110,100 @@ struct VIEW_OVERLAY::COMMAND_ARC : public VIEW_OVERLAY::COMMAND
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct VIEW_OVERLAY::COMMAND_POLYLINE : public VIEW_OVERLAY::COMMAND
|
||||||
|
{
|
||||||
|
COMMAND_POLYLINE( const std::deque<VECTOR2D>& aPointList ) :
|
||||||
|
m_pointList( aPointList ) {}
|
||||||
|
|
||||||
|
virtual void Execute( VIEW* aView ) const override
|
||||||
|
{
|
||||||
|
aView->GetGAL()->DrawPolyline( m_pointList );
|
||||||
|
}
|
||||||
|
|
||||||
|
std::deque<VECTOR2D> m_pointList;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct VIEW_OVERLAY::COMMAND_POLY_POLYLINE : public VIEW_OVERLAY::COMMAND
|
||||||
|
{
|
||||||
|
COMMAND_POLY_POLYLINE( const SHAPE_LINE_CHAIN& aLineChain ) :
|
||||||
|
m_polyLine( aLineChain ) {}
|
||||||
|
|
||||||
|
virtual void Execute( VIEW* aView ) const override
|
||||||
|
{
|
||||||
|
aView->GetGAL()->DrawPolyline( m_polyLine );
|
||||||
|
}
|
||||||
|
|
||||||
|
SHAPE_LINE_CHAIN m_polyLine;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct VIEW_OVERLAY::COMMAND_POINT_POLYLINE : public VIEW_OVERLAY::COMMAND
|
||||||
|
{
|
||||||
|
COMMAND_POINT_POLYLINE( const VECTOR2D aPointList[], int aListSize )
|
||||||
|
{
|
||||||
|
m_pointList.reserve( aListSize );
|
||||||
|
|
||||||
|
for( int ii = 0; ii < aListSize; ii++ )
|
||||||
|
m_pointList.push_back( aPointList[ii] );
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void Execute( VIEW* aView ) const override
|
||||||
|
{
|
||||||
|
aView->GetGAL()->DrawPolyline( &m_pointList[0], (int)m_pointList.size() );
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<VECTOR2D> m_pointList;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct VIEW_OVERLAY::COMMAND_POLYGON : public VIEW_OVERLAY::COMMAND
|
||||||
|
{
|
||||||
|
COMMAND_POLYGON( const std::deque<VECTOR2D>& aPointList ) :
|
||||||
|
m_pointList( aPointList ) {}
|
||||||
|
|
||||||
|
virtual void Execute( VIEW* aView ) const override
|
||||||
|
{
|
||||||
|
aView->GetGAL()->DrawPolygon( m_pointList );
|
||||||
|
}
|
||||||
|
|
||||||
|
std::deque<VECTOR2D> m_pointList;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct VIEW_OVERLAY::COMMAND_POLY_POLYGON : public VIEW_OVERLAY::COMMAND
|
||||||
|
{
|
||||||
|
COMMAND_POLY_POLYGON( const SHAPE_POLY_SET& aPolySet ) :
|
||||||
|
m_polySet( aPolySet ) {}
|
||||||
|
|
||||||
|
virtual void Execute( VIEW* aView ) const override
|
||||||
|
{
|
||||||
|
aView->GetGAL()->DrawPolygon( m_polySet );
|
||||||
|
}
|
||||||
|
|
||||||
|
SHAPE_POLY_SET m_polySet;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct VIEW_OVERLAY::COMMAND_POINT_POLYGON : public VIEW_OVERLAY::COMMAND
|
||||||
|
{
|
||||||
|
COMMAND_POINT_POLYGON( const VECTOR2D aPointList[], int aListSize )
|
||||||
|
{
|
||||||
|
m_pointList.reserve( aListSize );
|
||||||
|
|
||||||
|
for( int ii = 0; ii < aListSize; ii++ )
|
||||||
|
m_pointList.push_back( aPointList[ii] );
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void Execute( VIEW* aView ) const override
|
||||||
|
{
|
||||||
|
aView->GetGAL()->DrawPolygon( &m_pointList[0], (int)m_pointList.size() );
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<VECTOR2D> m_pointList;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
struct VIEW_OVERLAY::COMMAND_SET_STROKE : public VIEW_OVERLAY::COMMAND
|
struct VIEW_OVERLAY::COMMAND_SET_STROKE : public VIEW_OVERLAY::COMMAND
|
||||||
{
|
{
|
||||||
COMMAND_SET_STROKE( bool aIsStroke ) :
|
COMMAND_SET_STROKE( bool aIsStroke ) :
|
||||||
|
@ -218,6 +328,8 @@ void VIEW_OVERLAY::Line( const SEG& aSeg )
|
||||||
|
|
||||||
void VIEW_OVERLAY::Segment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint, double aWidth )
|
void VIEW_OVERLAY::Segment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint, double aWidth )
|
||||||
{
|
{
|
||||||
|
SetLineWidth( aWidth );
|
||||||
|
Line( aStartPoint, aEndPoint );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -226,6 +338,34 @@ void VIEW_OVERLAY::Polyline( std::deque<VECTOR2D>& aPointList )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void VIEW_OVERLAY::Polyline( const VECTOR2D aPointList[], int aListSize )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void VIEW_OVERLAY::Polyline( const SHAPE_LINE_CHAIN& aLineChain )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void VIEW_OVERLAY::Polygon( const SHAPE_POLY_SET& aPolySet )
|
||||||
|
{
|
||||||
|
m_commands.push_back( new COMMAND_POLY_POLYGON( aPolySet ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void VIEW_OVERLAY::Polygon( const std::deque<VECTOR2D>& aPointList )
|
||||||
|
{
|
||||||
|
m_commands.push_back( new COMMAND_POLYGON( aPointList ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void VIEW_OVERLAY::Polygon( const VECTOR2D aPointList[], int aListSize )
|
||||||
|
{
|
||||||
|
m_commands.push_back( new COMMAND_POINT_POLYGON( aPointList, aListSize ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void VIEW_OVERLAY::Circle( const VECTOR2D& aCenterPoint, double aRadius )
|
void VIEW_OVERLAY::Circle( const VECTOR2D& aCenterPoint, double aRadius )
|
||||||
{
|
{
|
||||||
m_commands.push_back( new COMMAND_CIRCLE( aCenterPoint, aRadius ) );
|
m_commands.push_back( new COMMAND_CIRCLE( aCenterPoint, aRadius ) );
|
||||||
|
@ -233,9 +373,7 @@ void VIEW_OVERLAY::Circle( const VECTOR2D& aCenterPoint, double aRadius )
|
||||||
|
|
||||||
|
|
||||||
void VIEW_OVERLAY::Arc( const VECTOR2D& aCenterPoint,
|
void VIEW_OVERLAY::Arc( const VECTOR2D& aCenterPoint,
|
||||||
double aRadius,
|
double aRadius, double aStartAngle, double aEndAngle )
|
||||||
double aStartAngle,
|
|
||||||
double aEndAngle )
|
|
||||||
{
|
{
|
||||||
m_commands.push_back( new COMMAND_ARC( aCenterPoint, aRadius, aStartAngle, aEndAngle ) );
|
m_commands.push_back( new COMMAND_ARC( aCenterPoint, aRadius, aStartAngle, aEndAngle ) );
|
||||||
}
|
}
|
||||||
|
@ -243,11 +381,7 @@ void VIEW_OVERLAY::Arc( const VECTOR2D& aCenterPoint,
|
||||||
|
|
||||||
void VIEW_OVERLAY::Rectangle( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint )
|
void VIEW_OVERLAY::Rectangle( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint )
|
||||||
{
|
{
|
||||||
}
|
m_commands.push_back( new COMMAND_RECTANGLE( aStartPoint, aEndPoint ) );
|
||||||
|
|
||||||
|
|
||||||
void VIEW_OVERLAY::Polygon( const std::deque<VECTOR2D>& aPointList )
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,8 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
|
|
||||||
|
#include <geometry/shape_poly_set.h>
|
||||||
|
|
||||||
class SEG;
|
class SEG;
|
||||||
|
|
||||||
namespace KIGFX
|
namespace KIGFX
|
||||||
|
@ -49,25 +51,46 @@ public:
|
||||||
struct COMMAND_ARC;
|
struct COMMAND_ARC;
|
||||||
struct COMMAND_LINE;
|
struct COMMAND_LINE;
|
||||||
struct COMMAND_CIRCLE;
|
struct COMMAND_CIRCLE;
|
||||||
|
struct COMMAND_RECTANGLE;
|
||||||
|
|
||||||
struct COMMAND_SET_STROKE;
|
struct COMMAND_SET_STROKE;
|
||||||
struct COMMAND_SET_FILL;
|
struct COMMAND_SET_FILL;
|
||||||
struct COMMAND_SET_COLOR;
|
struct COMMAND_SET_COLOR;
|
||||||
struct COMMAND_SET_WIDTH;
|
struct COMMAND_SET_WIDTH;
|
||||||
|
|
||||||
|
struct COMMAND_POLYGON;
|
||||||
|
struct COMMAND_POINT_POLYGON;
|
||||||
|
struct COMMAND_POLY_POLYGON;
|
||||||
|
|
||||||
|
struct COMMAND_POLYLINE;
|
||||||
|
struct COMMAND_POINT_POLYLINE;
|
||||||
|
struct COMMAND_POLY_POLYLINE;
|
||||||
|
|
||||||
void Clear();
|
void Clear();
|
||||||
|
|
||||||
virtual const BOX2I ViewBBox() const override;
|
virtual const BOX2I ViewBBox() const override;
|
||||||
virtual void ViewDraw( int aLayer, VIEW *aView ) const override;
|
virtual void ViewDraw( int aLayer, VIEW *aView ) const override;
|
||||||
virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||||
|
|
||||||
|
// Basic shape primitives
|
||||||
void Line( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint );
|
void Line( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint );
|
||||||
void Line( const SEG& aSeg );
|
void Line( const SEG& aSeg );
|
||||||
void Segment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint, double aWidth );
|
void Segment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint, double aWidth );
|
||||||
void Polyline( std::deque<VECTOR2D>& aPointList );
|
|
||||||
void Circle( const VECTOR2D& aCenterPoint, double aRadius );
|
void Circle( const VECTOR2D& aCenterPoint, double aRadius );
|
||||||
void Arc( const VECTOR2D& aCenterPoint, double aRadius, double aStartAngle, double aEndAngle );
|
void Arc( const VECTOR2D& aCenterPoint, double aRadius, double aStartAngle, double aEndAngle );
|
||||||
void Rectangle( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint );
|
void Rectangle( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint );
|
||||||
|
|
||||||
|
// Polyline primitives
|
||||||
|
void Polyline( std::deque<VECTOR2D>& aPointList );
|
||||||
|
void Polyline( const VECTOR2D aPointList[], int aListSize );
|
||||||
|
void Polyline( const SHAPE_LINE_CHAIN& aLineChain );
|
||||||
|
|
||||||
|
// polygon primitives
|
||||||
void Polygon( const std::deque<VECTOR2D>& aPointList );
|
void Polygon( const std::deque<VECTOR2D>& aPointList );
|
||||||
|
void Polygon( const SHAPE_POLY_SET& aPolySet );
|
||||||
|
void Polygon( const VECTOR2D aPointList[], int aListSize );
|
||||||
|
|
||||||
|
// Draw settings
|
||||||
void SetIsFill( bool aIsFillEnabled );
|
void SetIsFill( bool aIsFillEnabled );
|
||||||
void SetIsStroke( bool aIsStrokeEnabled );
|
void SetIsStroke( bool aIsStrokeEnabled );
|
||||||
void SetFillColor( const COLOR4D& aColor );
|
void SetFillColor( const COLOR4D& aColor );
|
||||||
|
|
Loading…
Reference in New Issue