pcbnew: Plotting tables with non-90 degree rotation angles is not working
This commit is contained in:
@@ -1168,15 +1168,6 @@ void BRDITEMS_PLOTTER::PlotTableBorders( const PCB_TABLE* aTable )
|
||||
}
|
||||
};
|
||||
|
||||
auto strokeRect =
|
||||
[&]( const VECTOR2I& ptA, const VECTOR2I& ptB )
|
||||
{
|
||||
strokeLine( VECTOR2I( ptA.x, ptA.y ), VECTOR2I( ptB.x, ptA.y ) );
|
||||
strokeLine( VECTOR2I( ptB.x, ptA.y ), VECTOR2I( ptB.x, ptB.y ) );
|
||||
strokeLine( VECTOR2I( ptB.x, ptB.y ), VECTOR2I( ptA.x, ptB.y ) );
|
||||
strokeLine( VECTOR2I( ptA.x, ptB.y ), VECTOR2I( ptA.x, ptA.y ) );
|
||||
};
|
||||
|
||||
if( aTable->GetSeparatorsStroke().GetWidth() >= 0 )
|
||||
{
|
||||
setupStroke( aTable->GetSeparatorsStroke() );
|
||||
@@ -1185,16 +1176,22 @@ void BRDITEMS_PLOTTER::PlotTableBorders( const PCB_TABLE* aTable )
|
||||
{
|
||||
for( int col = 0; col < aTable->GetColCount() - 1; ++col )
|
||||
{
|
||||
for( int row = 0; row < aTable->GetRowCount(); ++row )
|
||||
int row = 1;
|
||||
if( aTable->StrokeHeader() )
|
||||
{
|
||||
PCB_TABLECELL* cell = aTable->GetCell( row, col );
|
||||
VECTOR2I topRight( cell->GetEndX(), cell->GetStartY() );
|
||||
row = 0;
|
||||
}
|
||||
|
||||
if( !cell->GetTextAngle().IsHorizontal() )
|
||||
topRight = VECTOR2I( cell->GetStartX(), cell->GetEndY() );
|
||||
for( ; row < aTable->GetRowCount(); ++row )
|
||||
{
|
||||
PCB_TABLECELL* cell = aTable->GetCell( row, col );
|
||||
std::vector<VECTOR2I> corners = cell->GetCornersInSequence();
|
||||
|
||||
if( cell->GetColSpan() > 0 && cell->GetRowSpan() > 0 )
|
||||
strokeLine( topRight, cell->GetEnd() );
|
||||
if( corners.size() == 4 )
|
||||
{
|
||||
// Draw right edge (between adjacent cells)
|
||||
strokeLine( corners[1], corners[2] );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1205,14 +1202,14 @@ void BRDITEMS_PLOTTER::PlotTableBorders( const PCB_TABLE* aTable )
|
||||
{
|
||||
for( int col = 0; col < aTable->GetColCount(); ++col )
|
||||
{
|
||||
PCB_TABLECELL* cell = aTable->GetCell( row, col );
|
||||
VECTOR2I botLeft( cell->GetStartX(), cell->GetEndY() );
|
||||
PCB_TABLECELL* cell = aTable->GetCell( row, col );
|
||||
std::vector<VECTOR2I> corners = cell->GetCornersInSequence();
|
||||
|
||||
if( !cell->GetTextAngle().IsHorizontal() )
|
||||
botLeft = VECTOR2I( cell->GetEndX(), cell->GetStartY() );
|
||||
|
||||
if( cell->GetColSpan() > 0 && cell->GetRowSpan() > 0 )
|
||||
strokeLine( botLeft, cell->GetEnd() );
|
||||
if( corners.size() == 4 )
|
||||
{
|
||||
// Draw bottom edge (between adjacent cells)
|
||||
strokeLine( corners[2], corners[3] );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1221,22 +1218,30 @@ void BRDITEMS_PLOTTER::PlotTableBorders( const PCB_TABLE* aTable )
|
||||
if( aTable->GetBorderStroke().GetWidth() >= 0 )
|
||||
{
|
||||
setupStroke( aTable->GetBorderStroke() );
|
||||
PCB_TABLECELL* cell = aTable->GetCell( 0, 0 );
|
||||
|
||||
std::vector<VECTOR2I> topLeft = aTable->GetCell( 0, 0 )->GetCornersInSequence();
|
||||
std::vector<VECTOR2I> bottomLeft =
|
||||
aTable->GetCell( aTable->GetRowCount() - 1, 0 )->GetCornersInSequence();
|
||||
std::vector<VECTOR2I> topRight =
|
||||
aTable->GetCell( 0, aTable->GetColCount() - 1 )->GetCornersInSequence();
|
||||
std::vector<VECTOR2I> bottomRight =
|
||||
aTable->GetCell( aTable->GetRowCount() - 1, aTable->GetColCount() - 1 )
|
||||
->GetCornersInSequence();
|
||||
|
||||
if( aTable->StrokeHeader() )
|
||||
{
|
||||
if( !cell->GetTextAngle().IsHorizontal() )
|
||||
strokeLine( VECTOR2I( cell->GetEndX(), pos.y ), VECTOR2I( cell->GetEndX(), cell->GetEndY() ) );
|
||||
else
|
||||
strokeLine( VECTOR2I( pos.x, cell->GetEndY() ), VECTOR2I( end.x, cell->GetEndY() ) );
|
||||
strokeLine( topLeft[0], topRight[1] );
|
||||
strokeLine( topLeft[0], topLeft[3] );
|
||||
strokeLine( topLeft[3], topRight[2] );
|
||||
strokeLine( topRight[1], topRight[2] );
|
||||
}
|
||||
|
||||
if( aTable->StrokeExternal() )
|
||||
{
|
||||
RotatePoint( pos, aTable->GetPosition(), cell->GetTextAngle() );
|
||||
RotatePoint( end, aTable->GetPosition(), cell->GetTextAngle() );
|
||||
|
||||
strokeRect( pos, end );
|
||||
strokeLine( topLeft[3], topRight[2] );
|
||||
strokeLine( topRight[2], bottomRight[2] );
|
||||
strokeLine( bottomRight[2], bottomLeft[3] );
|
||||
strokeLine( bottomLeft[3], topLeft[3] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user