2011-09-23 13:57:12 +00:00
|
|
|
/**
|
|
|
|
* @file class_module_transform_functions.cpp
|
|
|
|
* @brief Functions of class MODULE to handle some geometric changes such as move, rotate ...
|
|
|
|
*/
|
2009-08-01 19:26:05 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
|
|
|
#include <wxstruct.h>
|
|
|
|
#include <trigo.h>
|
|
|
|
#include <pcbcommon.h>
|
|
|
|
#include <pcbnew.h>
|
|
|
|
#include <macros.h>
|
2011-09-23 13:57:12 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <protos.h>
|
2012-04-11 09:47:57 +00:00
|
|
|
#include <class_board.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <class_pad.h>
|
|
|
|
#include <class_edge_mod.h>
|
|
|
|
#include <class_module.h>
|
2009-08-01 19:26:05 +00:00
|
|
|
|
|
|
|
|
2012-04-11 09:47:57 +00:00
|
|
|
|
|
|
|
/* Returns the layer number after flipping an item
|
|
|
|
* some layers: external copper, Mask, Paste, and solder
|
|
|
|
* are swapped between front and back sides
|
2009-08-01 19:26:05 +00:00
|
|
|
*/
|
2013-03-31 13:27:46 +00:00
|
|
|
LAYER_NUM BOARD::ReturnFlippedLayerNumber( LAYER_NUM oldlayer )
|
2009-08-01 19:26:05 +00:00
|
|
|
{
|
2013-03-31 13:27:46 +00:00
|
|
|
LAYER_NUM newlayer;
|
2009-08-01 19:26:05 +00:00
|
|
|
|
|
|
|
switch( oldlayer )
|
|
|
|
{
|
2009-12-07 03:46:13 +00:00
|
|
|
case LAYER_N_BACK:
|
|
|
|
newlayer = LAYER_N_FRONT;
|
2009-11-12 15:43:38 +00:00
|
|
|
break;
|
2009-08-01 19:26:05 +00:00
|
|
|
|
2009-12-07 03:46:13 +00:00
|
|
|
case LAYER_N_FRONT:
|
|
|
|
newlayer = LAYER_N_BACK;
|
2009-11-12 15:43:38 +00:00
|
|
|
break;
|
2009-08-01 19:26:05 +00:00
|
|
|
|
2009-12-21 17:56:25 +00:00
|
|
|
case SILKSCREEN_N_BACK:
|
|
|
|
newlayer = SILKSCREEN_N_FRONT;
|
2009-11-12 15:43:38 +00:00
|
|
|
break;
|
2009-08-01 19:26:05 +00:00
|
|
|
|
2009-12-21 17:56:25 +00:00
|
|
|
case SILKSCREEN_N_FRONT:
|
|
|
|
newlayer = SILKSCREEN_N_BACK;
|
2009-11-12 15:43:38 +00:00
|
|
|
break;
|
2009-08-01 19:26:05 +00:00
|
|
|
|
2009-12-21 17:56:25 +00:00
|
|
|
case ADHESIVE_N_BACK:
|
|
|
|
newlayer = ADHESIVE_N_FRONT;
|
2009-11-12 15:43:38 +00:00
|
|
|
break;
|
2009-08-01 19:26:05 +00:00
|
|
|
|
2009-12-21 17:56:25 +00:00
|
|
|
case ADHESIVE_N_FRONT:
|
|
|
|
newlayer = ADHESIVE_N_BACK;
|
2009-11-12 15:43:38 +00:00
|
|
|
break;
|
2009-08-01 19:26:05 +00:00
|
|
|
|
2009-12-21 17:56:25 +00:00
|
|
|
case SOLDERMASK_N_BACK:
|
|
|
|
newlayer = SOLDERMASK_N_FRONT;
|
2009-11-12 15:43:38 +00:00
|
|
|
break;
|
2009-08-01 19:26:05 +00:00
|
|
|
|
2009-12-21 17:56:25 +00:00
|
|
|
case SOLDERMASK_N_FRONT:
|
|
|
|
newlayer = SOLDERMASK_N_BACK;
|
2009-11-12 15:43:38 +00:00
|
|
|
break;
|
2009-08-01 19:26:05 +00:00
|
|
|
|
2009-12-21 17:56:25 +00:00
|
|
|
case SOLDERPASTE_N_BACK:
|
|
|
|
newlayer = SOLDERPASTE_N_FRONT;
|
2009-11-12 15:43:38 +00:00
|
|
|
break;
|
2009-08-01 19:26:05 +00:00
|
|
|
|
2009-12-21 17:56:25 +00:00
|
|
|
case SOLDERPASTE_N_FRONT:
|
|
|
|
newlayer = SOLDERPASTE_N_BACK;
|
2009-11-12 15:43:38 +00:00
|
|
|
break;
|
2009-08-01 19:26:05 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
newlayer = oldlayer;
|
|
|
|
}
|
|
|
|
|
|
|
|
return newlayer;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-09-11 16:33:43 +00:00
|
|
|
/* Calculate the mask layer when flipping a footprint
|
|
|
|
* BACK and FRONT copper layers , mask, paste, solder layers are swapped
|
2009-08-01 19:26:05 +00:00
|
|
|
*/
|
2013-03-30 17:24:04 +00:00
|
|
|
LAYER_MSK ChangeSideMaskLayer( LAYER_MSK aMask )
|
2009-08-01 19:26:05 +00:00
|
|
|
{
|
2013-03-30 17:24:04 +00:00
|
|
|
LAYER_MSK newMask;
|
2009-08-01 19:26:05 +00:00
|
|
|
|
2011-09-07 19:41:04 +00:00
|
|
|
newMask = aMask & ~(LAYER_BACK | LAYER_FRONT |
|
2009-12-21 18:51:37 +00:00
|
|
|
SILKSCREEN_LAYER_BACK | SILKSCREEN_LAYER_FRONT |
|
|
|
|
ADHESIVE_LAYER_BACK | ADHESIVE_LAYER_FRONT |
|
|
|
|
SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT |
|
|
|
|
SOLDERPASTE_LAYER_BACK | SOLDERPASTE_LAYER_FRONT |
|
|
|
|
ADHESIVE_LAYER_BACK | ADHESIVE_LAYER_FRONT);
|
2009-08-01 19:26:05 +00:00
|
|
|
|
2011-09-07 19:41:04 +00:00
|
|
|
if( aMask & LAYER_BACK )
|
|
|
|
newMask |= LAYER_FRONT;
|
|
|
|
|
|
|
|
if( aMask & LAYER_FRONT )
|
|
|
|
newMask |= LAYER_BACK;
|
|
|
|
|
|
|
|
if( aMask & SILKSCREEN_LAYER_BACK )
|
|
|
|
newMask |= SILKSCREEN_LAYER_FRONT;
|
|
|
|
|
|
|
|
if( aMask & SILKSCREEN_LAYER_FRONT )
|
|
|
|
newMask |= SILKSCREEN_LAYER_BACK;
|
|
|
|
|
|
|
|
if( aMask & ADHESIVE_LAYER_BACK )
|
|
|
|
newMask |= ADHESIVE_LAYER_FRONT;
|
|
|
|
|
|
|
|
if( aMask & ADHESIVE_LAYER_FRONT )
|
|
|
|
newMask |= ADHESIVE_LAYER_BACK;
|
|
|
|
|
|
|
|
if( aMask & SOLDERMASK_LAYER_BACK )
|
|
|
|
newMask |= SOLDERMASK_LAYER_FRONT;
|
|
|
|
|
|
|
|
if( aMask & SOLDERMASK_LAYER_FRONT )
|
|
|
|
newMask |= SOLDERMASK_LAYER_BACK;
|
|
|
|
|
|
|
|
if( aMask & SOLDERPASTE_LAYER_BACK )
|
|
|
|
newMask |= SOLDERPASTE_LAYER_FRONT;
|
|
|
|
|
|
|
|
if( aMask & SOLDERPASTE_LAYER_FRONT )
|
|
|
|
newMask |= SOLDERPASTE_LAYER_BACK;
|
|
|
|
|
|
|
|
if( aMask & ADHESIVE_LAYER_BACK )
|
|
|
|
newMask |= ADHESIVE_LAYER_FRONT;
|
|
|
|
|
|
|
|
if( aMask & ADHESIVE_LAYER_FRONT )
|
|
|
|
newMask |= ADHESIVE_LAYER_BACK;
|
|
|
|
|
|
|
|
return newMask;
|
2009-08-01 19:26:05 +00:00
|
|
|
}
|