SHAPE_LINE_CHAIN: Fix/unify constructors

This commit is contained in:
Roberto Fernandez Bautista 2024-02-26 19:06:53 +01:00
parent 8340779f5b
commit 5add7a0ca0
2 changed files with 24 additions and 18 deletions

View File

@ -173,25 +173,9 @@ public:
SHAPE_LINE_CHAIN( const std::vector<int>& aV );
SHAPE_LINE_CHAIN( const std::vector<VECTOR2I>& aV, bool aClosed = false ) :
SHAPE_LINE_CHAIN_BASE( SH_LINE_CHAIN ),
m_closed( aClosed ),
m_width( 0 )
{
m_points = aV;
m_shapes = std::vector<std::pair<ssize_t, ssize_t>>( aV.size(), SHAPES_ARE_PT );
}
SHAPE_LINE_CHAIN( const std::vector<VECTOR2I>& aV, bool aClosed = false );
SHAPE_LINE_CHAIN( const SHAPE_ARC& aArc, bool aClosed = false ) :
SHAPE_LINE_CHAIN_BASE( SH_LINE_CHAIN ),
m_closed( aClosed ),
m_width( 0 )
{
m_points = aArc.ConvertToPolyline().CPoints();
m_arcs.emplace_back( aArc );
m_arcs.back().SetWidth( 0 );
m_shapes = std::vector<std::pair<ssize_t, ssize_t>>( m_points.size(), { 0, SHAPE_IS_PT } );
}
SHAPE_LINE_CHAIN( const SHAPE_ARC& aArc, bool aClosed = false );
SHAPE_LINE_CHAIN( const ClipperLib::Path& aPath,
const std::vector<CLIPPER_Z_VALUE>& aZValueBuffer,

View File

@ -45,6 +45,7 @@ class SHAPE;
const ssize_t SHAPE_LINE_CHAIN::SHAPE_IS_PT = -1;
const std::pair<ssize_t, ssize_t> SHAPE_LINE_CHAIN::SHAPES_ARE_PT = { SHAPE_IS_PT, SHAPE_IS_PT };
SHAPE_LINE_CHAIN::SHAPE_LINE_CHAIN( const std::vector<int>& aV)
: SHAPE_LINE_CHAIN_BASE( SH_LINE_CHAIN ), m_closed( false ), m_width( 0 )
{
@ -55,6 +56,27 @@ SHAPE_LINE_CHAIN::SHAPE_LINE_CHAIN( const std::vector<int>& aV)
}
SHAPE_LINE_CHAIN::SHAPE_LINE_CHAIN( const std::vector<VECTOR2I>& aV, bool aClosed ) :
SHAPE_LINE_CHAIN_BASE( SH_LINE_CHAIN ),
m_closed( false ),
m_width( 0 )
{
m_points = aV;
m_shapes = std::vector<std::pair<ssize_t, ssize_t>>( aV.size(), SHAPES_ARE_PT );
SetClosed( aClosed );
}
SHAPE_LINE_CHAIN::SHAPE_LINE_CHAIN( const SHAPE_ARC& aArc, bool aClosed ) :
SHAPE_LINE_CHAIN_BASE( SH_LINE_CHAIN ),
m_closed( false ),
m_width( aArc.GetWidth() )
{
Append( aArc );
SetClosed( aClosed );
}
SHAPE_LINE_CHAIN::SHAPE_LINE_CHAIN( const ClipperLib::Path& aPath,
const std::vector<CLIPPER_Z_VALUE>& aZValueBuffer,
const std::vector<SHAPE_ARC>& aArcBuffer ) :