Commit a853fb11 authored by diemer's avatar diemer

Added GetBoundingBox() for SCH_GLOBALLABEL and SCH_HIERLABEL.

parent c86da05a
......@@ -305,6 +305,56 @@ void SCH_HIERLABEL::CreateGraphicShape( int* corner_list, const wxPoint& Pos )
}
}
EDA_Rect SCH_HIERLABEL::GetBoundingBox()
{
int x, y, dx, dy, dangle, length, height;
x = m_Pos.x;
y = m_Pos.y;
if( m_IsDangling )
dangle = DANGLING_SYMBOL_SIZE;
else
dangle = 0;
height = m_Size.y + 2*TXTMARGE;
length = ( Pitch() * GetLength() ) + height + 2*dangle; // add height for triangular shapes
switch( m_Orient ) // respect orientation
{
case 0: /* Horiz Normal Orientation (left justified) */
dx = -length;
dy = height;
x += dangle;
y -= height/2;
break;
case 1: /* Vert Orientation UP */
dx = height;
dy = length;
x -= height/2;
y -= dangle;
break;
case 2: /* Horiz Orientation - Right justified */
dx = length;
dy = height;
x -= dangle;
y -= height/2;
break;
case 3: /* Vert Orientation BOTTOM */
dx = height;
dy = -length;
x -= height/2;
y += dangle;
break;
}
EDA_Rect box(wxPoint(x,y), wxSize(dx,dy) );
box.Normalize();
return box;
}
/*******************************************************************************************/
void SCH_GLOBALLABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& draw_offset,
......@@ -469,6 +519,58 @@ void SCH_GLOBALLABEL::CreateGraphicShape( int* corner_list, const wxPoint& Pos )
}
EDA_Rect SCH_GLOBALLABEL::GetBoundingBox()
{
int x, y, dx, dy, dangle, length, height;
x = m_Pos.x;
y = m_Pos.y;
if( m_IsDangling )
dangle = DANGLING_SYMBOL_SIZE;
else
dangle = 0;
height = m_Size.y + 2*TXTMARGE;
length = ( Pitch() * GetLength() ) + 2* height + 2*dangle; // add 2*height for triangular shapes (bidirectional)
switch( m_Orient ) // respect orientation
{
case 0: /* Horiz Normal Orientation (left justified) */
dx = -length;
dy = height;
x += dangle;
y -= height/2;
break;
case 1: /* Vert Orientation UP */
dx = height;
dy = length;
x -= height/2;
y -= dangle;
break;
case 2: /* Horiz Orientation - Right justified */
dx = length;
dy = height;
x -= dangle;
y -= height/2;
break;
case 3: /* Vert Orientation BOTTOM */
dx = height;
dy = -length;
x -= height/2;
y += dangle;
break;
}
EDA_Rect box(wxPoint(x,y), wxSize(dx,dy) );
box.Normalize();
return box;
}
EDA_Rect SCH_TEXT::GetBoundingBox()
{
int x, y, dx, dy, dangle, length, height;
......
......@@ -144,6 +144,8 @@ public:
* <corner_count>, x0, y0, ... xn, yn
*/
void CreateGraphicShape( int* corner_list, const wxPoint & Pos );
EDA_Rect GetBoundingBox();
};
......@@ -171,6 +173,8 @@ public:
* <corner_count>, x0, y0, ... xn, yn
*/
void CreateGraphicShape( int* corner_list, const wxPoint & Pos );
EDA_Rect GetBoundingBox();
};
#endif /* CLASS_TEXT_LABEL_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment