EDA_TEXT: Use actual draw rotation angle to generate the effective shape.

Fixes: #5814
This commit is contained in:
Tomasz Wlostowski 2020-10-01 18:45:05 +02:00
parent bf9e2de1ac
commit 9b470b6c09
4 changed files with 15 additions and 4 deletions

View File

@ -603,14 +603,14 @@ void EDA_TEXT::TransformTextShapeToSegmentList( std::vector<wxPoint>& aCornerBuf
for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
{
wxString txt = strings_list.Item( ii );
GRText( NULL, positions[ii], color, txt, GetTextAngle(), size, GetHorizJustify(),
GRText( NULL, positions[ii], color, txt, GetDrawRotation(), size, GetHorizJustify(),
GetVertJustify(), penWidth, IsItalic(), forceBold, addTextSegmToBuffer,
&aCornerBuffer );
}
}
else
{
GRText( NULL, GetTextPos(), color, GetText(), GetTextAngle(), size, GetHorizJustify(),
GRText( NULL, GetTextPos(), color, GetText(), GetDrawRotation(), size, GetHorizJustify(),
GetVertJustify(), penWidth, IsItalic(), forceBold, addTextSegmToBuffer,
&aCornerBuffer );
}
@ -631,6 +631,12 @@ std::shared_ptr<SHAPE_COMPOUND> EDA_TEXT::GetEffectiveTextShape( ) const
}
double EDA_TEXT::GetDrawRotation() const
{
return GetTextAngle();
}
static struct EDA_TEXT_DESC
{
EDA_TEXT_DESC()

View File

@ -367,6 +367,8 @@ public:
*/
virtual void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const;
virtual double GetDrawRotation() const;
private:
wxString m_text;
wxString m_shown_text; // Cache of unescaped text for efficient access

View File

@ -457,7 +457,10 @@ wxString TEXTE_MODULE::GetShownText( int aDepth ) const
std::shared_ptr<SHAPE> TEXTE_MODULE::GetEffectiveShape( PCB_LAYER_ID aLayer ) const
{
return GetEffectiveTextShape();
const MODULE* module = static_cast<MODULE*>( GetParent() );
auto shape = GetEffectiveTextShape();
return shape;
}

View File

@ -181,7 +181,7 @@ public:
* @return the text rotation for drawings and plotting
* the footprint rotation is taken in account
*/
double GetDrawRotation() const;
virtual double GetDrawRotation() const override;
double GetDrawRotationRadians() const { return GetDrawRotation() * M_PI/1800; }
// Virtual function