2009-11-12 15:43:38 +00:00
|
|
|
/*****************************/
|
2010-04-23 09:54:40 +00:00
|
|
|
/* DIMENSION class definition */
|
2009-11-12 15:43:38 +00:00
|
|
|
/*****************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "gr_basic.h"
|
|
|
|
#include "common.h"
|
|
|
|
#include "pcbnew.h"
|
2007-08-08 20:51:08 +00:00
|
|
|
#include "trigo.h"
|
2007-08-20 19:33:15 +00:00
|
|
|
#include "wxstruct.h"
|
2009-10-28 11:48:47 +00:00
|
|
|
#include "class_board_design_settings.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "class_drawpanel.h"
|
2010-01-29 20:36:12 +00:00
|
|
|
#include "colors_selection.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "kicad_string.h"
|
2009-08-01 19:26:05 +00:00
|
|
|
#include "protos.h"
|
2011-01-14 17:43:30 +00:00
|
|
|
#include "richio.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-04-23 09:54:40 +00:00
|
|
|
DIMENSION::DIMENSION( BOARD_ITEM* aParent ) :
|
|
|
|
BOARD_ITEM( aParent, TYPE_DIMENSION )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-08 20:51:08 +00:00
|
|
|
m_Layer = DRAW_LAYER;
|
|
|
|
m_Width = 50;
|
|
|
|
m_Value = 0;
|
|
|
|
m_Shape = 0;
|
|
|
|
m_Unit = INCHES;
|
|
|
|
m_Text = new TEXTE_PCB( this );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-08 20:51:08 +00:00
|
|
|
|
2010-04-23 09:54:40 +00:00
|
|
|
DIMENSION::~DIMENSION()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-08 20:51:08 +00:00
|
|
|
delete m_Text;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-08 20:51:08 +00:00
|
|
|
|
2007-09-25 08:23:53 +00:00
|
|
|
/* Setup the dimension text */
|
2010-04-23 09:54:40 +00:00
|
|
|
void DIMENSION::SetText( const wxString& NewText )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-08 20:51:08 +00:00
|
|
|
m_Text->m_Text = NewText;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
/* Return the dimension text
|
2007-09-25 08:23:53 +00:00
|
|
|
*/
|
2010-04-23 09:54:40 +00:00
|
|
|
wxString DIMENSION::GetText( void )
|
2007-09-25 08:23:53 +00:00
|
|
|
{
|
2008-04-01 05:21:50 +00:00
|
|
|
return m_Text->m_Text;
|
2007-09-25 08:23:53 +00:00
|
|
|
}
|
|
|
|
|
2009-08-03 07:55:08 +00:00
|
|
|
/**
|
|
|
|
* Function SetLayer
|
|
|
|
* sets the layer this item is on.
|
|
|
|
* @param aLayer The layer number.
|
|
|
|
*/
|
2010-04-23 09:54:40 +00:00
|
|
|
void DIMENSION::SetLayer( int aLayer )
|
2009-08-03 07:55:08 +00:00
|
|
|
{
|
|
|
|
m_Layer = aLayer;
|
|
|
|
m_Text->SetLayer( aLayer);
|
|
|
|
}
|
2007-09-25 08:23:53 +00:00
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
|
2010-04-23 09:54:40 +00:00
|
|
|
void DIMENSION::Copy( DIMENSION* source )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-08 20:51:08 +00:00
|
|
|
m_Value = source->m_Value;
|
2007-08-23 04:28:46 +00:00
|
|
|
SetLayer( source->GetLayer() );
|
2007-08-08 20:51:08 +00:00
|
|
|
m_Width = source->m_Width;
|
|
|
|
m_Pos = source->m_Pos;
|
|
|
|
m_Shape = source->m_Shape;
|
|
|
|
m_Unit = source->m_Unit;
|
|
|
|
m_TimeStamp = GetTimeStamp();
|
|
|
|
m_Text->Copy( source->m_Text );
|
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
Barre_ox = source->Barre_ox;
|
|
|
|
Barre_oy = source->Barre_oy;
|
|
|
|
Barre_fx = source->Barre_fx;
|
|
|
|
Barre_fy = source->Barre_fy;
|
|
|
|
TraitG_ox = source->TraitG_ox;
|
|
|
|
TraitG_oy = source->TraitG_oy;
|
|
|
|
TraitG_fx = source->TraitG_fx;
|
|
|
|
TraitG_fy = source->TraitG_fy;
|
|
|
|
TraitD_ox = source->TraitD_ox;
|
|
|
|
TraitD_oy = source->TraitD_oy;
|
|
|
|
TraitD_fx = source->TraitD_fx;
|
|
|
|
TraitD_fy = source->TraitD_fy;
|
|
|
|
FlecheD1_ox = source->FlecheD1_ox;
|
|
|
|
FlecheD1_oy = source->FlecheD1_oy;
|
|
|
|
FlecheD1_fx = source->FlecheD1_fx;
|
|
|
|
FlecheD1_fy = source->FlecheD1_fy;
|
|
|
|
FlecheD2_ox = source->FlecheD2_ox;
|
|
|
|
FlecheD2_oy = source->FlecheD2_oy;
|
|
|
|
FlecheD2_fx = source->FlecheD2_fx;
|
|
|
|
FlecheD2_fy = source->FlecheD2_fy;
|
|
|
|
FlecheG1_ox = source->FlecheG1_ox;
|
|
|
|
FlecheG1_oy = source->FlecheG1_oy;
|
|
|
|
FlecheG1_fx = source->FlecheG1_fx;
|
|
|
|
FlecheG1_fy = source->FlecheG1_fy;
|
|
|
|
FlecheG2_ox = source->FlecheG2_ox;
|
|
|
|
FlecheG2_oy = source->FlecheG2_oy;
|
|
|
|
FlecheG2_fx = source->FlecheG2_fx;
|
|
|
|
FlecheG2_fy = source->FlecheG2_fy;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-01-14 17:43:30 +00:00
|
|
|
bool DIMENSION::ReadDimensionDescr( LINE_READER* aReader )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2011-01-14 17:43:30 +00:00
|
|
|
char* Line;
|
|
|
|
char Text[2048];
|
2007-08-08 20:51:08 +00:00
|
|
|
|
2011-01-14 17:43:30 +00:00
|
|
|
while( aReader->ReadLine() )
|
2007-08-08 20:51:08 +00:00
|
|
|
{
|
2011-01-14 17:43:30 +00:00
|
|
|
Line = aReader->Line();
|
2010-04-23 09:54:40 +00:00
|
|
|
if( strnicmp( Line, "$EndDIMENSION", 4 ) == 0 )
|
2007-08-08 20:51:08 +00:00
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
if( Line[0] == 'V' )
|
|
|
|
{
|
|
|
|
sscanf( Line + 2, " %d", &m_Value );
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( Line[0] == 'G' )
|
|
|
|
{
|
2007-08-23 04:28:46 +00:00
|
|
|
int layer;
|
2008-04-01 05:21:50 +00:00
|
|
|
|
2007-08-23 04:28:46 +00:00
|
|
|
sscanf( Line + 2, " %d %d %lX", &m_Shape, &layer, &m_TimeStamp );
|
2007-08-08 20:51:08 +00:00
|
|
|
|
2007-08-23 04:28:46 +00:00
|
|
|
if( layer < FIRST_NO_COPPER_LAYER )
|
|
|
|
layer = FIRST_NO_COPPER_LAYER;
|
|
|
|
if( layer > LAST_NO_COPPER_LAYER )
|
|
|
|
layer = LAST_NO_COPPER_LAYER;
|
2007-08-08 20:51:08 +00:00
|
|
|
|
2007-08-23 04:28:46 +00:00
|
|
|
SetLayer( layer );
|
|
|
|
m_Text->SetLayer( layer );
|
2007-08-08 20:51:08 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( Line[0] == 'T' )
|
|
|
|
{
|
|
|
|
ReadDelimitedText( Text, Line + 2, sizeof(Text) );
|
2011-02-28 18:36:19 +00:00
|
|
|
m_Text->m_Text = FROM_UTF8( Text );
|
2007-08-08 20:51:08 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( Line[0] == 'P' )
|
|
|
|
{
|
2009-11-12 15:43:38 +00:00
|
|
|
int normal_display = 1;
|
2007-08-08 20:51:08 +00:00
|
|
|
sscanf( Line + 2, " %d %d %d %d %d %d %d",
|
|
|
|
&m_Text->m_Pos.x, &m_Text->m_Pos.y,
|
|
|
|
&m_Text->m_Size.x, &m_Text->m_Size.y,
|
2010-11-27 13:09:18 +00:00
|
|
|
&m_Text->m_Thickness, &m_Text->m_Orient,
|
2008-12-20 20:38:39 +00:00
|
|
|
&normal_display );
|
2007-08-08 20:51:08 +00:00
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
m_Text->m_Mirror = normal_display ? false : true;
|
2007-08-08 20:51:08 +00:00
|
|
|
m_Pos = m_Text->m_Pos;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( Line[0] == 'S' )
|
|
|
|
{
|
|
|
|
switch( Line[1] )
|
|
|
|
{
|
|
|
|
int Dummy;
|
|
|
|
|
|
|
|
case 'b':
|
|
|
|
sscanf( Line + 2, " %d %d %d %d %d %d",
|
|
|
|
&Dummy,
|
|
|
|
&Barre_ox, &Barre_oy,
|
|
|
|
&Barre_fx, &Barre_fy,
|
|
|
|
&m_Width );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'd':
|
|
|
|
sscanf( Line + 2, " %d %d %d %d %d %d",
|
|
|
|
&Dummy,
|
|
|
|
&TraitD_ox, &TraitD_oy,
|
|
|
|
&TraitD_fx, &TraitD_fy,
|
|
|
|
&Dummy );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'g':
|
|
|
|
sscanf( Line + 2, " %d %d %d %d %d %d",
|
|
|
|
&Dummy,
|
|
|
|
&TraitG_ox, &TraitG_oy,
|
|
|
|
&TraitG_fx, &TraitG_fy,
|
|
|
|
&Dummy );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case '1':
|
|
|
|
sscanf( Line + 2, " %d %d %d %d %d %d",
|
|
|
|
&Dummy,
|
|
|
|
&FlecheD1_ox, &FlecheD1_oy,
|
|
|
|
&FlecheD1_fx, &FlecheD1_fy,
|
|
|
|
&Dummy );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case '2':
|
|
|
|
sscanf( Line + 2, " %d %d %d %d %d %d",
|
|
|
|
&Dummy,
|
|
|
|
&FlecheD2_ox, &FlecheD2_oy,
|
|
|
|
&FlecheD2_fx, &FlecheD2_fy,
|
|
|
|
&Dummy );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case '3':
|
|
|
|
sscanf( Line + 2, " %d %d %d %d %d %d\n",
|
|
|
|
&Dummy,
|
|
|
|
&FlecheG1_ox, &FlecheG1_oy,
|
|
|
|
&FlecheG1_fx, &FlecheG1_fy,
|
|
|
|
&Dummy );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case '4':
|
|
|
|
sscanf( Line + 2, " %d %d %d %d %d %d",
|
|
|
|
&Dummy,
|
|
|
|
&FlecheG2_ox, &FlecheG2_oy,
|
|
|
|
&FlecheG2_fx, &FlecheG2_fy,
|
|
|
|
&Dummy );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
|
2008-01-06 12:43:57 +00:00
|
|
|
/**
|
|
|
|
* Function Move
|
|
|
|
* @param offset : moving vector
|
|
|
|
*/
|
2010-04-23 09:54:40 +00:00
|
|
|
void DIMENSION::Move(const wxPoint& offset)
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-04-01 05:21:50 +00:00
|
|
|
m_Pos += offset;
|
|
|
|
m_Text->m_Pos += offset;
|
2009-11-12 15:43:38 +00:00
|
|
|
Barre_ox += offset.x;
|
|
|
|
Barre_oy += offset.y;
|
|
|
|
Barre_fx += offset.x;
|
|
|
|
Barre_fy += offset.y;
|
|
|
|
TraitG_ox += offset.x;
|
|
|
|
TraitG_oy += offset.y;
|
|
|
|
TraitG_fx += offset.x;
|
|
|
|
TraitG_fy += offset.y;
|
|
|
|
TraitD_ox += offset.x;
|
|
|
|
TraitD_oy += offset.y;
|
|
|
|
TraitD_fx += offset.x;
|
|
|
|
TraitD_fy += offset.y;
|
|
|
|
FlecheG1_ox += offset.x;
|
|
|
|
FlecheG1_oy += offset.y;
|
|
|
|
FlecheG1_fx += offset.x;
|
|
|
|
FlecheG1_fy += offset.y;
|
|
|
|
FlecheG2_ox += offset.x;
|
|
|
|
FlecheG2_oy += offset.y;
|
|
|
|
FlecheG2_fx += offset.x;
|
|
|
|
FlecheG2_fy += offset.y;
|
|
|
|
FlecheD1_ox += offset.x;
|
|
|
|
FlecheD1_oy += offset.y;
|
|
|
|
FlecheD1_fx += offset.x;
|
|
|
|
FlecheD1_fy += offset.y;
|
|
|
|
FlecheD2_ox += offset.x;
|
|
|
|
FlecheD2_oy += offset.y;
|
|
|
|
FlecheD2_fx += offset.x;
|
|
|
|
FlecheD2_fy += offset.y;
|
2008-01-06 12:43:57 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2008-01-06 12:43:57 +00:00
|
|
|
/**
|
|
|
|
* Function Rotate
|
2010-12-29 17:47:32 +00:00
|
|
|
* @param aRotCentre - the rotation point.
|
|
|
|
* @param aAngle - the rotation angle in 0.1 degree.
|
2008-01-06 12:43:57 +00:00
|
|
|
*/
|
2010-12-29 17:47:32 +00:00
|
|
|
void DIMENSION::Rotate(const wxPoint& aRotCentre, int aAngle)
|
2008-01-06 12:43:57 +00:00
|
|
|
{
|
2010-12-29 17:47:32 +00:00
|
|
|
RotatePoint( &m_Pos, aRotCentre, aAngle );
|
2008-04-01 05:21:50 +00:00
|
|
|
|
2010-12-29 17:47:32 +00:00
|
|
|
RotatePoint( &m_Text->m_Pos, aRotCentre, aAngle );
|
|
|
|
m_Text->m_Orient += aAngle;
|
2008-04-01 05:21:50 +00:00
|
|
|
if( m_Text->m_Orient >= 3600 )
|
|
|
|
m_Text->m_Orient -= 3600;
|
2009-11-12 15:43:38 +00:00
|
|
|
if( ( m_Text->m_Orient > 900 ) && ( m_Text->m_Orient <2700 ) )
|
2008-04-01 05:21:50 +00:00
|
|
|
m_Text->m_Orient -= 1800;
|
|
|
|
|
2010-12-29 17:47:32 +00:00
|
|
|
RotatePoint( &Barre_ox, &Barre_oy, aRotCentre.x, aRotCentre.y, aAngle );
|
|
|
|
RotatePoint( &Barre_fx, &Barre_fy, aRotCentre.x, aRotCentre.y, aAngle );
|
|
|
|
RotatePoint( &TraitG_ox, &TraitG_oy, aRotCentre.x, aRotCentre.y, aAngle );
|
|
|
|
RotatePoint( &TraitG_fx, &TraitG_fy, aRotCentre.x, aRotCentre.y, aAngle );
|
|
|
|
RotatePoint( &TraitD_ox, &TraitD_oy, aRotCentre.x, aRotCentre.y, aAngle );
|
|
|
|
RotatePoint( &TraitD_fx, &TraitD_fy, aRotCentre.x, aRotCentre.y, aAngle );
|
|
|
|
RotatePoint( &FlecheG1_ox, &FlecheG1_oy, aRotCentre.x, aRotCentre.y, aAngle );
|
|
|
|
RotatePoint( &FlecheG1_fx, &FlecheG1_fy, aRotCentre.x, aRotCentre.y, aAngle );
|
|
|
|
RotatePoint( &FlecheG2_ox, &FlecheG2_oy, aRotCentre.x, aRotCentre.y, aAngle );
|
|
|
|
RotatePoint( &FlecheG2_fx, &FlecheG2_fy, aRotCentre.x, aRotCentre.y, aAngle );
|
|
|
|
RotatePoint( &FlecheD1_ox, &FlecheD1_oy, aRotCentre.x, aRotCentre.y, aAngle );
|
|
|
|
RotatePoint( &FlecheD1_fx, &FlecheD1_fy, aRotCentre.x, aRotCentre.y, aAngle );
|
|
|
|
RotatePoint( &FlecheD2_ox, &FlecheD2_oy, aRotCentre.x, aRotCentre.y, aAngle );
|
|
|
|
RotatePoint( &FlecheD2_fx, &FlecheD2_fy, aRotCentre.x, aRotCentre.y, aAngle );
|
2008-01-06 12:43:57 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
|
2009-08-01 19:26:05 +00:00
|
|
|
/**
|
|
|
|
* Function Flip
|
|
|
|
* Flip this object, i.e. change the board side for this object
|
2010-12-29 17:47:32 +00:00
|
|
|
* @param aCentre - the rotation point.
|
2009-08-01 19:26:05 +00:00
|
|
|
*/
|
2010-04-23 09:54:40 +00:00
|
|
|
void DIMENSION::Flip(const wxPoint& aCentre )
|
2009-08-01 19:26:05 +00:00
|
|
|
{
|
|
|
|
Mirror( aCentre );
|
|
|
|
SetLayer( ChangeSideNumLayer( GetLayer() ) );
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
|
2008-01-06 12:43:57 +00:00
|
|
|
/**
|
|
|
|
* Function Mirror
|
|
|
|
* Mirror the Dimension , relative to a given horizontal axis
|
|
|
|
* the text is not mirrored. only its position (and angle) is mirrored
|
|
|
|
* the layer is not changed
|
|
|
|
* @param axis_pos : vertical axis position
|
|
|
|
*/
|
2010-04-23 09:54:40 +00:00
|
|
|
void DIMENSION::Mirror(const wxPoint& axis_pos)
|
2008-01-06 12:43:57 +00:00
|
|
|
{
|
|
|
|
#define INVERT( pos ) (pos) = axis_pos.y - ( (pos) - axis_pos.y )
|
|
|
|
#define INVERT_ANGLE( phi ) (phi) = -(phi)
|
2008-04-01 05:21:50 +00:00
|
|
|
INVERT( m_Pos.y );
|
|
|
|
INVERT( m_Text->m_Pos.y );
|
|
|
|
INVERT_ANGLE( m_Text->m_Orient );
|
|
|
|
if( m_Text->m_Orient >= 3600 )
|
|
|
|
m_Text->m_Orient -= 3600;
|
2009-11-12 15:43:38 +00:00
|
|
|
if( ( m_Text->m_Orient > 900 ) && ( m_Text->m_Orient < 2700 ) )
|
2008-04-01 05:21:50 +00:00
|
|
|
m_Text->m_Orient -= 1800;
|
|
|
|
|
|
|
|
INVERT( Barre_oy );
|
|
|
|
INVERT( Barre_fy );
|
|
|
|
INVERT( TraitG_oy );
|
|
|
|
INVERT( TraitG_fy );
|
|
|
|
INVERT( TraitD_oy );
|
|
|
|
INVERT( TraitD_fy );
|
|
|
|
INVERT( FlecheG1_oy );
|
|
|
|
INVERT( FlecheG1_fy );
|
|
|
|
INVERT( FlecheG2_oy );
|
|
|
|
INVERT( FlecheG2_fy );
|
|
|
|
INVERT( FlecheD1_oy );
|
|
|
|
INVERT( FlecheD1_fy );
|
|
|
|
INVERT( FlecheD2_oy );
|
|
|
|
INVERT( FlecheD2_fy );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
2007-10-30 21:30:58 +00:00
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
|
2010-04-23 09:54:40 +00:00
|
|
|
bool DIMENSION::Save( FILE* aFile ) const
|
2007-10-30 21:30:58 +00:00
|
|
|
{
|
|
|
|
bool rc = false;
|
2010-04-23 09:54:40 +00:00
|
|
|
// note: COTATION was the previous name of DIMENSION
|
|
|
|
// this old keyword is used here for compatibility
|
|
|
|
const char keyWordLine[] = "$COTATION\n";
|
|
|
|
const char keyWordLineEnd[] = "$endCOTATION\n";
|
2008-04-01 05:21:50 +00:00
|
|
|
|
2010-05-02 19:35:46 +00:00
|
|
|
if( fputs( keyWordLine, aFile ) == EOF )
|
2007-10-30 21:30:58 +00:00
|
|
|
goto out;
|
|
|
|
|
|
|
|
fprintf( aFile, "Ge %d %d %lX\n", m_Shape, m_Layer, m_TimeStamp );
|
|
|
|
|
|
|
|
fprintf( aFile, "Va %d\n", m_Value );
|
|
|
|
|
|
|
|
if( !m_Text->m_Text.IsEmpty() )
|
2011-03-25 20:07:27 +00:00
|
|
|
fprintf( aFile, "Te %s\n", EscapedUTF8( m_Text->m_Text ).c_str() );
|
2007-10-30 21:30:58 +00:00
|
|
|
else
|
|
|
|
fprintf( aFile, "Te \"?\"\n" );
|
|
|
|
|
|
|
|
fprintf( aFile, "Po %d %d %d %d %d %d %d\n",
|
|
|
|
m_Text->m_Pos.x, m_Text->m_Pos.y,
|
|
|
|
m_Text->m_Size.x, m_Text->m_Size.y,
|
2010-11-27 13:09:18 +00:00
|
|
|
m_Text->m_Thickness, m_Text->m_Orient,
|
2008-12-20 20:38:39 +00:00
|
|
|
m_Text->m_Mirror ? 0 : 1 );
|
2007-10-30 21:30:58 +00:00
|
|
|
|
|
|
|
fprintf( aFile, "Sb %d %d %d %d %d %d\n", S_SEGMENT,
|
|
|
|
Barre_ox, Barre_oy,
|
|
|
|
Barre_fx, Barre_fy, m_Width );
|
|
|
|
|
|
|
|
fprintf( aFile, "Sd %d %d %d %d %d %d\n", S_SEGMENT,
|
|
|
|
TraitD_ox, TraitD_oy,
|
|
|
|
TraitD_fx, TraitD_fy, m_Width );
|
|
|
|
|
|
|
|
fprintf( aFile, "Sg %d %d %d %d %d %d\n", S_SEGMENT,
|
|
|
|
TraitG_ox, TraitG_oy,
|
|
|
|
TraitG_fx, TraitG_fy, m_Width );
|
|
|
|
|
|
|
|
fprintf( aFile, "S1 %d %d %d %d %d %d\n", S_SEGMENT,
|
|
|
|
FlecheD1_ox, FlecheD1_oy,
|
|
|
|
FlecheD1_fx, FlecheD1_fy, m_Width );
|
|
|
|
|
|
|
|
fprintf( aFile, "S2 %d %d %d %d %d %d\n", S_SEGMENT,
|
|
|
|
FlecheD2_ox, FlecheD2_oy,
|
|
|
|
FlecheD2_fx, FlecheD2_fy, m_Width );
|
|
|
|
|
|
|
|
|
|
|
|
fprintf( aFile, "S3 %d %d %d %d %d %d\n", S_SEGMENT,
|
|
|
|
FlecheG1_ox, FlecheG1_oy,
|
|
|
|
FlecheG1_fx, FlecheG1_fy, m_Width );
|
|
|
|
|
|
|
|
fprintf( aFile, "S4 %d %d %d %d %d %d\n", S_SEGMENT,
|
|
|
|
FlecheG2_ox, FlecheG2_oy,
|
|
|
|
FlecheG2_fx, FlecheG2_fy, m_Width );
|
|
|
|
|
2010-05-02 19:35:46 +00:00
|
|
|
if( fputs( keyWordLineEnd, aFile ) == EOF )
|
2007-10-30 21:30:58 +00:00
|
|
|
goto out;
|
2008-04-01 05:21:50 +00:00
|
|
|
|
2007-10-30 21:30:58 +00:00
|
|
|
rc = true;
|
2008-04-01 05:21:50 +00:00
|
|
|
|
2007-10-30 21:30:58 +00:00
|
|
|
out:
|
|
|
|
return rc;
|
|
|
|
}
|
2008-04-01 05:21:50 +00:00
|
|
|
|
|
|
|
|
2010-11-12 16:36:43 +00:00
|
|
|
/**
|
|
|
|
* Function AdjustDimensionDetails
|
2010-04-23 09:54:40 +00:00
|
|
|
* Calculate coordinates of segments used to draw the dimension.
|
|
|
|
* @param aDoNotChangeText (bool) if false, the dimension text is initialized
|
|
|
|
*/
|
|
|
|
void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
|
|
|
|
{
|
|
|
|
#define ARROW_SIZE 500 //size of arrows
|
|
|
|
int ii;
|
|
|
|
int mesure, deltax, deltay; /* valeur de la mesure sur les axes X et Y */
|
|
|
|
int fleche_up_X = 0, fleche_up_Y = 0; /* coord des fleches : barre / */
|
|
|
|
int fleche_dw_X = 0, fleche_dw_Y = 0; /* coord des fleches : barre \ */
|
|
|
|
int hx, hy; /* coord des traits de rappel de cote */
|
|
|
|
float angle, angle_f;
|
|
|
|
wxString msg;
|
|
|
|
|
|
|
|
/* Init layer : */
|
|
|
|
m_Text->SetLayer( GetLayer() );
|
|
|
|
|
|
|
|
/* calculate the size of the cdimension
|
|
|
|
* (text + line above the text) */
|
|
|
|
ii = m_Text->m_Size.y +
|
2010-11-27 13:09:18 +00:00
|
|
|
m_Text->m_Thickness + (m_Width * 3);
|
2010-04-23 09:54:40 +00:00
|
|
|
|
|
|
|
deltax = TraitD_ox - TraitG_ox;
|
|
|
|
deltay = TraitD_oy - TraitG_oy;
|
|
|
|
|
|
|
|
/* Calculate dimension value */
|
|
|
|
mesure = wxRound(hypot( (double) deltax, (double) deltay ) );
|
|
|
|
|
|
|
|
if( deltax || deltay )
|
|
|
|
angle = atan2( (double) deltay, (double) deltax );
|
|
|
|
else
|
|
|
|
angle = 0.0;
|
|
|
|
|
|
|
|
/* Calcul des parametre dimensions X et Y des fleches et traits de cotes */
|
|
|
|
hx = hy = ii;
|
|
|
|
|
|
|
|
/* On tient compte de l'inclinaison de la cote */
|
|
|
|
if( mesure )
|
|
|
|
{
|
|
|
|
hx = (abs) ( (int) ( ( (double) deltay * hx ) / mesure ) );
|
|
|
|
hy = (abs) ( (int) ( ( (double) deltax * hy ) / mesure ) );
|
|
|
|
|
|
|
|
if( TraitG_ox > Barre_ox )
|
|
|
|
hx = -hx;
|
|
|
|
if( TraitG_ox == Barre_ox )
|
|
|
|
hx = 0;
|
|
|
|
if( TraitG_oy > Barre_oy )
|
|
|
|
hy = -hy;
|
|
|
|
if( TraitG_oy == Barre_oy )
|
|
|
|
hy = 0;
|
|
|
|
|
|
|
|
angle_f = angle + (M_PI * 27.5 / 180);
|
|
|
|
fleche_up_X = (int) ( ARROW_SIZE * cos( angle_f ) );
|
|
|
|
fleche_up_Y = (int) ( ARROW_SIZE * sin( angle_f ) );
|
|
|
|
angle_f = angle - (M_PI * 27.5 / 180);
|
|
|
|
fleche_dw_X = (int) ( ARROW_SIZE * cos( angle_f ) );
|
|
|
|
fleche_dw_Y = (int) ( ARROW_SIZE * sin( angle_f ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FlecheG1_ox = Barre_ox;
|
|
|
|
FlecheG1_oy = Barre_oy;
|
|
|
|
FlecheG1_fx = Barre_ox + fleche_up_X;
|
|
|
|
FlecheG1_fy = Barre_oy + fleche_up_Y;
|
|
|
|
|
|
|
|
FlecheG2_ox = Barre_ox;
|
|
|
|
FlecheG2_oy = Barre_oy;
|
|
|
|
FlecheG2_fx = Barre_ox + fleche_dw_X;
|
|
|
|
FlecheG2_fy = Barre_oy + fleche_dw_Y;
|
|
|
|
|
|
|
|
/*la fleche de droite est symetrique a celle de gauche:
|
|
|
|
* / = -\ et \ = -/
|
|
|
|
*/
|
|
|
|
FlecheD1_ox = Barre_fx;
|
|
|
|
FlecheD1_oy = Barre_fy;
|
|
|
|
FlecheD1_fx = Barre_fx - fleche_dw_X;
|
|
|
|
FlecheD1_fy = Barre_fy - fleche_dw_Y;
|
|
|
|
|
|
|
|
FlecheD2_ox = Barre_fx;
|
|
|
|
FlecheD2_oy = Barre_fy;
|
|
|
|
FlecheD2_fx = Barre_fx - fleche_up_X;
|
|
|
|
FlecheD2_fy = Barre_fy - fleche_up_Y;
|
|
|
|
|
|
|
|
|
|
|
|
TraitG_fx = Barre_ox + hx;
|
|
|
|
TraitG_fy = Barre_oy + hy;
|
|
|
|
|
|
|
|
TraitD_fx = Barre_fx + hx;
|
|
|
|
TraitD_fy = Barre_fy + hy;
|
|
|
|
|
|
|
|
/* Calculate the better text position and orientation: */
|
|
|
|
m_Pos.x = m_Text->m_Pos.x
|
|
|
|
= (Barre_fx + TraitG_fx) / 2;
|
|
|
|
m_Pos.y = m_Text->m_Pos.y
|
|
|
|
= (Barre_fy + TraitG_fy) / 2;
|
|
|
|
|
|
|
|
m_Text->m_Orient = -(int) (angle * 1800 / M_PI);
|
|
|
|
if( m_Text->m_Orient < 0 )
|
|
|
|
m_Text->m_Orient += 3600;
|
|
|
|
if( m_Text->m_Orient >= 3600 )
|
|
|
|
m_Text->m_Orient -= 3600;
|
|
|
|
if( (m_Text->m_Orient > 900) && (m_Text->m_Orient <2700) )
|
|
|
|
m_Text->m_Orient -= 1800;
|
|
|
|
|
|
|
|
if( !aDoNotChangeText )
|
|
|
|
{
|
|
|
|
m_Value = mesure;
|
|
|
|
valeur_param( m_Value, msg );
|
|
|
|
SetText( msg );
|
|
|
|
}
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2010-04-23 09:54:40 +00:00
|
|
|
/* Print 1 dimension: segments and text
|
2009-11-12 15:43:38 +00:00
|
|
|
*/
|
2011-01-21 19:30:59 +00:00
|
|
|
void DIMENSION::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int mode_color, const wxPoint& offset )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-08 20:51:08 +00:00
|
|
|
int ox, oy, typeaff, width, gcolor;
|
|
|
|
|
2010-11-11 21:46:55 +00:00
|
|
|
ox = -offset.x;
|
|
|
|
oy = -offset.y;
|
2007-08-08 20:51:08 +00:00
|
|
|
|
2008-04-01 05:21:50 +00:00
|
|
|
m_Text->Draw( panel, DC, mode_color, offset );
|
2007-08-08 20:51:08 +00:00
|
|
|
|
2010-01-31 20:01:46 +00:00
|
|
|
BOARD * brd = GetBoard( );
|
|
|
|
if( brd->IsLayerVisible( m_Layer ) == false )
|
2007-08-08 20:51:08 +00:00
|
|
|
return;
|
|
|
|
|
2010-01-31 20:01:46 +00:00
|
|
|
gcolor = brd->GetLayerColor(m_Layer);
|
2009-10-10 01:25:53 +00:00
|
|
|
|
2007-08-08 20:51:08 +00:00
|
|
|
GRSetDrawMode( DC, mode_color );
|
|
|
|
typeaff = DisplayOpt.DisplayDrawItems;
|
|
|
|
width = m_Width;
|
2009-01-29 14:26:20 +00:00
|
|
|
|
2010-02-08 18:15:42 +00:00
|
|
|
if( DC->LogicalToDeviceXRel( width ) < 2 )
|
2007-08-08 20:51:08 +00:00
|
|
|
typeaff = FILAIRE;
|
|
|
|
|
|
|
|
switch( typeaff )
|
|
|
|
{
|
|
|
|
case FILAIRE:
|
|
|
|
width = 0;
|
|
|
|
|
|
|
|
case FILLED:
|
|
|
|
GRLine( &panel->m_ClipBox, DC,
|
|
|
|
Barre_ox - ox, Barre_oy - oy,
|
|
|
|
Barre_fx - ox, Barre_fy - oy, width, gcolor );
|
|
|
|
GRLine( &panel->m_ClipBox, DC,
|
|
|
|
TraitG_ox - ox, TraitG_oy - oy,
|
|
|
|
TraitG_fx - ox, TraitG_fy - oy, width, gcolor );
|
|
|
|
GRLine( &panel->m_ClipBox, DC,
|
|
|
|
TraitD_ox - ox, TraitD_oy - oy,
|
|
|
|
TraitD_fx - ox, TraitD_fy - oy, width, gcolor );
|
|
|
|
GRLine( &panel->m_ClipBox, DC,
|
|
|
|
FlecheD1_ox - ox, FlecheD1_oy - oy,
|
|
|
|
FlecheD1_fx - ox, FlecheD1_fy - oy, width, gcolor );
|
|
|
|
GRLine( &panel->m_ClipBox, DC,
|
|
|
|
FlecheD2_ox - ox, FlecheD2_oy - oy,
|
|
|
|
FlecheD2_fx - ox, FlecheD2_fy - oy, width, gcolor );
|
|
|
|
GRLine( &panel->m_ClipBox, DC,
|
|
|
|
FlecheG1_ox - ox, FlecheG1_oy - oy,
|
|
|
|
FlecheG1_fx - ox, FlecheG1_fy - oy, width, gcolor );
|
|
|
|
GRLine( &panel->m_ClipBox, DC,
|
|
|
|
FlecheG2_ox - ox, FlecheG2_oy - oy,
|
|
|
|
FlecheG2_fx - ox, FlecheG2_fy - oy, width, gcolor );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SKETCH:
|
|
|
|
GRCSegm( &panel->m_ClipBox, DC,
|
|
|
|
Barre_ox - ox, Barre_oy - oy,
|
|
|
|
Barre_fx - ox, Barre_fy - oy,
|
|
|
|
width, gcolor );
|
|
|
|
GRCSegm( &panel->m_ClipBox, DC,
|
|
|
|
TraitG_ox - ox, TraitG_oy - oy,
|
|
|
|
TraitG_fx - ox, TraitG_fy - oy,
|
|
|
|
width, gcolor );
|
|
|
|
GRCSegm( &panel->m_ClipBox, DC,
|
|
|
|
TraitD_ox - ox, TraitD_oy - oy,
|
|
|
|
TraitD_fx - ox, TraitD_fy - oy,
|
|
|
|
width, gcolor );
|
|
|
|
GRCSegm( &panel->m_ClipBox, DC,
|
|
|
|
FlecheD1_ox - ox, FlecheD1_oy - oy,
|
|
|
|
FlecheD1_fx - ox, FlecheD1_fy - oy,
|
|
|
|
width, gcolor );
|
|
|
|
GRCSegm( &panel->m_ClipBox, DC,
|
|
|
|
FlecheD2_ox - ox, FlecheD2_oy - oy,
|
|
|
|
FlecheD2_fx - ox, FlecheD2_fy - oy,
|
|
|
|
width, gcolor );
|
|
|
|
GRCSegm( &panel->m_ClipBox, DC,
|
|
|
|
FlecheG1_ox - ox, FlecheG1_oy - oy,
|
|
|
|
FlecheG1_fx - ox, FlecheG1_fy - oy,
|
|
|
|
width, gcolor );
|
|
|
|
GRCSegm( &panel->m_ClipBox, DC,
|
|
|
|
FlecheG2_ox - ox, FlecheG2_oy - oy,
|
|
|
|
FlecheG2_fx - ox, FlecheG2_fy - oy,
|
|
|
|
width, gcolor );
|
|
|
|
break;
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-20 19:33:15 +00:00
|
|
|
// see class_cotation.h
|
2011-01-21 19:30:59 +00:00
|
|
|
void DIMENSION::DisplayInfo( EDA_DRAW_FRAME* frame )
|
2007-08-20 19:33:15 +00:00
|
|
|
{
|
2010-04-23 09:54:40 +00:00
|
|
|
// for now, display only the text within the DIMENSION using class TEXTE_PCB.
|
2009-04-17 08:51:02 +00:00
|
|
|
m_Text->DisplayInfo( frame );
|
2007-08-20 19:33:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-08 20:51:08 +00:00
|
|
|
/**
|
|
|
|
* Function HitTest
|
|
|
|
* tests if the given wxPoint is within the bounds of this object.
|
|
|
|
* @param ref_pos A wxPoint to test
|
|
|
|
* @return bool - true if a hit, else false
|
|
|
|
*/
|
2010-04-23 09:54:40 +00:00
|
|
|
bool DIMENSION::HitTest( const wxPoint& ref_pos )
|
2007-08-08 20:51:08 +00:00
|
|
|
{
|
|
|
|
int ux0, uy0;
|
|
|
|
int dx, dy, spot_cX, spot_cY;
|
|
|
|
|
2009-06-11 14:26:17 +00:00
|
|
|
if( m_Text && m_Text->TextHitTest( ref_pos ) )
|
2007-08-08 20:51:08 +00:00
|
|
|
return true;
|
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
/* Locate SEGMENTS? */
|
2008-04-01 05:21:50 +00:00
|
|
|
ux0 = Barre_ox;
|
2007-08-08 20:51:08 +00:00
|
|
|
uy0 = Barre_oy;
|
2008-04-01 05:21:50 +00:00
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
/* Recalculate coordinates with ux0, uy0 = origin. */
|
2008-04-01 05:21:50 +00:00
|
|
|
dx = Barre_fx - ux0;
|
2007-08-08 20:51:08 +00:00
|
|
|
dy = Barre_fy - uy0;
|
2008-04-01 05:21:50 +00:00
|
|
|
|
|
|
|
spot_cX = ref_pos.x - ux0;
|
2007-08-08 20:51:08 +00:00
|
|
|
spot_cY = ref_pos.y - uy0;
|
|
|
|
|
|
|
|
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
|
|
|
|
return true;
|
|
|
|
|
2008-04-01 05:21:50 +00:00
|
|
|
ux0 = TraitG_ox;
|
2007-08-08 20:51:08 +00:00
|
|
|
uy0 = TraitG_oy;
|
2008-04-01 05:21:50 +00:00
|
|
|
|
|
|
|
dx = TraitG_fx - ux0;
|
2007-08-08 20:51:08 +00:00
|
|
|
dy = TraitG_fy - uy0;
|
2008-04-01 05:21:50 +00:00
|
|
|
|
|
|
|
spot_cX = ref_pos.x - ux0;
|
2007-08-08 20:51:08 +00:00
|
|
|
spot_cY = ref_pos.y - uy0;
|
|
|
|
|
|
|
|
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
|
|
|
|
return true;
|
|
|
|
|
2008-04-01 05:21:50 +00:00
|
|
|
ux0 = TraitD_ox;
|
2007-08-08 20:51:08 +00:00
|
|
|
uy0 = TraitD_oy;
|
2008-04-01 05:21:50 +00:00
|
|
|
|
|
|
|
dx = TraitD_fx - ux0;
|
2007-08-08 20:51:08 +00:00
|
|
|
dy = TraitD_fy - uy0;
|
2008-04-01 05:21:50 +00:00
|
|
|
|
|
|
|
spot_cX = ref_pos.x - ux0;
|
2007-08-08 20:51:08 +00:00
|
|
|
spot_cY = ref_pos.y - uy0;
|
|
|
|
|
|
|
|
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
|
|
|
|
return true;
|
|
|
|
|
2008-04-01 05:21:50 +00:00
|
|
|
ux0 = FlecheD1_ox;
|
2007-08-08 20:51:08 +00:00
|
|
|
uy0 = FlecheD1_oy;
|
2008-04-01 05:21:50 +00:00
|
|
|
|
|
|
|
dx = FlecheD1_fx - ux0;
|
2007-08-08 20:51:08 +00:00
|
|
|
dy = FlecheD1_fy - uy0;
|
2008-04-01 05:21:50 +00:00
|
|
|
|
|
|
|
spot_cX = ref_pos.x - ux0;
|
2007-08-08 20:51:08 +00:00
|
|
|
spot_cY = ref_pos.y - uy0;
|
|
|
|
|
|
|
|
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
|
|
|
|
return true;
|
|
|
|
|
2008-04-01 05:21:50 +00:00
|
|
|
ux0 = FlecheD2_ox;
|
2007-08-08 20:51:08 +00:00
|
|
|
uy0 = FlecheD2_oy;
|
2008-04-01 05:21:50 +00:00
|
|
|
|
|
|
|
dx = FlecheD2_fx - ux0;
|
2007-08-08 20:51:08 +00:00
|
|
|
dy = FlecheD2_fy - uy0;
|
2008-04-01 05:21:50 +00:00
|
|
|
|
|
|
|
spot_cX = ref_pos.x - ux0;
|
2007-08-08 20:51:08 +00:00
|
|
|
spot_cY = ref_pos.y - uy0;
|
|
|
|
|
|
|
|
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
|
|
|
|
return true;
|
|
|
|
|
2008-04-01 05:21:50 +00:00
|
|
|
ux0 = FlecheG1_ox;
|
2007-08-08 20:51:08 +00:00
|
|
|
uy0 = FlecheG1_oy;
|
2008-04-01 05:21:50 +00:00
|
|
|
|
|
|
|
dx = FlecheG1_fx - ux0;
|
2007-08-08 20:51:08 +00:00
|
|
|
dy = FlecheG1_fy - uy0;
|
2008-04-01 05:21:50 +00:00
|
|
|
|
|
|
|
spot_cX = ref_pos.x - ux0;
|
2007-08-08 20:51:08 +00:00
|
|
|
spot_cY = ref_pos.y - uy0;
|
|
|
|
|
|
|
|
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
|
|
|
|
return true;
|
|
|
|
|
2008-04-01 05:21:50 +00:00
|
|
|
ux0 = FlecheG2_ox;
|
2007-08-08 20:51:08 +00:00
|
|
|
uy0 = FlecheG2_oy;
|
2008-04-01 05:21:50 +00:00
|
|
|
|
|
|
|
dx = FlecheG2_fx - ux0;
|
2007-08-08 20:51:08 +00:00
|
|
|
dy = FlecheG2_fy - uy0;
|
2008-04-01 05:21:50 +00:00
|
|
|
|
|
|
|
spot_cX = ref_pos.x - ux0;
|
2007-08-08 20:51:08 +00:00
|
|
|
spot_cY = ref_pos.y - uy0;
|
|
|
|
|
|
|
|
if( DistanceTest( m_Width / 2, dx, dy, spot_cX, spot_cY ) )
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
|
2008-01-06 12:43:57 +00:00
|
|
|
/**
|
2009-11-12 15:43:38 +00:00
|
|
|
* Function HitTest (overlaid)
|
2011-03-29 19:33:07 +00:00
|
|
|
* tests if the given EDA_RECT intersect this object.
|
|
|
|
* @param refArea : the given EDA_RECT
|
2008-01-06 12:43:57 +00:00
|
|
|
* @return bool - true if a hit, else false
|
|
|
|
*/
|
2011-03-29 19:33:07 +00:00
|
|
|
bool DIMENSION::HitTest( EDA_RECT& refArea )
|
2008-01-06 12:43:57 +00:00
|
|
|
{
|
2010-12-20 17:44:25 +00:00
|
|
|
if( refArea.Contains( m_Pos ) )
|
2008-04-01 05:21:50 +00:00
|
|
|
return true;
|
|
|
|
return false;
|
2008-01-06 12:43:57 +00:00
|
|
|
}
|
2011-02-25 16:23:24 +00:00
|
|
|
|
|
|
|
|
2011-03-29 19:33:07 +00:00
|
|
|
EDA_RECT DIMENSION::GetBoundingBox() const
|
2011-02-25 16:23:24 +00:00
|
|
|
{
|
2011-03-29 19:33:07 +00:00
|
|
|
EDA_RECT bBox;
|
2011-02-25 16:23:24 +00:00
|
|
|
int xmin, xmax, ymin, ymax;
|
|
|
|
|
|
|
|
bBox = m_Text->GetTextBox( -1 );
|
|
|
|
xmin = bBox.GetX();
|
|
|
|
xmax = bBox.GetRight();
|
|
|
|
ymin = bBox.GetY();
|
|
|
|
ymax = bBox.GetBottom();
|
|
|
|
|
|
|
|
xmin = MIN( xmin, Barre_ox );
|
|
|
|
xmin = MIN( xmin, Barre_fx );
|
|
|
|
ymin = MIN( ymin, Barre_oy );
|
|
|
|
ymin = MIN( ymin, Barre_fy );
|
|
|
|
xmax = MAX( xmax, Barre_ox );
|
|
|
|
xmax = MAX( xmax, Barre_fx );
|
|
|
|
ymax = MAX( ymax, Barre_oy );
|
|
|
|
ymax = MAX( ymax, Barre_fy );
|
|
|
|
|
|
|
|
xmin = MIN( xmin, TraitG_ox );
|
|
|
|
xmin = MIN( xmin, TraitG_fx );
|
|
|
|
ymin = MIN( ymin, TraitG_oy );
|
|
|
|
ymin = MIN( ymin, TraitG_fy );
|
|
|
|
xmax = MAX( xmax, TraitG_ox );
|
|
|
|
xmax = MAX( xmax, TraitG_fx );
|
|
|
|
ymax = MAX( ymax, TraitG_oy );
|
|
|
|
ymax = MAX( ymax, TraitG_fy );
|
|
|
|
|
|
|
|
bBox.SetX( xmin );
|
|
|
|
bBox.SetY( ymin );
|
|
|
|
bBox.SetWidth( xmax - xmin + 1 );
|
|
|
|
bBox.SetHeight( ymax - ymin + 1 );
|
|
|
|
|
|
|
|
bBox.Normalize();
|
|
|
|
|
|
|
|
return bBox;
|
|
|
|
}
|