7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-14 19:49:36 +00:00

see CHANGELOG.txt

This commit is contained in:
Dick Hollenbeck 2012-02-18 22:02:19 -06:00
parent 1393e5c38e
commit 9e2eb0c856
60 changed files with 2831 additions and 2599 deletions

View File

@ -4,6 +4,19 @@ KiCad ChangeLog 2012
Please add newer entries at the top, list the date and your name with
email address.
2012-Feb-19 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
++pcbnew
* remove global g_Pad_Master global and put it into BOARD_DESIGN_SETTINGS
which is in turn already within BOARD.
* encapsulate class D_PAD with accessors, making data private.
* make D_PAD::GetBoundingRadius() do its longer calculation lazily, based on
m_boundingRadius == -1.
must test:
2012-Feb-5 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
++pcbnew

View File

@ -108,4 +108,3 @@ int g_PadCMPColor = RED;
*/
DLIST<TRACK> g_CurrentTrackList;
D_PAD g_Pad_Master( (MODULE*) NULL );

View File

@ -273,19 +273,6 @@ void RotatePoint( int* pX, int* pY, int cx, int cy, double angle )
}
void RotatePoint( wxPoint* point, double angle )
{
int ox, oy;
ox = point->x;
oy = point->y;
RotatePoint( &ox, &oy, angle );
point->x = ox;
point->y = oy;
}
void RotatePoint( wxPoint* point, const wxPoint& centre, double angle )
{
int ox, oy;

View File

@ -6,8 +6,14 @@
#define BOARD_DESIGN_SETTINGS_H_
#include <pcbstruct.h> // NB_COLORS
#include <class_pad.h>
#include <param_config.h>
// Class for handle current printed board design settings
/**
* Class BOARD_DESIGN_SETTINGS
* contains design settings for a BOARD object.
*/
class BOARD_DESIGN_SETTINGS
{
public:
@ -38,6 +44,8 @@ public:
int m_ModuleTextWidth;
int m_ModuleSegmentWidth;
D_PAD m_Pad_Master;
public:
BOARD_DESIGN_SETTINGS();
@ -172,6 +180,13 @@ public:
*/
void SetCopperLayerCount( int aNewLayerCount );
/**
* Function AppendConfigs
* appends to @a aResult the configuration setting accessors which will later
* allow reading or writing of configuration file information directly into
* this object.
*/
void AppendConfigs( PARAM_CFG_ARRAY* aResult );
private:
int m_CopperLayerCount; ///< Number of copper layers for this design

View File

@ -5,25 +5,36 @@
#ifndef PAD_SHAPES_H_
#define PAD_SHAPES_H_
/* Pad shape id : ( .m_PadShape member) */
#define PAD_NONE 0
#define PAD_CIRCLE 1
#define PAD_ROUND PAD_CIRCLE
#define PAD_RECT 2
#define PAD_OVAL 3
#define PAD_TRAPEZOID 4 // trapezoid
#define PAD_RRECT 5
#define PAD_OCTAGON 6
#define PAD_SQUARE 7
/**
* Enum PAD_SHAPE_T
* is the set of pad shapes, used with D_PAD::{Set,Get}Shape()
*/
enum PAD_SHAPE_T
{
PAD_NONE,
PAD_CIRCLE,
PAD_ROUND = PAD_CIRCLE,
PAD_RECT,
PAD_OVAL,
PAD_TRAPEZOID,
PAD_RRECT,
PAD_OCTAGON,
PAD_SQUARE,
};
/* PADS attributes */
#define PAD_STANDARD 0 // Usual pad
#define PAD_SMD 1 // Smd pad, appears on the solder paste layer (default)
#define PAD_CONN 2 // Like smd, does not appear on the solder paste layer (default)
#define PAD_HOLE_NOT_PLATED 3 // like PAD_STANDARD, but not plated
// mechanical used only
// no connection allowed
/**
* Enum PAD_ATTR_T
* is the set of pad shapes, used with D_PAD::{Set,Get}Attribute()
*/
enum PAD_ATTR_T
{
PAD_STANDARD, ///< Usual pad
PAD_SMD, ///< Smd pad, appears on the solder paste layer (default)
PAD_CONN, ///< Like smd, does not appear on the solder paste layer (default)
PAD_HOLE_NOT_PLATED, ///< like PAD_STANDARD, but not plated
///< mechanical use only, no connection allowed
};
#endif /* #ifndef PAD_SHAPES_H_ */
#endif // PAD_SHAPES_H_

View File

@ -52,8 +52,5 @@ extern DLIST<TRACK> g_CurrentTrackList;
#define g_FirstTrackSegment g_CurrentTrackList.GetFirst() ///< first segment created
/// Pad editing
extern D_PAD g_Pad_Master;
#endif // PCBCOMMON_H_

View File

@ -22,7 +22,10 @@ void RotatePoint( int *pX, int *pY, int cx, int cy, double angle );
* Calculates the new coord point point
* for a rotation angle in (1 / 10 degree)
*/
void RotatePoint( wxPoint* point, double angle );
static inline void RotatePoint( wxPoint* point, double angle )
{
RotatePoint( &point->x, &point->y, angle );
}
/*
* Calculates the new coord point point

View File

@ -666,7 +666,7 @@ int PCB_EDIT_FRAME::GetOptimalModulePlacement( MODULE* aModule, wxDC* aDC )
for( Pad = aModule->m_Pads; Pad != NULL; Pad = Pad->Next() )
{
if( ( Pad->m_layerMask & otherLayerMask ) == 0 )
if( ( Pad->GetLayerMask() & otherLayerMask ) == 0 )
continue;
TstOtherSide = true;

View File

@ -443,7 +443,7 @@ void MoveMarkedItems( MODULE* module, wxPoint offset )
continue;
pad->SetPosition( pad->GetPosition() + offset );
pad->m_Pos0 += offset;
pad->SetPos0( pad->GetPos0() + offset );
}
item = module->m_Drawings;
@ -526,29 +526,38 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset )
{
#define SETMIRROR( z ) (z) -= offset.x; (z) = -(z); (z) += offset.x;
wxPoint tmp;
wxSize tmpz;
if( module == NULL )
return;
for( D_PAD* pad = module->m_Pads; pad; pad = pad->Next() )
{
if( pad->IsSelected() )
// @JP why allow some pads to stay behind? Do not understand
// why this test is here.
if( !pad->IsSelected() )
continue;
tmp = pad->GetPosition();
SETMIRROR( tmp.x );
pad->SetPosition( tmp );
pad->m_Pos0.x = pad->GetPosition().x;
NEGATE( pad->m_Offset.x );
NEGATE( pad->m_DeltaSize.x );
pad->m_Orient = 1800 - pad->m_Orient;
NORMALIZE_ANGLE_POS( pad->m_Orient );
pad->SetX0( pad->GetPosition().x );
tmp = pad->GetOffset();
NEGATE( tmp.x );
pad->SetOffset( tmp );
tmpz = pad->GetDelta();
NEGATE( tmpz.x );
pad->SetDelta( tmpz );
pad->SetOrientation( 1800 - pad->GetOrientation() );
}
for( EDA_ITEM* item = module->m_Drawings; item; item = item->Next() )
{
if( !item->IsSelected() )
if( !item->IsSelected() ) // @JP why allow some graphics to stay behind?
continue;
switch( item->Type() )
@ -609,9 +618,8 @@ void RotateMarkedItems( MODULE* module, wxPoint offset )
ROTATE( pos );
pad->SetPosition( pos );
pad->m_Pos0 = pad->GetPosition();
pad->m_Orient += 900;
NORMALIZE_ANGLE_POS( pad->m_Orient );
pad->SetPos0( pad->GetPosition() );
pad->SetOrientation( pad->GetOrientation() + 900 );
}
for( EDA_ITEM* item = module->m_Drawings; item; item = item->Next() )

View File

@ -21,7 +21,7 @@
#include <class_zone.h>
/* Exported functions */
// Exported functions
/**
* Function TransformRoundedEndsSegmentToPolygon
@ -640,8 +640,9 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
wxPoint PadShapePos = aPad.ReturnShapePos(); /* Note: for pad having a shape offset,
* the pad position is NOT the shape position */
wxSize copper_thickness;
int dx = aPad.m_Size.x / 2;
int dy = aPad.m_Size.y / 2;
int dx = aPad.GetSize().x / 2;
int dy = aPad.GetSize().y / 2;
int delta = 3600 / aCircleToSegmentsCount; // rot angle in 0.1 degree
@ -663,320 +664,327 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
copper_thickness.x = min( dx, aCopperThickness );
copper_thickness.y = min( dy, aCopperThickness );
switch( aPad.m_PadShape )
switch( aPad.GetShape() )
{
case PAD_CIRCLE: // Add 4 similar holes
{
/* we create 4 copper holes and put them in position 1, 2, 3 and 4
* here is the area of the rectangular pad + its thermal gap
* the 4 copper holes remove the copper in order to create the thermal gap
* 4 ------ 1
* | |
* | |
* | |
* | |
* 3 ------ 2
* holes 2, 3, 4 are the same as hole 1, rotated 90, 180, 270 deg
*/
// Build the hole pattern, for the hole in the X >0, Y > 0 plane:
// The pattern roughtly is a 90 deg arc pie
std::vector <wxPoint> corners_buffer;
// Radius of outer arcs of the shape corrected for arc approximation by lines
int outer_radius = (int) ( (dx + aThermalGap) * aCorrectionFactor );
// Crosspoint of thermal spoke sides, the first point of polygon buffer
corners_buffer.push_back( wxPoint( copper_thickness.x / 2, copper_thickness.y / 2 ) );
// Add an intermediate point on spoke sides, to allow a > 90 deg angle between side
// and first seg of arc approx
corner.x = copper_thickness.x / 2;
int y = outer_radius - (aThermalGap / 4);
corner.y = (int) sqrt( ( ( (double) y * y ) - (double) corner.x * corner.x ) );
if( aThermalRot != 0 )
corners_buffer.push_back( corner );
// calculate the starting point of the outter arc
corner.x = copper_thickness.x / 2;
double dtmp = sqrt( ( (double) outer_radius * outer_radius ) -
( (double) corner.x * corner.x ) );
corner.y = (int) dtmp;
RotatePoint( &corner, 90 );
// calculate the ending point of the outter arc
corner_end.x = corner.y;
corner_end.y = corner.x;
// calculate intermediate points (y coordinate from corner.y to corner_end.y
while( (corner.y > corner_end.y) && (corner.x < corner_end.x) )
{
corners_buffer.push_back( corner );
RotatePoint( &corner, delta );
}
/* we create 4 copper holes and put them in position 1, 2, 3 and 4
* here is the area of the rectangular pad + its thermal gap
* the 4 copper holes remove the copper in order to create the thermal gap
* 4 ------ 1
* | |
* | |
* | |
* | |
* 3 ------ 2
* holes 2, 3, 4 are the same as hole 1, rotated 90, 180, 270 deg
*/
corners_buffer.push_back( corner_end );
// Build the hole pattern, for the hole in the X >0, Y > 0 plane:
// The pattern roughtly is a 90 deg arc pie
std::vector <wxPoint> corners_buffer;
/* add an intermediate point, to avoid angles < 90 deg between last arc approx line
* and radius line
*/
corner.x = corners_buffer[1].y;
corner.y = corners_buffer[1].x;
corners_buffer.push_back( corner );
// Radius of outer arcs of the shape corrected for arc approximation by lines
int outer_radius = (int) ( (dx + aThermalGap) * aCorrectionFactor );
// Now, add the 4 holes ( each is the pattern, rotated by 0, 90, 180 and 270 deg
// aThermalRot = 450 (45.0 degrees orientation) work fine.
int angle_pad = aPad.GetOrientation(); // Pad orientation
int th_angle = aThermalRot;
// Crosspoint of thermal spoke sides, the first point of polygon buffer
corners_buffer.push_back( wxPoint( copper_thickness.x / 2, copper_thickness.y / 2 ) );
for( unsigned ihole = 0; ihole < 4; ihole++ )
{
for( unsigned ii = 0; ii < corners_buffer.size(); ii++ )
// Add an intermediate point on spoke sides, to allow a > 90 deg angle between side
// and first seg of arc approx
corner.x = copper_thickness.x / 2;
int y = outer_radius - (aThermalGap / 4);
corner.y = (int) sqrt( ( ( (double) y * y ) - (double) corner.x * corner.x ) );
if( aThermalRot != 0 )
corners_buffer.push_back( corner );
// calculate the starting point of the outter arc
corner.x = copper_thickness.x / 2;
double dtmp = sqrt( ( (double) outer_radius * outer_radius ) -
( (double) corner.x * corner.x ) );
corner.y = (int) dtmp;
RotatePoint( &corner, 90 );
// calculate the ending point of the outter arc
corner_end.x = corner.y;
corner_end.y = corner.x;
// calculate intermediate points (y coordinate from corner.y to corner_end.y
while( (corner.y > corner_end.y) && (corner.x < corner_end.x) )
{
corner = corners_buffer[ii];
RotatePoint( &corner, th_angle + angle_pad ); // Rotate by segment angle and pad orientation
corner += PadShapePos;
aCornerBuffer.push_back( CPolyPt( corner.x, corner.y ) );
corners_buffer.push_back( corner );
RotatePoint( &corner, delta );
}
aCornerBuffer.back().end_contour = true;
th_angle += 900; // Note: th_angle in in 0.1 deg.
corners_buffer.push_back( corner_end );
/* add an intermediate point, to avoid angles < 90 deg between last arc approx line
* and radius line
*/
corner.x = corners_buffer[1].y;
corner.y = corners_buffer[1].x;
corners_buffer.push_back( corner );
// Now, add the 4 holes ( each is the pattern, rotated by 0, 90, 180 and 270 deg
// aThermalRot = 450 (45.0 degrees orientation) work fine.
int angle_pad = aPad.GetOrientation(); // Pad orientation
int th_angle = aThermalRot;
for( unsigned ihole = 0; ihole < 4; ihole++ )
{
for( unsigned ii = 0; ii < corners_buffer.size(); ii++ )
{
corner = corners_buffer[ii];
RotatePoint( &corner, th_angle + angle_pad ); // Rotate by segment angle and pad orientation
corner += PadShapePos;
aCornerBuffer.push_back( CPolyPt( corner.x, corner.y ) );
}
aCornerBuffer.back().end_contour = true;
th_angle += 900; // Note: th_angle in in 0.1 deg.
}
}
}
break;
break;
case PAD_OVAL:
{
// Oval pad support along the lines of round and rectangular pads
std::vector <wxPoint> corners_buffer; // Polygon buffer as vector
int dx = (aPad.m_Size.x / 2) + aThermalGap; // Cutout radius x
int dy = (aPad.m_Size.y / 2) + aThermalGap; // Cutout radius y
wxPoint shape_offset;
// We want to calculate an oval shape with dx > dy.
// if this is not the case, exchange dx and dy, and rotate the shape 90 deg.
int supp_angle = 0;
if( dx < dy )
{
EXCHG( dx, dy );
supp_angle = 900;
EXCHG( copper_thickness.x, copper_thickness.y );
}
// Oval pad support along the lines of round and rectangular pads
std::vector <wxPoint> corners_buffer; // Polygon buffer as vector
int deltasize = dx - dy; // = distance between shape position and the 2 demi-circle ends centre
// here we have dx > dy
// Radius of outer arcs of the shape:
int outer_radius = dy; // The radius of the outer arc is radius end + aThermalGap
int dx = (aPad.GetSize().x / 2) + aThermalGap; // Cutout radius x
int dy = (aPad.GetSize().y / 2) + aThermalGap; // Cutout radius y
// Some coordinate fiddling, depending on the shape offset direction
shape_offset = wxPoint( deltasize, 0 );
wxPoint shape_offset;
// Crosspoint of thermal spoke sides, the first point of polygon buffer
corners_buffer.push_back( wxPoint( copper_thickness.x / 2, copper_thickness.y / 2 ) );
// We want to calculate an oval shape with dx > dy.
// if this is not the case, exchange dx and dy, and rotate the shape 90 deg.
int supp_angle = 0;
// Arc start point calculation, the intersecting point of cutout arc and thermal spoke edge
if( copper_thickness.x > deltasize ) // If copper thickness is more than shape offset, we need to calculate arc intercept point.
{
corner.x = copper_thickness.x / 2;
corner.y = (int) sqrt( ( (double) outer_radius * outer_radius ) -
( (double) ( corner.x - delta ) * ( corner.x - deltasize ) ) );
corner.x -= deltasize;
if( dx < dy )
{
EXCHG( dx, dy );
supp_angle = 900;
EXCHG( copper_thickness.x, copper_thickness.y );
}
/* creates an intermediate point, to have a > 90 deg angle
* between the side and the first segment of arc approximation
int deltasize = dx - dy; // = distance between shape position and the 2 demi-circle ends centre
// here we have dx > dy
// Radius of outer arcs of the shape:
int outer_radius = dy; // The radius of the outer arc is radius end + aThermalGap
// Some coordinate fiddling, depending on the shape offset direction
shape_offset = wxPoint( deltasize, 0 );
// Crosspoint of thermal spoke sides, the first point of polygon buffer
corners_buffer.push_back( wxPoint( copper_thickness.x / 2, copper_thickness.y / 2 ) );
// Arc start point calculation, the intersecting point of cutout arc and thermal spoke edge
if( copper_thickness.x > deltasize ) // If copper thickness is more than shape offset, we need to calculate arc intercept point.
{
corner.x = copper_thickness.x / 2;
corner.y = (int) sqrt( ( (double) outer_radius * outer_radius ) -
( (double) ( corner.x - delta ) * ( corner.x - deltasize ) ) );
corner.x -= deltasize;
/* creates an intermediate point, to have a > 90 deg angle
* between the side and the first segment of arc approximation
*/
wxPoint intpoint = corner;
intpoint.y -= aThermalGap / 4;
corners_buffer.push_back( intpoint + shape_offset );
RotatePoint( &corner, 90 );
}
else
{
corner.x = copper_thickness.x / 2;
corner.y = outer_radius;
corners_buffer.push_back( corner );
corner.x = ( deltasize - copper_thickness.x ) / 2;
}
// Add an intermediate point on spoke sides, to allow a > 90 deg angle between side
// and first seg of arc approx
wxPoint last_corner;
last_corner.y = copper_thickness.y / 2;
int px = outer_radius - (aThermalGap / 4);
last_corner.x =
(int) sqrt( ( ( (double) px * px ) - (double) last_corner.y * last_corner.y ) );
// Arc stop point calculation, the intersecting point of cutout arc and thermal spoke edge
corner_end.y = copper_thickness.y / 2;
corner_end.x =
(int) sqrt( ( (double) outer_radius *
outer_radius ) - ( (double) corner_end.y * corner_end.y ) );
RotatePoint( &corner_end, -90 );
// calculate intermediate arc points till limit is reached
while( (corner.y > corner_end.y) && (corner.x < corner_end.x) )
{
corners_buffer.push_back( corner + shape_offset );
RotatePoint( &corner, delta );
}
//corners_buffer.push_back(corner + shape_offset); // TODO: about one mil geometry error forms somewhere.
corners_buffer.push_back( corner_end + shape_offset );
corners_buffer.push_back( last_corner + shape_offset ); // Enabling the line above shows intersection point.
/* Create 2 holes, rotated by pad rotation.
*/
wxPoint intpoint = corner;
intpoint.y -= aThermalGap / 4;
corners_buffer.push_back( intpoint + shape_offset );
RotatePoint( &corner, 90 );
}
else
{
corner.x = copper_thickness.x / 2;
corner.y = outer_radius;
corners_buffer.push_back( corner );
corner.x = ( deltasize - copper_thickness.x ) / 2;
}
int angle = aPad.GetOrientation() + supp_angle;
// Add an intermediate point on spoke sides, to allow a > 90 deg angle between side
// and first seg of arc approx
wxPoint last_corner;
last_corner.y = copper_thickness.y / 2;
int px = outer_radius - (aThermalGap / 4);
last_corner.x =
(int) sqrt( ( ( (double) px * px ) - (double) last_corner.y * last_corner.y ) );
// Arc stop point calculation, the intersecting point of cutout arc and thermal spoke edge
corner_end.y = copper_thickness.y / 2;
corner_end.x =
(int) sqrt( ( (double) outer_radius *
outer_radius ) - ( (double) corner_end.y * corner_end.y ) );
RotatePoint( &corner_end, -90 );
// calculate intermediate arc points till limit is reached
while( (corner.y > corner_end.y) && (corner.x < corner_end.x) )
{
corners_buffer.push_back( corner + shape_offset );
RotatePoint( &corner, delta );
}
//corners_buffer.push_back(corner + shape_offset); // TODO: about one mil geometry error forms somewhere.
corners_buffer.push_back( corner_end + shape_offset );
corners_buffer.push_back( last_corner + shape_offset ); // Enabling the line above shows intersection point.
/* Create 2 holes, rotated by pad rotation.
*/
int angle = aPad.GetOrientation() + supp_angle;
for( int irect = 0; irect < 2; irect++ )
{
for( unsigned ic = 0; ic < corners_buffer.size(); ic++ )
for( int irect = 0; irect < 2; irect++ )
{
wxPoint cpos = corners_buffer[ic];
RotatePoint( &cpos, angle );
cpos += PadShapePos;
aCornerBuffer.push_back( CPolyPt( cpos.x, cpos.y ) );
for( unsigned ic = 0; ic < corners_buffer.size(); ic++ )
{
wxPoint cpos = corners_buffer[ic];
RotatePoint( &cpos, angle );
cpos += PadShapePos;
aCornerBuffer.push_back( CPolyPt( cpos.x, cpos.y ) );
}
aCornerBuffer.back().end_contour = true;
angle += 1800; // this is calculate hole 3
if( angle >= 3600 )
angle -= 3600;
}
aCornerBuffer.back().end_contour = true;
angle += 1800; // this is calculate hole 3
if( angle >= 3600 )
angle -= 3600;
}
// Create holes, that are the mirrored from the previous holes
for( unsigned ic = 0; ic < corners_buffer.size(); ic++ )
{
wxPoint swap = corners_buffer[ic];
swap.x = -swap.x;
corners_buffer[ic] = swap;
}
// Now add corner 4 and 2 (2 is the corner 4 rotated by 180 deg
angle = aPad.GetOrientation() + supp_angle;
for( int irect = 0; irect < 2; irect++ )
{
// Create holes, that are the mirrored from the previous holes
for( unsigned ic = 0; ic < corners_buffer.size(); ic++ )
{
wxPoint cpos = corners_buffer[ic];
RotatePoint( &cpos, angle );
cpos += PadShapePos;
aCornerBuffer.push_back( CPolyPt( cpos.x, cpos.y ) );
wxPoint swap = corners_buffer[ic];
swap.x = -swap.x;
corners_buffer[ic] = swap;
}
aCornerBuffer.back().end_contour = true;
angle += 1800;
// Now add corner 4 and 2 (2 is the corner 4 rotated by 180 deg
angle = aPad.GetOrientation() + supp_angle;
if( angle >= 3600 )
angle -= 3600;
for( int irect = 0; irect < 2; irect++ )
{
for( unsigned ic = 0; ic < corners_buffer.size(); ic++ )
{
wxPoint cpos = corners_buffer[ic];
RotatePoint( &cpos, angle );
cpos += PadShapePos;
aCornerBuffer.push_back( CPolyPt( cpos.x, cpos.y ) );
}
aCornerBuffer.back().end_contour = true;
angle += 1800;
if( angle >= 3600 )
angle -= 3600;
}
}
}
break;
break;
case PAD_RECT: // draw 4 Holes
{
/* we create 4 copper holes and put them in position 1, 2, 3 and 4
* here is the area of the rectangular pad + its thermal gap
* the 4 copper holes remove the copper in order to create the thermal gap
* 4 ------ 1
* | |
* | |
* | |
* | |
* 3 ------ 2
* hole 3 is the same as hole 1, rotated 180 deg
* hole 4 is the same as hole 2, rotated 180 deg and is the same as hole 1, mirrored
*/
// First, create a rectangular hole for position 1 :
// 2 ------- 3
// | |
// | |
// | |
// 1 -------4
// Modified rectangles with one corner rounded. TODO: merging with oval thermals
// and possibly round too.
std::vector <wxPoint> corners_buffer; // Polygon buffer as vector
int dx = (aPad.m_Size.x / 2) + aThermalGap; // Cutout radius x
int dy = (aPad.m_Size.y / 2) + aThermalGap; // Cutout radius y
// The first point of polygon buffer is left lower corner, second the crosspoint of
// thermal spoke sides, the third is upper right corner and the rest are rounding
// vertices going anticlockwise. Note the inveted Y-axis in CG.
corners_buffer.push_back( wxPoint( -dx, -(aThermalGap / 4 + copper_thickness.y / 2) ) ); // Adds small miters to zone
corners_buffer.push_back( wxPoint( -(dx - aThermalGap / 4), -copper_thickness.y / 2 ) ); // fill and spoke corner
corners_buffer.push_back( wxPoint( -copper_thickness.x / 2, -copper_thickness.y / 2 ) );
corners_buffer.push_back( wxPoint( -copper_thickness.x / 2, -(dy - aThermalGap / 4) ) );
corners_buffer.push_back( wxPoint( -(aThermalGap / 4 + copper_thickness.x / 2), -dy ) );
int angle = aPad.GetOrientation();
int rounding_radius = (int) ( aThermalGap * aCorrectionFactor ); // Corner rounding radius
int angle_pg; // Polygon increment angle
for( int i = 0; i < aCircleToSegmentsCount / 4 + 1; i++ )
{
wxPoint corner_position = wxPoint( 0, -rounding_radius );
RotatePoint( &corner_position, 1800 / aCircleToSegmentsCount ); // Start at half increment offset
angle_pg = i * delta;
RotatePoint( &corner_position, angle_pg ); // Rounding vector rotation
corner_position -= aPad.m_Size / 2; // Rounding vector + Pad corner offset
corners_buffer.push_back( wxPoint( corner_position.x, corner_position.y ) );
}
/* we create 4 copper holes and put them in position 1, 2, 3 and 4
* here is the area of the rectangular pad + its thermal gap
* the 4 copper holes remove the copper in order to create the thermal gap
* 4 ------ 1
* | |
* | |
* | |
* | |
* 3 ------ 2
* hole 3 is the same as hole 1, rotated 180 deg
* hole 4 is the same as hole 2, rotated 180 deg and is the same as hole 1, mirrored
*/
for( int irect = 0; irect < 2; irect++ )
{
for( unsigned ic = 0; ic < corners_buffer.size(); ic++ )
// First, create a rectangular hole for position 1 :
// 2 ------- 3
// | |
// | |
// | |
// 1 -------4
// Modified rectangles with one corner rounded. TODO: merging with oval thermals
// and possibly round too.
std::vector <wxPoint> corners_buffer; // Polygon buffer as vector
int dx = (aPad.GetSize().x / 2) + aThermalGap; // Cutout radius x
int dy = (aPad.GetSize().y / 2) + aThermalGap; // Cutout radius y
// The first point of polygon buffer is left lower corner, second the crosspoint of
// thermal spoke sides, the third is upper right corner and the rest are rounding
// vertices going anticlockwise. Note the inveted Y-axis in CG.
corners_buffer.push_back( wxPoint( -dx, -(aThermalGap / 4 + copper_thickness.y / 2) ) ); // Adds small miters to zone
corners_buffer.push_back( wxPoint( -(dx - aThermalGap / 4), -copper_thickness.y / 2 ) ); // fill and spoke corner
corners_buffer.push_back( wxPoint( -copper_thickness.x / 2, -copper_thickness.y / 2 ) );
corners_buffer.push_back( wxPoint( -copper_thickness.x / 2, -(dy - aThermalGap / 4) ) );
corners_buffer.push_back( wxPoint( -(aThermalGap / 4 + copper_thickness.x / 2), -dy ) );
int angle = aPad.GetOrientation();
int rounding_radius = (int) ( aThermalGap * aCorrectionFactor ); // Corner rounding radius
int angle_pg; // Polygon increment angle
for( int i = 0; i < aCircleToSegmentsCount / 4 + 1; i++ )
{
wxPoint cpos = corners_buffer[ic];
RotatePoint( &cpos, angle ); // Rotate according to module orientation
cpos += PadShapePos; // Shift origin to position
aCornerBuffer.push_back( CPolyPt( cpos.x, cpos.y ) );
wxPoint corner_position = wxPoint( 0, -rounding_radius );
// Start at half increment offset
RotatePoint( &corner_position, 1800 / aCircleToSegmentsCount );
angle_pg = i * delta;
RotatePoint( &corner_position, angle_pg ); // Rounding vector rotation
corner_position -= aPad.GetSize() / 2; // Rounding vector + Pad corner offset
corners_buffer.push_back( wxPoint( corner_position.x, corner_position.y ) );
}
aCornerBuffer.back().end_contour = true;
angle += 1800; // this is calculate hole 3
if( angle >= 3600 )
angle -= 3600;
}
// Create holes, that are the mirrored from the previous holes
for( unsigned ic = 0; ic < corners_buffer.size(); ic++ )
{
wxPoint swap = corners_buffer[ic];
swap.x = -swap.x;
corners_buffer[ic] = swap;
}
// Now add corner 4 and 2 (2 is the corner 4 rotated by 180 deg
for( int irect = 0; irect < 2; irect++ )
{
for( unsigned ic = 0; ic < corners_buffer.size(); ic++ )
for( int irect = 0; irect < 2; irect++ )
{
wxPoint cpos = corners_buffer[ic];
RotatePoint( &cpos, angle );
cpos += PadShapePos;
aCornerBuffer.push_back( CPolyPt( cpos.x, cpos.y ) );
for( unsigned ic = 0; ic < corners_buffer.size(); ic++ )
{
wxPoint cpos = corners_buffer[ic];
RotatePoint( &cpos, angle ); // Rotate according to module orientation
cpos += PadShapePos; // Shift origin to position
aCornerBuffer.push_back( CPolyPt( cpos.x, cpos.y ) );
}
aCornerBuffer.back().end_contour = true;
angle += 1800; // this is calculate hole 3
if( angle >= 3600 )
angle -= 3600;
}
aCornerBuffer.back().end_contour = true;
angle += 1800;
// Create holes, that are the mirrored from the previous holes
for( unsigned ic = 0; ic < corners_buffer.size(); ic++ )
{
wxPoint swap = corners_buffer[ic];
swap.x = -swap.x;
corners_buffer[ic] = swap;
}
// Now add corner 4 and 2 (2 is the corner 4 rotated by 180 deg
for( int irect = 0; irect < 2; irect++ )
{
for( unsigned ic = 0; ic < corners_buffer.size(); ic++ )
{
wxPoint cpos = corners_buffer[ic];
RotatePoint( &cpos, angle );
cpos += PadShapePos;
aCornerBuffer.push_back( CPolyPt( cpos.x, cpos.y ) );
}
aCornerBuffer.back().end_contour = true;
angle += 1800;
if( angle >= 3600 )
angle -= 3600;
}
if( angle >= 3600 )
angle -= 3600;
}
break;
}
default:
;
}
}

