EDA_TEXT: implement GetEffectiveShape()
This commit is contained in:
parent
b03044d3d1
commit
7dbd8ef802
|
@ -48,6 +48,11 @@
|
|||
#include <math/vector2d.h> // for VECTOR2D
|
||||
#include <trigo.h> // for RotatePoint
|
||||
|
||||
#include <geometry/shape.h>
|
||||
#include <geometry/shape_segment.h>
|
||||
#include <geometry/shape_compound.h>
|
||||
|
||||
|
||||
#include <wx/debug.h> // for wxASSERT
|
||||
#include <wx/wx.h> // for wxPoint, wxString, wxArrayString, wxSize
|
||||
|
||||
|
@ -612,6 +617,20 @@ void EDA_TEXT::TransformTextShapeToSegmentList( std::vector<wxPoint>& aCornerBuf
|
|||
}
|
||||
|
||||
|
||||
std::shared_ptr<SHAPE> EDA_TEXT::GetEffectiveShape( ) const
|
||||
{
|
||||
std::shared_ptr<SHAPE_COMPOUND> shape ( new SHAPE_COMPOUND );
|
||||
int penWidth = GetEffectiveTextPenWidth();
|
||||
std::vector<wxPoint> pts;
|
||||
TransformTextShapeToSegmentList( pts );
|
||||
|
||||
for( unsigned jj = 0; jj < pts.size(); jj += 2 )
|
||||
shape->AddShape( new SHAPE_SEGMENT( pts[jj], pts[jj+1], penWidth ) );
|
||||
|
||||
return shape;
|
||||
}
|
||||
|
||||
|
||||
static struct EDA_TEXT_DESC
|
||||
{
|
||||
EDA_TEXT_DESC()
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "kicad_string.h"
|
||||
#include "painter.h"
|
||||
|
||||
class SHAPE;
|
||||
class SHAPE_POLY_SET;
|
||||
|
||||
using KIGFX::RENDER_SETTINGS;
|
||||
|
@ -292,6 +293,8 @@ public:
|
|||
void TransformBoundingBoxWithClearanceToPolygon( SHAPE_POLY_SET* aCornerBuffer,
|
||||
int aClearanceValue ) const;
|
||||
|
||||
std::shared_ptr<SHAPE> GetEffectiveShape( ) const;
|
||||
|
||||
/**
|
||||
* Test if \a aPoint is within the bounds of this object.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue