Fixed bounding box for dimension.

This commit is contained in:
Maciej Suminski 2013-09-16 14:44:03 +02:00
parent 8a1c97ea56
commit 7207de9bea
2 changed files with 22 additions and 0 deletions

View File

@ -468,6 +468,15 @@ EDA_RECT DIMENSION::GetBoundingBox() const
ymax = std::max( ymax, m_featureLineGO.y );
ymax = std::max( ymax, m_featureLineGF.y );
xmin = std::min( xmin, m_featureLineDO.x );
xmin = std::min( xmin, m_featureLineDF.x );
ymin = std::min( ymin, m_featureLineDO.y );
ymin = std::min( ymin, m_featureLineDF.y );
xmax = std::max( xmax, m_featureLineDO.x );
xmax = std::max( xmax, m_featureLineDF.x );
ymax = std::max( ymax, m_featureLineDO.y );
ymax = std::max( ymax, m_featureLineDF.y );
bBox.SetX( xmin );
bBox.SetY( ymin );
bBox.SetWidth( xmax - xmin + 1 );
@ -489,6 +498,16 @@ wxString DIMENSION::GetSelectMenuText() const
}
const BOX2I DIMENSION::ViewBBox() const
{
BOX2I dimBBox = BOX2I( VECTOR2I( GetBoundingBox().GetPosition() ),
VECTOR2I( GetBoundingBox().GetSize() ) );
dimBBox.Merge( m_Text.ViewBBox() );
return dimBBox;
}
void DIMENSION::ViewGetLayers( int aLayers[], int& aCount ) const
{
// Layer that simply displays the text

View File

@ -144,6 +144,9 @@ public:
EDA_ITEM* Clone() const;
/// @copydoc VIEW_ITEM::ViewBBox()
virtual const BOX2I ViewBBox() const;
/// @copydoc VIEW_ITEM::ViewGetLayers()
virtual void ViewGetLayers( int aLayers[], int& aCount ) const;