View File

@ -1181,7 +1181,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
* D_PAD* pad = (D_PAD*) item;
* if( pad->HitTest( refPos ) )
* {
* if( layer_mask & pad->m_layerMask )
* if( layer_mask & pad->GetLayerMask() )
* {
* found = item;
* return SEARCH_QUIT;
@ -1572,11 +1572,11 @@ D_PAD* BOARD::GetPadFast( const wxPoint& aPosition, int aLayerMask )
{
D_PAD* pad = m_NetInfo.GetPad(i);
if( pad->m_Pos != aPosition )
if( pad->GetPosition() != aPosition )
continue;
/* Pad found, it must be on the correct layer */
if( pad->m_layerMask & aLayerMask )
if( pad->GetLayerMask() & aLayerMask )
return pad;
}
@ -1603,10 +1603,10 @@ D_PAD* BOARD::GetPad( std::vector<D_PAD*>& aPadList, const wxPoint& aPosition, i
D_PAD* pad = aPadList[idx];
if( pad->m_Pos == aPosition ) // candidate found
if( pad->GetPosition() == aPosition ) // candidate found
{
// The pad must match the layer mask:
if( (aLayerMask & pad->m_layerMask) != 0 )
if( (aLayerMask & pad->GetLayerMask()) != 0 )
return pad;
// More than one pad can be at aPosition
@ -1616,18 +1616,18 @@ D_PAD* BOARD::GetPad( std::vector<D_PAD*>& aPadList, const wxPoint& aPosition, i
for( int ii = idx+1; ii <= idxmax; ii++ )
{
pad = aPadList[ii];
if( pad->m_Pos != aPosition )
if( pad->GetPosition() != aPosition )
break;
if( (aLayerMask & pad->m_layerMask) != 0 )
if( (aLayerMask & pad->GetLayerMask()) != 0 )
return pad;
}
// search previous
for( int ii = idx-1 ;ii >=0; ii-- )
{
pad = aPadList[ii];
if( pad->m_Pos != aPosition )
if( pad->GetPosition() != aPosition )
break;
if( (aLayerMask & pad->m_layerMask) != 0 )
if( (aLayerMask & pad->GetLayerMask()) != 0 )
return pad;
}
@ -1635,9 +1635,9 @@ D_PAD* BOARD::GetPad( std::vector<D_PAD*>& aPadList, const wxPoint& aPosition, i
return 0;
}
if( pad->m_Pos.x == aPosition.x ) // Must search considering Y coordinate
if( pad->GetPosition().x == aPosition.x ) // Must search considering Y coordinate
{
if(pad->m_Pos.y < aPosition.y) // Must search after this item
if(pad->GetPosition().y < aPosition.y) // Must search after this item
{
idx += delta;
if( idx > idxmax )
@ -1650,7 +1650,7 @@ D_PAD* BOARD::GetPad( std::vector<D_PAD*>& aPadList, const wxPoint& aPosition, i
idx = 0;
}
}
else if( pad->m_Pos.x < aPosition.x ) // Must search after this item
else if( pad->GetPosition().x < aPosition.x ) // Must search after this item
{
idx += delta;
if( idx > idxmax )
@ -1674,9 +1674,9 @@ D_PAD* BOARD::GetPad( std::vector<D_PAD*>& aPadList, const wxPoint& aPosition, i
*/
static bool sortPadsByXthenYCoord( D_PAD* const & ref, D_PAD* const & comp )
{
if( ref->m_Pos.x == comp->m_Pos.x )
return ref->m_Pos.y < comp->m_Pos.y;
return ref->m_Pos.x < comp->m_Pos.x;
if( ref->GetPosition().x == comp->GetPosition().x )
return ref->GetPosition().y < comp->GetPosition().y;
return ref->GetPosition().x < comp->GetPosition().x;
}
@ -1919,13 +1919,13 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace,
if( track->GetState( BEGIN_ONPAD ) )
{
D_PAD * pad = (D_PAD *) track->start;
lenDie += (double) pad->m_LengthDie;
lenDie += (double) pad->GetDieLength();
}
if( track->GetState( END_ONPAD ) )
{
D_PAD * pad = (D_PAD *) track->end;
lenDie += (double) pad->m_LengthDie;
lenDie += (double) pad->GetDieLength();
}
}
}
@ -1949,13 +1949,13 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace,
if( track->GetState( BEGIN_ONPAD ) )
{
D_PAD * pad = (D_PAD *) track->start;
lenDie += (double) pad->m_LengthDie;
lenDie += (double) pad->GetDieLength();
}
if( track->GetState( END_ONPAD ) )
{
D_PAD * pad = (D_PAD *) track->end;
lenDie += (double) pad->m_LengthDie;
lenDie += (double) pad->GetDieLength();
}
}
}

View File

@ -13,7 +13,8 @@
#include <class_track.h>
BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS()
BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() :
m_Pad_Master( 0 )
{
m_EnabledLayers = ALL_LAYERS; // All layers enabled at first.
// SetCopperLayerCount() will adjust this.
@ -59,6 +60,48 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS()
}
void BOARD_DESIGN_SETTINGS::AppendConfigs( PARAM_CFG_ARRAY* aResult )
{
m_Pad_Master.AppendConfigs( aResult );
aResult->push_back( new PARAM_CFG_INT( wxT( "BoardThickness" ),
&m_BoardThickness,
630, 0, 0xFFFF ) );
aResult->push_back( new PARAM_CFG_INT( wxT( "TxtPcbV" ),
&m_PcbTextSize.y,
600, TEXTS_MIN_SIZE, TEXTS_MAX_SIZE ) );
aResult->push_back( new PARAM_CFG_INT( wxT( "TxtPcbH" ),
&m_PcbTextSize.x,
600, TEXTS_MIN_SIZE, TEXTS_MAX_SIZE ) );
aResult->push_back( new PARAM_CFG_INT( wxT( "TxtModV" ), &m_ModuleTextSize.y,
500, TEXTS_MIN_SIZE, TEXTS_MAX_SIZE ) );
aResult->push_back( new PARAM_CFG_INT( wxT( "TxtModH" ), &m_ModuleTextSize.x,
500, TEXTS_MIN_SIZE, TEXTS_MAX_SIZE ) );
aResult->push_back( new PARAM_CFG_INT( wxT( "TxtModW" ), &m_ModuleTextWidth,
100, 1, TEXTS_MAX_WIDTH ) );
aResult->push_back( new PARAM_CFG_INT( wxT( "VEgarde" ),
&m_SolderMaskMargin,
100, 0, 10000 ) );
aResult->push_back( new PARAM_CFG_INT( wxT( "DrawLar" ),
&m_DrawSegmentWidth,
120, 0, 0xFFFF ) );
aResult->push_back( new PARAM_CFG_INT( wxT( "EdgeLar" ),
&m_EdgeSegmentWidth,
120, 0, 0xFFFF ) );
aResult->push_back( new PARAM_CFG_INT( wxT( "TxtLar" ),
&m_PcbTextWidth,
120, 0, 0xFFFF ) );
aResult->push_back( new PARAM_CFG_INT( wxT( "MSegLar" ), &m_ModuleSegmentWidth,
120, 0, 0xFFFF ) );
}
// see pcbstruct.h
int BOARD_DESIGN_SETTINGS::GetVisibleLayers() const
{
@ -123,11 +166,6 @@ void BOARD_DESIGN_SETTINGS::SetCopperLayerCount( int aNewLayerCount )
}
/**
* Function SetEnabledLayers
* changes the bit-mask of enabled layers
* @param aMask = The new bit-mask of enabled layers
*/
void BOARD_DESIGN_SETTINGS::SetEnabledLayers( int aMask )
{
// Back and front layers are always enabled.

View File

@ -102,13 +102,13 @@ MODULE::MODULE( const MODULE& aModule ) :
m_LocalSolderPasteMargin = aModule.m_LocalSolderPasteMargin;
m_LocalSolderPasteMarginRatio = aModule.m_LocalSolderPasteMarginRatio;
/* Copy reference and value. */
// Copy reference and value.
m_Reference = new TEXTE_MODULE( *aModule.m_Reference );
m_Reference->SetParent( this );
m_Value = new TEXTE_MODULE( *aModule.m_Value );
m_Value->SetParent( this );
/* Copy auxiliary data: Pads */
// Copy auxiliary data: Pads
m_Pads.DeleteAll();
for( D_PAD* pad = aModule.m_Pads; pad; pad = pad->Next() )
@ -118,7 +118,7 @@ MODULE::MODULE( const MODULE& aModule ) :
m_Pads.PushBack( newpad );
}
/* Copy auxiliary data: Drawings */
// Copy auxiliary data: Drawings
m_Drawings.DeleteAll();
for( BOARD_ITEM* item = aModule.m_Drawings; item; item = item->Next() )
@ -138,7 +138,7 @@ MODULE::MODULE( const MODULE& aModule ) :
}
}
/* Copy auxiliary data: 3D_Drawings info */
// Copy auxiliary data: 3D_Drawings info
m_3D_Drawings.DeleteAll();
for( S3D_MASTER* item = aModule.m_3D_Drawings; item; item = item->Next() )
@ -217,11 +217,11 @@ void MODULE::Copy( MODULE* aModule )
m_LocalSolderPasteMargin = aModule->m_LocalSolderPasteMargin;
m_LocalSolderPasteMarginRatio = aModule->m_LocalSolderPasteMarginRatio;
/* Copy reference and value. */
// Copy reference and value.
m_Reference->Copy( aModule->m_Reference );
m_Value->Copy( aModule->m_Value );
/* Copy auxiliary data: Pads */
// Copy auxiliary data: Pads
m_Pads.DeleteAll();
for( D_PAD* pad = aModule->m_Pads; pad; pad = pad->Next() )
@ -231,7 +231,7 @@ void MODULE::Copy( MODULE* aModule )
m_Pads.PushBack( newpad );
}
/* Copy auxiliary data: Drawings */
// Copy auxiliary data: Drawings
m_Drawings.DeleteAll();
for( BOARD_ITEM* item = aModule->m_Drawings; item; item = item->Next() )
@ -258,7 +258,7 @@ void MODULE::Copy( MODULE* aModule )
}
}
/* Copy auxiliary data: 3D_Drawings info */
// Copy auxiliary data: 3D_Drawings info
m_3D_Drawings.DeleteAll();
// Ensure there is one (or more) item in m_3D_Drawings
@ -314,7 +314,7 @@ void MODULE::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, const wxPoi
// Draws footprint anchor
DrawAncre( aPanel, aDC, aOffset, DIM_ANCRE_MODULE, aDrawMode );
/* Draw graphic items */
// Draw graphic items
if( brd->IsElementVisible( MOD_REFERENCES_VISIBLE ) )
{
if( !(m_Reference->IsMoving()) )
@ -549,8 +549,8 @@ D_PAD* MODULE::GetPad( const wxPoint& aPosition, int aLayerMask )
{
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
{
/* ... and on the correct layer. */
if( ( pad->m_layerMask & aLayerMask ) == 0 )
// ... and on the correct layer.
if( ( pad->GetLayerMask() & aLayerMask ) == 0 )
continue;
if( pad->HitTest( aPosition ) )

View File

@ -29,8 +29,8 @@
*/
#ifndef _MODULE_H_
#define _MODULE_H_
#ifndef MODULE_H_
#define MODULE_H_
#include <dlist.h>
@ -410,4 +410,4 @@ private:
};
#endif // _MODULE_H_
#endif // MODULE_H_

View File

@ -161,22 +161,9 @@ void MODULE::Flip( const wxPoint& aCentre )
NEGATE( m_Orient );
NORMALIZE_ANGLE_POS( m_Orient );
// Mirror inversion layers pads.
// Mirror pads to other side of board about the x axis, i.e. vertically.
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
{
pad->m_Pos.y -= m_Pos.y;
pad->m_Pos.y = -pad->m_Pos.y;
pad->m_Pos.y += m_Pos.y;
NEGATE( pad->m_Pos0.y );
NEGATE( pad->m_Offset.y );
NEGATE( pad->m_DeltaSize.y );
NEGATE_AND_NORMALIZE_ANGLE_POS( pad->m_Orient );
// flip pads layers
pad->m_layerMask = ChangeSideMaskLayer( pad->m_layerMask );
}
pad->Flip( m_Pos.y );
// Mirror reference.
pt_texte = m_Reference;
@ -301,7 +288,7 @@ void MODULE::SetPosition( const wxPoint& newpos )
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
{
pad->m_Pos += delta;
pad->SetPosition( pad->GetPosition() + delta );
}
for( EDA_ITEM* item = m_Drawings; item; item = item->Next() )
@ -334,25 +321,22 @@ void MODULE::SetPosition( const wxPoint& newpos )
void MODULE::SetOrientation( double newangle )
{
int px, py;
double angleChange = newangle - m_Orient; // change in rotation
wxPoint pt;
newangle -= m_Orient; // = Change in rotation
NORMALIZE_ANGLE_POS( newangle );
m_Orient += newangle;
NORMALIZE_ANGLE_POS( m_Orient );
m_Orient = newangle;
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
{
px = pad->m_Pos0.x;
py = pad->m_Pos0.y;
pt = pad->GetPos0();
pad->m_Orient += newangle; // change m_Orientation
NORMALIZE_ANGLE_POS( pad->m_Orient );
pad->SetOrientation( pad->GetOrientation() + angleChange );
RotatePoint( &px, &py, m_Orient );
pad->m_Pos.x = m_Pos.x + px;
pad->m_Pos.y = m_Pos.y + py;
RotatePoint( &pt, m_Orient );
pad->SetPosition( GetPosition() + pt );
}
// Update of the reference and value.

View File

@ -100,7 +100,7 @@ void NETINFO_ITEM::DisplayInfo( EDA_DRAW_FRAME* frame )
if( pad->GetNet() == GetNet() )
{
count++;
lengthdie += pad->m_LengthDie;
lengthdie += pad->GetDieLength();
}
}
}
@ -172,6 +172,7 @@ void RATSNEST_ITEM::Draw( EDA_DRAW_PANEL* panel,
int color = g_ColorsSettings.GetItemColor(RATSNEST_VISIBLE);
GRLine( panel->GetClipBox(), DC, m_PadStart->m_Pos - aOffset,
m_PadEnd->m_Pos - aOffset, 0, color );
GRLine( panel->GetClipBox(), DC,
m_PadStart->GetPosition() - aOffset,
m_PadEnd->GetPosition() - aOffset, 0, color );
}

View File

@ -33,6 +33,7 @@
#include <confirm.h>
#include <kicad_string.h>
#include <trigo.h>
#include <protos.h>
#include <richio.h>
#include <wxstruct.h>
#include <macros.h>
@ -47,7 +48,8 @@
int D_PAD::m_PadSketchModePenSize = 0; // Pen size used to draw pads in sketch mode
D_PAD::D_PAD( MODULE* parent ) : BOARD_CONNECTED_ITEM( parent, PCB_PAD_T )
D_PAD::D_PAD( MODULE* parent ) :
BOARD_CONNECTED_ITEM( parent, PCB_PAD_T )
{
m_NumPadName = 0;
@ -55,40 +57,35 @@ D_PAD::D_PAD( MODULE* parent ) : BOARD_CONNECTED_ITEM( parent, PCB_PAD_T )
m_Orient = 0; // Pad rotation in 1/10 degrees
m_LengthDie = 0;
if( m_Parent && (m_Parent->Type() == PCB_MODULE_T) )
if( m_Parent && m_Parent->Type() == PCB_MODULE_T )
{
m_Pos = ( (MODULE*) m_Parent )->GetPosition();
m_Pos = GetParent()->GetPosition();
}
m_PadShape = PAD_CIRCLE; // Shape: PAD_CIRCLE, PAD_RECT PAD_OVAL
// PAD_TRAPEZOID
m_Attribut = PAD_STANDARD; // Type: NORMAL, PAD_SMD, PAD_CONN
m_DrillShape = PAD_CIRCLE; // Drill shape = circle
m_PadShape = PAD_CIRCLE; // Shape: PAD_CIRCLE, PAD_RECT PAD_OVAL
// PAD_TRAPEZOID
m_Attribute = PAD_STANDARD; // Type: NORMAL, PAD_SMD, PAD_CONN
m_DrillShape = PAD_CIRCLE; // Drill shape = circle
m_LocalClearance = 0;
m_LocalSolderMaskMargin = 0;
m_LocalSolderPasteMargin = 0;
m_LocalSolderPasteMarginRatio = 0.0;
m_layerMask = PAD_STANDARD_DEFAULT_LAYERS; // set layers mask to
// default for a standard pad
SetSubRatsnest( 0 ); // used in ratsnest calculations
ComputeShapeMaxRadius();
// set layers mask to default for a standard pad
m_layerMask = PAD_STANDARD_DEFAULT_LAYERS;
SetSubRatsnest( 0 ); // used in ratsnest calculations
m_boundingRadius = -1;
}
D_PAD::~D_PAD()
{
}
/* Calculate the radius of the circle containing the pad.
*/
int D_PAD::GetMaxRadius() const
int D_PAD::boundingRadius() const
{
int x, y;
int radius;
switch( m_PadShape & 0x7F )
switch( GetShape() )
{
case PAD_CIRCLE:
radius = m_Size.x / 2;
@ -110,30 +107,19 @@ int D_PAD::GetMaxRadius() const
break;
default:
radius = 0; // quiet compiler
radius = 0;
}
return radius;
}
/* Calculate the radius of the circle containing the pad.
*/
void D_PAD::ComputeShapeMaxRadius()
{
m_ShapeMaxRadius = GetMaxRadius();
}
/**
* Function GetBoundingBox
* returns the bounding box of this pad
* Mainly used to redraw the screen area occupied by the pad
*/
EDA_RECT D_PAD::GetBoundingBox() const
{
EDA_RECT area;
int radius = GetMaxRadius(); // Calculate the radius of the area, considered as a circle
// radius of pad area, enclosed in minimum sized circle
int radius = boundingRadius();
area.SetOrigin( m_Pos );
area.Inflate( radius );
@ -142,6 +128,49 @@ EDA_RECT D_PAD::GetBoundingBox() const
}
void D_PAD::SetOrientation( double aAngle )
{
NORMALIZE_ANGLE_POS( aAngle );
m_Orient = aAngle;
}
void D_PAD::Flip( int aTranslationY )
{
int y = GetPosition().y - aTranslationY;
y = -y; // invert about x axis.
y += aTranslationY;
SetY( y );
NEGATE( m_Pos0.y );
NEGATE( m_Offset.y );
NEGATE( m_DeltaSize.y );
SetOrientation( -GetOrientation() );
// flip pads layers
SetLayerMask( ChangeSideMaskLayer( m_layerMask ) );
// m_boundingRadius = -1; the shape has not been changed
}
void D_PAD::AppendConfigs( PARAM_CFG_ARRAY* aResult )
{
aResult->push_back( new PARAM_CFG_INT( wxT( "PadDrlX" ), &m_Drill.x,
320, 0, 0x7FFF ) );
aResult->push_back( new PARAM_CFG_INT( wxT( "PadDimH" ), &m_Size.x,
550, 0, 0x7FFF ) );
aResult->push_back( new PARAM_CFG_INT( wxT( "PadDimV" ), &m_Size.y,
550, 0, 0x7FFF ) );
}
// Returns the position of the pad.
const wxPoint D_PAD::ReturnShapePos()
{
@ -265,9 +294,9 @@ void D_PAD::Copy( D_PAD* source )
m_Size = source->m_Size;
m_DeltaSize = source->m_DeltaSize;
m_Pos0 = source->m_Pos0;
m_ShapeMaxRadius = source->m_ShapeMaxRadius;
m_boundingRadius = source->m_boundingRadius;
m_PadShape = source->m_PadShape;
m_Attribut = source->m_Attribut;
m_Attribute = source->m_Attribute;
m_Orient = source->m_Orient;
m_LengthDie = source->m_LengthDie;
m_LocalClearance = source->m_LocalClearance;
@ -581,9 +610,9 @@ void D_PAD::DisplayInfo( EDA_DRAW_FRAME* frame )
valeur_param( m_Pos.y, Line );
frame->AppendMsgPanel( _( "Y pos" ), Line, LIGHTBLUE );
if( m_LengthDie )
if( GetDieLength() )
{
valeur_param( m_LengthDie, Line );
valeur_param( GetDieLength(), Line );
frame->AppendMsgPanel( _( "Length on die" ), Line, CYAN );
}
}
@ -596,12 +625,6 @@ bool D_PAD::IsOnLayer( int aLayer ) const
}
/**
* Function HitTest
* tests if the given wxPoint is within the bounds of this object.
* @param refPos A wxPoint to test
* @return bool - true if a hit, else false
*/
bool D_PAD::HitTest( const wxPoint& refPos )
{
int dx, dy;
@ -611,8 +634,10 @@ bool D_PAD::HitTest( const wxPoint& refPos )
wxPoint delta = refPos - shape_pos;
/* Quick test: a test point must be inside the circle. */
if( ( abs( delta.x ) > m_ShapeMaxRadius ) || ( abs( delta.y ) > m_ShapeMaxRadius ) )
// first test: a test point must be inside a minimum sized bounding circle.
int radius = GetBoundingRadius();
if( ( abs( delta.x ) > radius ) || ( abs( delta.y ) > radius ) )
return false;
dx = m_Size.x >> 1; // dx also is the radius for rounded pads
@ -716,7 +741,7 @@ wxString D_PAD::ShowPadShape() const
wxString D_PAD::ShowPadAttr() const
{
switch( m_Attribut & 0x0F )
switch( GetAttribute() )
{
case PAD_STANDARD:
return _( "Std" );

View File

@ -27,14 +27,15 @@
* @brief Pad object description
*/
#ifndef _PAD_H_
#define _PAD_H_
#ifndef PAD_H_
#define PAD_H_
#include <class_board_item.h>
#include <class_board_connected_item.h>
#include <pad_shapes.h>
#include <PolyLine.h>
#include <param_config.h> // PARAM_CFG_ARRAY
class LINE_READER;
@ -91,86 +92,20 @@ public:
class D_PAD : public BOARD_CONNECTED_ITEM
{
private:
wxString m_Netname; // Full net name like /mysheet/mysubsheet/vout used by Eeschema
wxString m_ShortNetname; // short net name, like vout from /mysheet/mysubsheet/vout
/// Pad name (4 char) or a long identifier (used in pad name
/// comparisons because this is faster than string comparison)
union
{
#define PADNAMEZ 4
char m_Padname[PADNAMEZ]; // zero padded at end to full size
wxUint32 m_NumPadName; // same number of bytes as m_Padname[]
};
int m_SubRatsnest; // variable used in rats nest computations
// handle subnet (block) number in ratsnest connection
public:
wxPoint m_Pos; // pad Position on board
int m_layerMask; // Bitwise layer :1= copper layer, 15= cmp,
// 2..14 = internal layers
// 16 .. 31 = technical layers
int m_PadShape; // Shape: PAD_CIRCLE, PAD_RECT, PAD_OVAL, PAD_TRAPEZOID
int m_DrillShape; // Shape PAD_CIRCLE, PAD_OVAL
wxSize m_Drill; // Drill diam (drill shape = PAD_CIRCLE) or drill size
// (shape = OVAL) for drill shape = PAD_CIRCLE, drill
// diam = m_Drill.x
wxSize m_Offset; /* This parameter is useful only for oblong pads (it can be used for other
* shapes, but without any interest).
* this is the offset between the pad hole and the pad shape (you must
* understand here pad shape = copper area around the hole)
* Most of cases, the hole is the center of the shape (m_Offset = 0).
* But some board designers use oblong pads with a hole moved to one of the
* oblong pad shape ends.
* In all cases the pad position is the pad hole.
* The physical shape position (used to draw it for instance) is pad
* position (m_Pos) + m_Offset.
* D_PAD::ReturnShapePos() returns the physical shape position according to
* the offset and the pad rotation.*/
wxSize m_Size; // X and Y size ( relative to orient 0)
wxSize m_DeltaSize; // delta on rectangular shapes
wxPoint m_Pos0; // Initial Pad position (i.e. pad position relative to the
// module anchor, orientation 0
int m_ShapeMaxRadius; // radius of the circle containing the pad shape
int m_Attribut; // NORMAL, PAD_SMD, PAD_CONN, PAD_HOLE_NOT_PLATED
double m_Orient; // in 1/10 degrees
static int m_PadSketchModePenSize; // Pen size used to draw pads in sketch mode
// (mode used to print pads on silkscreen layer)
int m_LengthDie; // Length net from pad to die on chip
// Local clearance. When null, the module default value is used.
// when the module default value is null, the netclass value is used
// Usually the local clearance is null
int m_LocalClearance;
// Local mask margins: when NULL, the parent footprint design values are used
int m_LocalSolderMaskMargin; // Local solder mask margin
int m_LocalSolderPasteMargin; // Local solder paste margin absolute value
double m_LocalSolderPasteMarginRatio; // Local solder mask margin ratio value of pad size
// The final margin is the sum of these 2 values
static int m_PadSketchModePenSize; ///< Pen size used to draw pads in sketch mode
///< (mode used to print pads on silkscreen layer)
public:
D_PAD( MODULE* parent );
// Do not create a copy constructor. The one generated by the compiler is adequate.
~D_PAD();
void Copy( D_PAD* source );
D_PAD* Next() { return (D_PAD*) Pnext; }
D_PAD* Next() const { return (D_PAD*) Pnext; }
MODULE* GetParent() const { return (MODULE*) m_Parent; }
void SetPadName( const wxString& name ); // Change pad name
const wxString GetPadName() const;
@ -202,36 +137,50 @@ public:
* Function GetShape
* @return the shape of this pad.
*/
int GetShape() const { return m_PadShape & 0xFF; }
void SetShape( int aShape ) { m_PadShape = aShape; }
PAD_SHAPE_T GetShape() const { return m_PadShape; }
void SetShape( PAD_SHAPE_T aShape ) { m_PadShape = aShape; m_boundingRadius = -1; }
void SetPosition( const wxPoint& aPos ) { m_Pos = aPos; } // overload
const wxPoint GetPosition() const // overload
{
return m_Pos;
}
const wxPoint GetPosition() const { return m_Pos; } // overload
void SetY( int y ) { m_Pos.y = y; }
void SetX( int x ) { m_Pos.x = x; }
void SetPos0( const wxPoint& aPos ) { m_Pos0 = aPos; }
const wxPoint& GetPos0() const { return m_Pos0; }
void SetSize( const wxSize& aSize ) { m_Size = aSize; }
void SetY0( int y ) { m_Pos0.y = y; }
void SetX0( int x ) { m_Pos0.x = x; }
void SetSize( const wxSize& aSize ) { m_Size = aSize; m_boundingRadius = -1; }
const wxSize& GetSize() const { return m_Size; }
void SetDelta( const wxSize& aSize ) { m_DeltaSize = aSize; }
void SetDelta( const wxSize& aSize ) { m_DeltaSize = aSize; m_boundingRadius = -1; }
const wxSize& GetDelta() const { return m_DeltaSize; }
void SetDrillSize( const wxSize& aSize ) { m_Drill = aSize; }
const wxSize& GetDrillSize() const { return m_Drill; }
void SetOffset( const wxSize& aOffset ) { m_Offset = aOffset; }
const wxSize& GetOffset() const { return m_Offset; }
void SetOffset( const wxPoint& aOffset ) { m_Offset = aOffset; }
const wxPoint& GetOffset() const { return m_Offset; }
/**
* Function Flip
* flips this pad to the other outter most copper layer, back to front or
* vice versa, and does this vertically, so the x coordinate is not affected.
*
* @param aTranslationY is the contribution of my 'y' position provided by
* my parent module.
*/
void Flip( int aTranslationY );
/**
* Function SetOrientation
* sets the rotation angle of the pad.
* @param aAngle is tenths of degrees, but will soon be degrees.
* @param aAngle is tenths of degrees, but will soon be degrees. If it is
* outside of 0 - 3600, then it will be normalized before being saved.
*/
void SetOrientation( double aAngle ) { m_Orient = aAngle; } // manage migration to degrees
void SetOrientation( double aAngle );
/**
* Function GetOrientation
@ -239,25 +188,25 @@ public:
*/
double GetOrientation() const { return m_Orient; }
void SetDrillShape( int aDrillShape ) { m_DrillShape = aDrillShape; }
int GetDrillShape() const { return m_DrillShape; }
void SetDrillShape( PAD_SHAPE_T aDrillShape ) { m_DrillShape = aDrillShape; }
PAD_SHAPE_T GetDrillShape() const { return m_DrillShape; }
void SetLayerMask( int aLayerMask ) { m_layerMask = aLayerMask; }
int GetLayerMask() const { return m_layerMask; }
void SetAttribute( int aAttribute ) { m_Attribut = aAttribute; }
int GetAttribute() const { return m_Attribut; }
void SetAttribute( PAD_ATTR_T aAttribute ) { m_Attribute = aAttribute; }
PAD_ATTR_T GetAttribute() const { return m_Attribute; }
void SetDieLength( int aLength ) { m_LengthDie = aLength; }
int GetDieLength() const { return m_LengthDie; }
int GetLocalSolderMaskMargin() const { return m_LocalSolderMaskMargin; }
int GetLocalSolderMaskMargin() const { return m_LocalSolderMaskMargin; }
void SetLocalSolderMaskMargin( int aMargin ) { m_LocalSolderMaskMargin = aMargin; }
int GetLocalClearance() const { return m_LocalClearance; }
void SetLocalClearance( int aClearance ) { m_LocalClearance = aClearance; }
int GetLocalClearance() const { return m_LocalClearance; }
void SetLocalClearance( int aClearance ) { m_LocalClearance = aClearance; }
int GetLocalSolderPasteMargin() const { return m_LocalSolderPasteMargin; }
int GetLocalSolderPasteMargin() const { return m_LocalSolderPasteMargin; }
void SetLocalSolderPasteMargin( int aMargin ) { m_LocalSolderPasteMargin = aMargin; }
double GetLocalSolderPasteMarginRatio() const { return m_LocalSolderPasteMarginRatio; }
@ -382,18 +331,29 @@ public:
void ReturnStringPadName( wxString& text ) const; // Return pad name as string in a buffer
void ComputeShapeMaxRadius(); // compute radius
int GetMaxRadius() const;
/**
* Function GetBoundingRadius
* returns the radius of a minimum sized circle which fully encloses this pad.
*/
int GetBoundingRadius()
{
// Any member function which would affect this calculation should set
// m_boundingRadius to -1 to re-trigger the calculation from here.
// Currently that is only m_Size, m_DeltaSize, and m_PadShape accessors.
if( m_boundingRadius == -1 )
{
m_boundingRadius = boundingRadius();
}
return m_boundingRadius;
}
const wxPoint ReturnShapePos();
/**
* Function GetNet
* Function GetSubRatsnest
* @return int - the netcode
*/
int GetSubRatsnest() const { return m_SubRatsnest; }
void SetSubRatsnest( int aSubRatsnest ) { m_SubRatsnest = aSubRatsnest; }
@ -475,13 +435,101 @@ public:
*/
wxString ShowPadAttr() const;
/**
* Function AppendConfigs
* appends to @a aResult the configuration setting accessors which will later
* allow reading or writing of configuration file information directly into
* this object.
*/
void AppendConfigs( PARAM_CFG_ARRAY* aResult );
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const; // overload
#endif
private:
virtual EDA_ITEM* doClone() const;
/**
* Function boundingRadius
* returns a calculated radius of a bounding circle for this pad.
*/
int boundingRadius() const;
int m_boundingRadius; ///< radius of the circle containing the pad shape
wxString m_Netname; ///< Full net name like /mysheet/mysubsheet/vout used by Eeschema
wxString m_ShortNetname; ///< short net name, like vout from /mysheet/mysubsheet/vout
/// Pad name (4 char) or a long identifier (used in pad name
/// comparisons because this is faster than string comparison)
union
{
#define PADNAMEZ 4
char m_Padname[PADNAMEZ]; // zero padded at end to full size
wxUint32 m_NumPadName; // same number of bytes as m_Padname[]
};
wxPoint m_Pos; ///< pad Position on board
PAD_SHAPE_T m_PadShape; ///< Shape: PAD_CIRCLE, PAD_RECT, PAD_OVAL, PAD_TRAPEZOID
int m_SubRatsnest; ///< variable used in rats nest computations
///< handle subnet (block) number in ratsnest connection
wxSize m_Drill; ///< Drill diam (drill shape = PAD_CIRCLE) or drill size
///< (shape = OVAL) for drill shape = PAD_CIRCLE, drill
///< diam = m_Drill.x
wxSize m_Size; ///< X and Y size ( relative to orient 0)
PAD_SHAPE_T m_DrillShape; ///< Shape PAD_CIRCLE, PAD_OVAL
/**
* m_Offset is useful only for oblong pads (it can be used for other
* shapes, but without any interest).
* this is the offset between the pad hole and the pad shape (you must
* understand here pad shape = copper area around the hole)
* Most of cases, the hole is the center of the shape (m_Offset = 0).
* But some board designers use oblong pads with a hole moved to one of the
* oblong pad shape ends.
* In all cases the pad position is the pad hole.
* The physical shape position (used to draw it for instance) is pad
* position (m_Pos) + m_Offset.
* D_PAD::ReturnShapePos() returns the physical shape position according to
* the offset and the pad rotation.
*/
wxPoint m_Offset;
int m_layerMask; ///< Bitwise layer :1= copper layer, 15= cmp,
///< 2..14 = internal layers
///< 16 .. 31 = technical layers
wxSize m_DeltaSize; ///< delta on rectangular shapes
wxPoint m_Pos0; ///< Initial Pad position (i.e. pad position relative to the
///< module anchor, orientation 0)
PAD_ATTR_T m_Attribute; ///< NORMAL, PAD_SMD, PAD_CONN, PAD_HOLE_NOT_PLATED
double m_Orient; ///< in 1/10 degrees
int m_LengthDie; ///< Length net from pad to die on chip
/// Local clearance. When null, the module default value is used.
/// when the module default value is null, the netclass value is used
/// Usually the local clearance is null
int m_LocalClearance;
// Local mask margins: when 0, the parent footprint design values are used
int m_LocalSolderMaskMargin; ///< Local solder mask margin
int m_LocalSolderPasteMargin; ///< Local solder paste margin absolute value
double m_LocalSolderPasteMarginRatio; ///< Local solder mask margin ratio value of pad size
///< The final margin is the sum of these 2 values
};
#endif // _PAD_H_
#endif // PAD_H_

View File

@ -234,7 +234,7 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDraw_mode, const wxPoi
}
// if PAD_SMD pad and high contrast mode
if( ( m_Attribut == PAD_SMD || m_Attribut == PAD_CONN ) && DisplayOpt.ContrastModeDisplay )
if( ( GetAttribute() == PAD_SMD || GetAttribute() == PAD_CONN ) && DisplayOpt.ContrastModeDisplay )
{
// when routing tracks
if( frame && frame->GetToolId() == ID_TRACK_BUTT )
@ -346,7 +346,7 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDraw_mode, const wxPoi
if( ( m_layerMask & ALL_CU_LAYERS ) == 0 )
DisplayIsol = false;
if( m_Attribut == PAD_HOLE_NOT_PLATED )
if( GetAttribute() == PAD_HOLE_NOT_PLATED )
drawInfo.m_ShowNotPlatedHole = true;
drawInfo.m_DrawMode = aDraw_mode;

View File

@ -37,7 +37,7 @@
#include <class_board.h>
#include <class_track.h>
/* local functions : */
// local functions :
static void clean_segments( PCB_EDIT_FRAME* aFrame );
static void clean_vias( BOARD* aPcb );
static void DeleteUnconnectedTracks( PCB_EDIT_FRAME* aFrame );
@ -93,7 +93,7 @@ void CleanupTracks( PCB_EDIT_FRAME* aFrame,
aFrame->GetScreen()->ClearUndoRedoList();
aFrame->SetCurItem( NULL );
/* Rebuild the pad infos (pad list and netcodes) to ensure an up to date info */
// Rebuild the pad infos (pad list and netcodes) to ensure an up to date info
aFrame->GetBoard()->m_Status_Pcb = 0;
aFrame->GetBoard()->BuildListOfNets();
@ -110,22 +110,22 @@ void CleanupTracks( PCB_EDIT_FRAME* aFrame,
{
aFrame->SetStatusText( _( "Reconnect pads" ) );
/* Create missing segments when a track end covers a pad, but is not on the pad center */
// Create missing segments when a track end covers a pad, but is not on the pad center
ConnectDanglingEndToPad( aFrame );
/* Create missing segments when a track end covers a via, but is not on the via center */
// Create missing segments when a track end covers a via, but is not on the via center
ConnectDanglingEndToVia( aFrame->GetBoard() );
}
#endif
/* Remove null segments and intermediate points on aligned segments */
// Remove null segments and intermediate points on aligned segments
if( aMergeSegments )
{
aFrame->SetStatusText( _( "Merge track segments" ) );
clean_segments( aFrame );
}
/* Delete dangling tracks */
// Delete dangling tracks
if( aDeleteUnconnectedSegm )
{
aFrame->SetStatusText( _( "Delete unconnected tracks" ) );
@ -163,13 +163,13 @@ void clean_vias( BOARD * aPcb )
if( alt_track->m_Start != track->m_Start )
continue;
/* delete via */
// delete via
alt_track->UnLink();
delete alt_track;
}
}
/* Delete Via on pads at same location */
// Delete Via on pads at same location
for( track = aPcb->m_Track; track != NULL; track = next_track )
{
next_track = track->Next();
@ -179,9 +179,9 @@ void clean_vias( BOARD * aPcb )
D_PAD* pad = aPcb->GetPadFast( track->m_Start, ALL_CU_LAYERS );
if( pad && (pad->m_layerMask & EXTERNAL_LAYERS) == EXTERNAL_LAYERS ) // redundant Via
if( pad && (pad->GetLayerMask() & EXTERNAL_LAYERS) == EXTERNAL_LAYERS ) // redundant Via
{
/* delete via */
// delete via
track->UnLink();
delete track;
}
@ -243,7 +243,7 @@ static void DeleteUnconnectedTracks( PCB_EDIT_FRAME* aFrame )
flag_erase = 0; //Not connected indicator
type_end = 0;
/* Is a pad found on a track end ? */
// Is a pad found on a track end ?
masklayer = segment->ReturnMaskLayer();
@ -403,7 +403,7 @@ static void DeleteUnconnectedTracks( PCB_EDIT_FRAME* aFrame )
}
/* Delete null length segments, and intermediate points .. */
// Delete null length segments, and intermediate points ..
static void clean_segments( PCB_EDIT_FRAME* aFrame )
{
TRACK* segment, * nextsegment;
@ -422,11 +422,11 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame )
if( !segment->IsNull() )
continue;
/* Length segment = 0; delete it */
// Length segment = 0; delete it
segment->DeleteStructure();
}
/* Delete redundant segments */
// Delete redundant segments
for( segment = aFrame->GetBoard()->m_Track, ii = 0; segment; segment = segment->Next(), ii++ )
{
for( other = segment->Next(); other; other = nextsegment )
@ -455,7 +455,7 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame )
erase = 1;
}
/* Delete redundant point */
// Delete redundant point
if( erase )
{
ii--;
@ -464,7 +464,7 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame )
}
}
/* delete intermediate points */
// delete intermediate points
ii = 0;
for( segment = aFrame->GetBoard()->m_Track; segment; segment = nextsegment )
@ -498,13 +498,13 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame )
if( segStart->Type() != PCB_TRACE_T )
break;
/* We must have only one segment connected */
// We must have only one segment connected
segStart->SetState( BUSY, ON );
other = segment->GetTrace( aFrame->GetBoard()->m_Track, NULL, START );
segStart->SetState( BUSY, OFF );
if( other == NULL )
flag = 1; /* OK */
flag = 1; // OK
break;
}
@ -523,7 +523,7 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame )
}
}
/* search for a possible point that connects on the END point of the segment: */
// search for a possible point that connects on the END point of the segment:
for( segEnd = segment->Next(); ; )
{
segEnd = segment->GetTrace( segEnd, NULL, END );
@ -536,13 +536,13 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame )
if( segEnd->Type() != PCB_TRACE_T )
break;
/* We must have only one segment connected */
// We must have only one segment connected
segEnd->SetState( BUSY, ON );
other = segment->GetTrace( aFrame->GetBoard()->m_Track, NULL, END );
segEnd->SetState( BUSY, OFF );
if( other == NULL )
flag |= 2; /* Ok */
flag |= 2; // Ok
break;
}
@ -563,7 +563,7 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame )
}
}
if( no_inc ) /* The current segment was modified, retry to merge it */
if( no_inc ) // The current segment was modified, retry to merge it
nextsegment = segment->Next();
}
@ -571,7 +571,7 @@ static void clean_segments( PCB_EDIT_FRAME* aFrame )
}
/* Function used by clean_segments.
/** Function used by clean_segments.
* Test alignment of aTrackRef and aCandidate (which must have a common end).
* and see if the common point is not on a pad (i.e. if this common point can be removed).
* the ending point of pt_ref is the start point (aEndType == START)
@ -876,15 +876,15 @@ void ConnectDanglingEndToPad( PCB_EDIT_FRAME* aFrame )
if( pad )
{
// test if the track start point is not exactly starting on the pad
if( segment->m_Start != pad->m_Pos )
if( segment->m_Start != pad->GetPosition() )
{
if( segment->GetTrace( aFrame->GetBoard()->m_Track, NULL, START ) == NULL )
{
TRACK* newTrack = (TRACK*)segment->Clone();
TRACK* newTrack = (TRACK*) segment->Clone();
aFrame->GetBoard()->m_Track.Insert( newTrack, segment->Next() );
newTrack->m_End = pad->m_Pos;
newTrack->m_End = pad->GetPosition();
newTrack->start = segment;
newTrack->end = pad;
@ -898,7 +898,7 @@ void ConnectDanglingEndToPad( PCB_EDIT_FRAME* aFrame )
if( pad )
{
// test if the track end point is not exactly on the pad
if( segment->m_End != pad->m_Pos )
if( segment->m_End != pad->GetPosition() )
{
if( segment->GetTrace( aFrame->GetBoard()->m_Track, NULL, END ) == NULL )
{
@ -906,7 +906,7 @@ void ConnectDanglingEndToPad( PCB_EDIT_FRAME* aFrame )
aFrame->GetBoard()->m_Track.Insert( newTrack, segment->Next() );
newTrack->m_Start = pad->m_Pos;
newTrack->m_Start = pad->GetPosition();
newTrack->start = pad;
newTrack->end = segment;

View File

@ -235,8 +235,8 @@ SEARCH_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* testItem, const void* testDa
// for through pads: pads on Front or Back board sides must be seen
pad = (D_PAD*) item;
if( (pad->m_Attribut != PAD_SMD) &&
(pad->m_Attribut != PAD_CONN) ) // a hole is present, so multiple layers
if( (pad->GetAttribute() != PAD_SMD) &&
(pad->GetAttribute() != PAD_CONN) ) // a hole is present, so multiple layers
{
// proceed to the common tests below, but without the parent module test,
// by leaving module==NULL, but having pad != null

View File

@ -42,7 +42,7 @@
extern void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb );
extern void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb, int aNetcode );
/* Local functions */
// Local functions
static void RebuildTrackChain( BOARD* pcb );
@ -276,7 +276,9 @@ void CONNECTIONS::SearchConnectionsPadsToIntersectingPads()
D_PAD * pad = m_sortedPads[ii];
pad->m_PadsConnected.clear();
candidates.clear();
CollectItemsNearTo( candidates, pad->ReturnShapePos(), pad->m_ShapeMaxRadius );
CollectItemsNearTo( candidates, pad->ReturnShapePos(), pad->GetBoundingRadius() );
// add pads to pad.m_PadsConnected, if they are connected
for( unsigned jj = 0; jj < candidates.size(); jj++ )
{
@ -285,7 +287,7 @@ void CONNECTIONS::SearchConnectionsPadsToIntersectingPads()
if( pad == candidate_pad )
continue;
if( (pad->m_layerMask & candidate_pad->m_layerMask) == 0 )
if( (pad->GetLayerMask() & candidate_pad->GetLayerMask()) == 0 )
continue;
if( pad->HitTest( item->GetPoint() ) )
{
@ -311,14 +313,16 @@ void CONNECTIONS::SearchTracksConnectedToPads()
pad->m_TracksConnected.clear();
candidates.clear();
CollectItemsNearTo( candidates, pad->GetPosition(), pad->m_ShapeMaxRadius );
CollectItemsNearTo( candidates, pad->GetPosition(), pad->GetBoundingRadius() );
// add this pad to track.m_PadsConnected, if it is connected
for( unsigned jj = 0; jj < candidates.size(); jj++ )
{
CONNECTED_POINT * cp_item = candidates[jj];
if( (pad->m_layerMask & cp_item->GetTrack()->ReturnMaskLayer()) == 0 )
CONNECTED_POINT* cp_item = candidates[jj];
if( (pad->GetLayerMask() & cp_item->GetTrack()->ReturnMaskLayer()) == 0 )
continue;
if( pad->HitTest( cp_item->GetPoint() ) )
{
cp_item->GetTrack()->m_PadsConnected.push_back( pad );
@ -731,7 +735,7 @@ void CONNECTIONS::Propagate_SubNets()
pad->SetSubNet( curr_pad->GetSubNet() );
}
}
else /* the track segment is not attached to a cluster */
else // the track segment is not attached to a cluster
{
if( pad->GetSubNet() > 0 )
{
@ -758,16 +762,16 @@ void CONNECTIONS::Propagate_SubNets()
// Examine connections between trcaks and pads
for( ; curr_track != NULL; curr_track = curr_track->Next() )
{
/* First: handling connections to pads */
// First: handling connections to pads
for( unsigned ii = 0; ii < curr_track->m_PadsConnected.size(); ii++ )
{
D_PAD * pad = curr_track->m_PadsConnected[ii];
if( curr_track->GetSubNet() ) /* the track segment is already a cluster member */
if( curr_track->GetSubNet() ) // the track segment is already a cluster member
{
if( pad->GetSubNet() > 0 )
{
/* The pad is already a cluster member, so we can merge the 2 clusters */
// The pad is already a cluster member, so we can merge the 2 clusters
Merge_SubNets( pad->GetSubNet(), curr_track->GetSubNet() );
}
else
@ -777,11 +781,11 @@ void CONNECTIONS::Propagate_SubNets()
pad->SetSubNet( curr_track->GetSubNet() );
}
}
else /* the track segment is not attached to a cluster */
else // the track segment is not attached to a cluster
{
if( pad->GetSubNet() > 0 )
{
/* it is connected to a pad in a cluster, merge this track */
// it is connected to a pad in a cluster, merge this track
curr_track->SetSubNet( pad->GetSubNet() );
}
else
@ -795,13 +799,13 @@ void CONNECTIONS::Propagate_SubNets()
}
}
/* Test connections between segments */
// Test connections between segments
for( unsigned ii = 0; ii < curr_track->m_TracksConnected.size(); ii++ )
{
BOARD_CONNECTED_ITEM* track = curr_track->m_TracksConnected[ii];
if( curr_track->GetSubNet() ) // The current track is already a cluster member
{
/* The other track is already a cluster member, so we can merge the 2 clusters */
// The other track is already a cluster member, so we can merge the 2 clusters
if( track->GetSubNet() )
{
Merge_SubNets( track->GetSubNet(), curr_track->GetSubNet() );
@ -920,7 +924,7 @@ void PCB_BASE_FRAME::TestNetConnection( wxDC* aDC, int aNetCode )
m_Pcb->Test_Connections_To_Copper_Areas( aNetCode );
/* Search for the first and the last segment relative to the given net code */
// Search for the first and the last segment relative to the given net code
if( m_Pcb->m_Track )
{
CONNECTIONS connections( m_Pcb );
@ -939,12 +943,12 @@ void PCB_BASE_FRAME::TestNetConnection( wxDC* aDC, int aNetCode )
Merge_SubNets_Connected_By_CopperAreas( m_Pcb, aNetCode );
/* rebuild the active ratsnest for this net */
// rebuild the active ratsnest for this net
DrawGeneralRatsnest( aDC, aNetCode );
TestForActiveLinksInRatsnest( aNetCode );
DrawGeneralRatsnest( aDC, aNetCode );
/* Display results */
// Display results
int net_notconnected_count = 0;
NETINFO_ITEM* net = m_Pcb->FindNet( aNetCode );
if( net ) // Should not occur, but ...
@ -1058,7 +1062,7 @@ void PCB_BASE_FRAME::RecalculateAllTracksNetcode()
}
}
/* Sort the track list by net codes: */
// Sort the track list by net codes:
RebuildTrackChain( m_Pcb );
}

View File

@ -120,14 +120,14 @@ void DIALOG_MODULE_BOARD_EDITOR::InitBoardProperties()
// These 2 parameters are usually < 0, so prepare entering a negative
// value, if current is 0
PutValueInLocalUnits( *m_SolderPasteMarginCtrl,
m_CurrentModule->m_LocalSolderPasteMargin,
m_CurrentModule->GetLocalSolderPasteMargin(),
internalUnit );
if( m_CurrentModule->m_LocalSolderPasteMargin == 0 )
if( m_CurrentModule->GetLocalSolderPasteMargin() == 0 )
m_SolderPasteMarginCtrl->SetValue( wxT( "-" ) +
m_SolderPasteMarginCtrl->GetValue() );
msg.Printf( wxT( "%.1f" ),
m_CurrentModule->m_LocalSolderPasteMarginRatio * 100.0 );
if( m_CurrentModule->m_LocalSolderPasteMarginRatio == 0.0 &&
m_CurrentModule->GetLocalSolderPasteMarginRatio() * 100.0 );
if( m_CurrentModule->GetLocalSolderPasteMarginRatio() == 0.0 &&
msg[0] == '0') // Sometimes Printf add a sign if the value is small
m_SolderPasteMarginRatioCtrl->SetValue( wxT("-") + msg );
else
@ -462,12 +462,13 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event )
}
// Initialize masks clearances
m_CurrentModule->m_LocalClearance =
ReturnValueFromTextCtrl( *m_NetClearanceValueCtrl, m_Parent->GetInternalUnits() );
m_CurrentModule->m_LocalSolderMaskMargin =
ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl, m_Parent->GetInternalUnits() );
m_CurrentModule->m_LocalSolderPasteMargin =
ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl, m_Parent->GetInternalUnits() );
m_CurrentModule->SetLocalClearance(
ReturnValueFromTextCtrl( *m_NetClearanceValueCtrl, m_Parent->GetInternalUnits() ) );
m_CurrentModule->SetLocalSolderMaskMargin(
ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl, m_Parent->GetInternalUnits() ) );
m_CurrentModule->SetLocalSolderPasteMargin(
ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl, m_Parent->GetInternalUnits() ) );
double dtmp = 0.0;
msg = m_SolderPasteMarginRatioCtrl->GetValue();
msg.ToDouble( &dtmp );
@ -479,7 +480,7 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event )
if( dtmp > +100 )
dtmp = +100;
m_CurrentModule->m_LocalSolderPasteMarginRatio = dtmp / 100;
m_CurrentModule->SetLocalSolderPasteMarginRatio( dtmp / 100 );
// Set Module Position
modpos.x = ReturnValueFromTextCtrl( *m_ModPositionX, PCB_INTERNAL_UNIT );

