added GetBoundingBox for SCH_TEXT. Beatufication.
This commit is contained in:
parent
dbb69b7505
commit
81b6cbcb09
|
@ -467,3 +467,54 @@ void SCH_GLOBALLABEL::CreateGraphicShape( int* corner_list, const wxPoint& Pos )
|
|||
|
||||
corner_list[12] = corner_list[0]; corner_list[13] = corner_list[1]; // closing
|
||||
}
|
||||
|
||||
|
||||
EDA_Rect SCH_TEXT::GetBoundingBox()
|
||||
{
|
||||
int x, y, dx, dy, dangle, length, height;
|
||||
|
||||
x = m_Pos.x;
|
||||
y = m_Pos.y;
|
||||
length = ( Pitch() * GetLength() );
|
||||
height = m_Size.y;
|
||||
|
||||
if( m_IsDangling )
|
||||
dangle = DANGLING_SYMBOL_SIZE;
|
||||
else
|
||||
dangle = 0;
|
||||
|
||||
switch( m_Orient ) // respect orientation
|
||||
{
|
||||
case 0: /* Horiz Normal Orientation (left justified) */
|
||||
dx = 2*dangle + length;
|
||||
dy = -2*dangle - height - TXTMARGE;
|
||||
x -= dangle;
|
||||
y += dangle;
|
||||
break;
|
||||
|
||||
case 1: /* Vert Orientation UP */
|
||||
dx = -2*dangle - height - TXTMARGE;
|
||||
dy = -2*dangle - length;
|
||||
x += dangle;
|
||||
y += dangle;
|
||||
break;
|
||||
|
||||
case 2: /* Horiz Orientation - Right justified */
|
||||
dx = -2*dangle - length;
|
||||
dy = -2*dangle - height - TXTMARGE;
|
||||
x += dangle;
|
||||
y += dangle;
|
||||
break;
|
||||
|
||||
case 3: /* Vert Orientation BOTTOM */
|
||||
dx = -2*dangle - height - TXTMARGE;
|
||||
dy = 2*dangle + length;
|
||||
x += dangle;
|
||||
y -= dangle;
|
||||
break;
|
||||
}
|
||||
|
||||
EDA_Rect box(wxPoint(x,y), wxSize(dx,dy) );
|
||||
box.Normalize();
|
||||
return box;
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ class SCH_TEXT : public SCH_ITEM
|
|||
public:
|
||||
int m_Layer;
|
||||
int m_Shape;
|
||||
bool m_IsDangling; // TRUE si non connect<63>
|
||||
bool m_IsDangling; // TRUE if not connected
|
||||
|
||||
public:
|
||||
SCH_TEXT( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString,
|
||||
|
@ -102,6 +102,7 @@ public:
|
|||
void SwapData( SCH_TEXT* copyitem );
|
||||
|
||||
virtual void Place( WinEDA_DrawFrame* frame, wxDC* DC );
|
||||
EDA_Rect GetBoundingBox();
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ public:
|
|||
|
||||
virtual wxString GetClass() const
|
||||
{
|
||||
return wxT( "PartText" );
|
||||
return wxT( "PartTextStruct" );
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue