added GetBoundingBox for SCH_TEXT. Beatufication.

This commit is contained in:
diemer 2008-03-27 21:24:50 +00:00
parent dbb69b7505
commit 81b6cbcb09
4 changed files with 55 additions and 3 deletions

View File

@ -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;
}

View File

@ -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();
};

View File

@ -52,7 +52,7 @@ public:
virtual wxString GetClass() const
{
return wxT( "PartText" );
return wxT( "PartTextStruct" );
}

View File

@ -191,7 +191,7 @@ int distance(int dx, int dy, int spot_cX, int spot_cY, int seuil);
/***************/
/* EEREDRAW.CPP */
/***************/
void DrawDanglingSymbol(WinEDA_DrawPanel * panel,wxDC * DC,
void DrawDanglingSymbol(WinEDA_DrawPanel * panel,wxDC * DC,
const wxPoint & pos, int Color);
void Draw_Marqueur(WinEDA_DrawPanel * panel, wxDC * DC,