View File

@ -61,7 +61,7 @@ void DIALOG_MODULE_MODULE_EDITOR::InitModeditProperties()
m_LastSelected3DShapeIndex = -1;
/* Init 3D shape list */
// Init 3D shape list
S3D_MASTER* draw3D = m_CurrentModule->m_3D_Drawings;
while( draw3D )
@ -97,7 +97,7 @@ void DIALOG_MODULE_MODULE_EDITOR::InitModeditProperties()
"Use this attribute for \"virtual\" components drawn on board (like a old ISA PC bus connector)" ) );
#endif
/* Controls on right side of the dialog */
// Controls on right side of the dialog
switch( m_CurrentModule->m_Attributs & 255 )
{
case 0:
@ -154,13 +154,13 @@ void DIALOG_MODULE_MODULE_EDITOR::InitModeditProperties()
m_CurrentModule->m_LocalSolderMaskMargin, internalUnit );
// These 2 parameters are usually < 0, so prepare entering a negative value, if current is 0
PutValueInLocalUnits( *m_SolderPasteMarginCtrl,
m_CurrentModule->m_LocalSolderPasteMargin, internalUnit );
if( m_CurrentModule->m_LocalSolderPasteMargin == 0 )
m_CurrentModule->GetLocalSolderPasteMargin(), internalUnit );
if( m_CurrentModule->GetLocalSolderPasteMargin() == 0 )
m_SolderPasteMarginCtrl->SetValue( wxT("-") + m_SolderPasteMarginCtrl->GetValue() );
if( m_CurrentModule->m_LocalSolderPasteMarginRatio == 0.0 )
msg.Printf( wxT( "-%.1f" ), m_CurrentModule->m_LocalSolderPasteMarginRatio * 100.0 );
if( m_CurrentModule->GetLocalSolderPasteMarginRatio() == 0.0 )
msg.Printf( wxT( "-%.1f" ), m_CurrentModule->GetLocalSolderPasteMarginRatio() * 100.0 );
else
msg.Printf( wxT( "%.1f" ), m_CurrentModule->m_LocalSolderPasteMarginRatio * 100.0 );
msg.Printf( wxT( "%.1f" ), m_CurrentModule->GetLocalSolderPasteMarginRatio() * 100.0 );
m_SolderPasteMarginRatioCtrl->SetValue( msg );
// if m_3D_ShapeNameListBox is not empty, preselect first 3D shape
@ -369,21 +369,26 @@ void DIALOG_MODULE_MODULE_EDITOR::OnOkClick( wxCommandEvent& event )
// Initialize masks clearances
int internalUnit = m_Parent->GetInternalUnits();
m_CurrentModule->m_LocalClearance =
ReturnValueFromTextCtrl( *m_NetClearanceValueCtrl, internalUnit );
m_CurrentModule->m_LocalSolderMaskMargin =
ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl, internalUnit );
m_CurrentModule->m_LocalSolderPasteMargin =
ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl, internalUnit );
m_CurrentModule->SetLocalClearance(
ReturnValueFromTextCtrl( *m_NetClearanceValueCtrl, internalUnit ) );
m_CurrentModule->SetLocalSolderMaskMargin(
ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl, internalUnit ) );
m_CurrentModule->SetLocalSolderPasteMargin(
ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl, internalUnit ) );
double dtmp;
wxString msg = m_SolderPasteMarginRatioCtrl->GetValue();
msg.ToDouble( &dtmp );
// A margin ratio de -50% means no paste on a pad, the ratio must be >= 50 %
if( dtmp < -50 )
dtmp = -50;
m_CurrentModule->m_LocalSolderPasteMarginRatio = dtmp / 100;
/* Update 3D shape list */
m_CurrentModule->SetLocalSolderPasteMarginRatio( dtmp / 100 );
// Update 3D shape list
int ii = m_3D_ShapeNameListBox->GetSelection();
if ( ii >= 0 )
TransfertDisplayTo3DValues( ii );

View File

@ -174,8 +174,7 @@ void DIALOG_GENDRILL::InitDisplayParams( void )
m_MicroViaDrillValue->Enable( m_microViasCount );
/* Count plated pad holes and not plated pad holes:
*/
// Count plated pad holes and not plated pad holes:
m_platedPadsHoleCount = 0;
m_notplatedPadsHoleCount = 0;
@ -183,11 +182,11 @@ void DIALOG_GENDRILL::InitDisplayParams( void )
{
for( D_PAD* pad = module->m_Pads; pad != NULL; pad = pad->Next() )
{
if( pad->m_DrillShape == PAD_CIRCLE )
if( pad->GetDrillShape() == PAD_CIRCLE )
{
if( pad->m_Drill.x != 0 )
if( pad->GetDrillSize().x != 0 )
{
if( pad->m_Attribut == PAD_HOLE_NOT_PLATED )
if( pad->GetAttribute() == PAD_HOLE_NOT_PLATED )
m_notplatedPadsHoleCount++;
else
m_platedPadsHoleCount++;
@ -195,9 +194,9 @@ void DIALOG_GENDRILL::InitDisplayParams( void )
}
else
{
if( min( pad->m_Drill.x, pad->m_Drill.y ) != 0 )
if( min( pad->GetDrillSize().x, pad->GetDrillSize().y ) != 0 )
{
if( pad->m_Attribut == PAD_HOLE_NOT_PLATED )
if( pad->GetAttribute() == PAD_HOLE_NOT_PLATED )
m_notplatedPadsHoleCount++;
else
m_platedPadsHoleCount++;
@ -229,7 +228,7 @@ void DIALOG_GENDRILL::InitDisplayParams( void )
}
/* Save drill options: */
// Save drill options:
void DIALOG_GENDRILL::UpdateConfig()
{
SetParams();
@ -275,7 +274,7 @@ void DIALOG_GENDRILL::OnOkClick( wxCommandEvent& event )
void DIALOG_GENDRILL::OnCancelClick( wxCommandEvent& event )
{
UpdateConfig(); /* Save drill options: */
UpdateConfig(); // Save drill options:
EndModal( wxID_CANCEL ); // Process the default cancel event (close dialog)
}
@ -294,13 +293,13 @@ void DIALOG_GENDRILL::UpdatePrecisionOptions()
{
if( m_Choice_Unit->GetSelection()== 1 ) // Units = inches
{
/* inch options */
// inch options
m_Choice_Precision->SetString( 0, precisionListForInches[0].GetPrecisionString() );
m_Choice_Precision->SetString( 1, precisionListForInches[1].GetPrecisionString() );
}
else
{
/* metric options */
// metric options
m_Choice_Precision->SetString( 0, precisionListForMetric[0].GetPrecisionString() );
m_Choice_Precision->SetString( 1, precisionListForMetric[1].GetPrecisionString() );
}

Some files were not shown because too many files have changed in this diff Show More