2011-09-23 13:57:12 +00:00
|
|
|
/**
|
|
|
|
* @file class_board.h
|
|
|
|
* @brief Class BOARD to handle a board.
|
|
|
|
*/
|
2007-12-09 12:59:06 +00:00
|
|
|
|
|
|
|
#ifndef CLASS_BOARD_H
|
|
|
|
#define CLASS_BOARD_H
|
|
|
|
|
2011-09-23 13:57:12 +00:00
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
#include "dlist.h"
|
2011-09-23 13:57:12 +00:00
|
|
|
|
|
|
|
#include "layers_id_colors_and_visibility.h"
|
2009-05-25 11:53:55 +00:00
|
|
|
#include "class_netinfo.h"
|
2011-09-15 17:58:35 +00:00
|
|
|
#include "class_pad.h"
|
2010-01-31 20:01:46 +00:00
|
|
|
#include "class_colors_design_settings.h"
|
|
|
|
#include "class_board_design_settings.h"
|
2008-12-04 04:28:11 +00:00
|
|
|
|
|
|
|
|
2011-09-23 13:57:12 +00:00
|
|
|
class PCB_BASE_FRAME;
|
|
|
|
class PCB_EDIT_FRAME;
|
|
|
|
class PICKED_ITEMS_LIST;
|
2011-09-20 13:57:40 +00:00
|
|
|
class BOARD;
|
2007-12-09 12:59:06 +00:00
|
|
|
class ZONE_CONTAINER;
|
2011-09-20 13:57:40 +00:00
|
|
|
class SEGZONE;
|
|
|
|
class TRACK;
|
2011-09-23 13:57:12 +00:00
|
|
|
class D_PAD;
|
|
|
|
class MARKER_PCB;
|
2007-12-09 12:59:06 +00:00
|
|
|
|
2008-03-01 13:15:41 +00:00
|
|
|
|
2011-09-16 15:54:50 +00:00
|
|
|
// buffer of item candidates when search for items on the same track.
|
|
|
|
typedef std::vector< TRACK* > TRACK_PTRS;
|
|
|
|
|
|
|
|
|
2011-09-14 20:04:58 +00:00
|
|
|
#define HISTORY_MAX_COUNT 8
|
|
|
|
|
|
|
|
|
2008-03-01 13:15:41 +00:00
|
|
|
/**
|
|
|
|
* Enum LAYER_T
|
|
|
|
* gives the allowed types of layers, same as Specctra DSN spec.
|
|
|
|
*/
|
2009-06-11 14:26:17 +00:00
|
|
|
enum LAYER_T {
|
2008-03-01 13:15:41 +00:00
|
|
|
LT_SIGNAL,
|
|
|
|
LT_POWER,
|
|
|
|
LT_MIXED,
|
2009-07-18 11:44:19 +00:00
|
|
|
LT_JUMPER
|
2008-03-01 13:15:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-04 04:22:27 +00:00
|
|
|
/**
|
|
|
|
* Struct LAYER
|
|
|
|
* holds information pertinent to a layer of a BOARD.
|
|
|
|
*/
|
|
|
|
struct LAYER
|
|
|
|
{
|
|
|
|
/** The name of the layer, there should be no spaces in this name. */
|
2009-06-11 14:26:17 +00:00
|
|
|
wxString m_Name;
|
2008-03-04 04:22:27 +00:00
|
|
|
|
|
|
|
/** The type of the layer */
|
2009-06-11 14:26:17 +00:00
|
|
|
LAYER_T m_Type;
|
2008-03-04 04:22:27 +00:00
|
|
|
|
|
|
|
// int m_Color;
|
|
|
|
// bool m_Visible; // ? use flags in m_Color instead ?
|
2007-12-09 12:59:06 +00:00
|
|
|
|
2008-03-04 04:22:27 +00:00
|
|
|
/**
|
|
|
|
* Function ShowType
|
|
|
|
* converts a LAYER_T enum to a const char*
|
|
|
|
* @param aType The LAYER_T to convert
|
|
|
|
* @return const char* - The string representation of the layer type.
|
|
|
|
*/
|
|
|
|
static const char* ShowType( LAYER_T aType );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function ParseType
|
|
|
|
* converts a string to a LAYER_T
|
|
|
|
* @param aType The const char* to convert
|
|
|
|
* @return LAYER_T - The binary representation of the layer type, or
|
|
|
|
* LAYER_T(-1) if the string is invalid
|
|
|
|
*/
|
2009-06-11 14:26:17 +00:00
|
|
|
static LAYER_T ParseType( const char* aType );
|
2008-03-04 04:22:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-10-30 17:58:15 +00:00
|
|
|
/** a small helper class to handle a stock of specific vias diameter and drill pair
|
|
|
|
* in the BOARD class
|
2010-01-31 20:01:46 +00:00
|
|
|
*/
|
2009-10-30 17:58:15 +00:00
|
|
|
class VIA_DIMENSION
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
int m_Diameter; // <= 0 means use Netclass via diameter
|
|
|
|
int m_Drill; // <= 0 means use Netclass via drill
|
|
|
|
|
|
|
|
VIA_DIMENSION()
|
|
|
|
{
|
|
|
|
m_Diameter = 0; m_Drill = 0;
|
|
|
|
}
|
|
|
|
|
2010-01-31 20:01:46 +00:00
|
|
|
|
|
|
|
bool operator ==( const VIA_DIMENSION& other ) const
|
2009-10-30 17:58:15 +00:00
|
|
|
{
|
2011-09-14 20:04:58 +00:00
|
|
|
return (m_Diameter == other.m_Diameter) && (m_Drill == other.m_Drill);
|
2009-10-30 17:58:15 +00:00
|
|
|
}
|
2010-01-31 20:01:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
bool operator <( const VIA_DIMENSION& other ) const
|
2009-10-30 17:58:15 +00:00
|
|
|
{
|
2010-01-31 20:01:46 +00:00
|
|
|
if( m_Diameter != other.m_Diameter )
|
|
|
|
return m_Diameter < other.m_Diameter;
|
2011-09-14 20:04:58 +00:00
|
|
|
|
2009-10-30 17:58:15 +00:00
|
|
|
return m_Drill < other.m_Drill;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2011-09-14 20:04:58 +00:00
|
|
|
|
|
|
|
// Helper class to handle high light nets
|
|
|
|
class HIGH_LIGHT_INFO
|
2011-04-05 17:49:14 +00:00
|
|
|
{
|
|
|
|
friend class BOARD;
|
|
|
|
protected:
|
2011-09-14 20:04:58 +00:00
|
|
|
int m_netCode; // net selected for highlight (-1 when no net selected )
|
|
|
|
bool m_highLightOn; // highlight active
|
2011-04-05 17:49:14 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void Clear()
|
|
|
|
{
|
|
|
|
m_netCode = -1;
|
2011-09-14 20:04:58 +00:00
|
|
|
m_highLightOn = false;
|
2011-04-05 17:49:14 +00:00
|
|
|
}
|
|
|
|
|
2011-09-14 20:04:58 +00:00
|
|
|
HIGH_LIGHT_INFO()
|
2011-04-05 17:49:14 +00:00
|
|
|
{
|
|
|
|
Clear();
|
|
|
|
}
|
|
|
|
};
|
2010-01-21 07:41:30 +00:00
|
|
|
|
2011-09-14 20:04:58 +00:00
|
|
|
|
2008-03-04 04:22:27 +00:00
|
|
|
/**
|
|
|
|
* Class BOARD
|
2011-09-30 18:15:37 +00:00
|
|
|
* holds information pertinent to a Pcbnew printed circuit board.
|
2008-03-04 04:22:27 +00:00
|
|
|
*/
|
2007-12-09 12:59:06 +00:00
|
|
|
class BOARD : public BOARD_ITEM
|
|
|
|
{
|
2011-03-01 19:26:17 +00:00
|
|
|
friend class PCB_EDIT_FRAME;
|
2008-02-12 01:02:53 +00:00
|
|
|
|
2007-12-09 12:59:06 +00:00
|
|
|
private:
|
2011-09-14 20:04:58 +00:00
|
|
|
// @todo: switch to boost:ptr_vector, and change ~BOARD()
|
|
|
|
typedef std::vector<MARKER_PCB*> MARKERS;
|
2008-02-12 01:02:53 +00:00
|
|
|
|
2011-09-14 20:04:58 +00:00
|
|
|
/// MARKER_PCBs for clearance problems, owned by pointer.
|
|
|
|
MARKERS m_markers;
|
|
|
|
|
|
|
|
// @todo: switch to boost::ptr_vector, and change ~BOARD()
|
|
|
|
typedef std::vector<ZONE_CONTAINER*> ZONE_CONTAINERS;
|
|
|
|
|
|
|
|
/// edge zone descriptors, owned by pointer.
|
|
|
|
ZONE_CONTAINERS m_ZoneDescriptorList;
|
2008-01-06 12:43:57 +00:00
|
|
|
|
2011-09-14 15:08:44 +00:00
|
|
|
LAYER m_Layer[NB_COPPER_LAYERS];
|
2011-09-14 20:04:58 +00:00
|
|
|
// if true m_hightLight_NetCode is used
|
|
|
|
HIGH_LIGHT_INFO m_hightLight; // current high light data
|
|
|
|
HIGH_LIGHT_INFO m_hightLightPrevious; // a previously stored high light data
|
2008-03-04 04:22:27 +00:00
|
|
|
|
2007-12-09 12:59:06 +00:00
|
|
|
public:
|
2011-09-14 20:04:58 +00:00
|
|
|
PCB_BASE_FRAME* m_PcbFrame; // Window of visualization
|
|
|
|
EDA_RECT m_BoundaryBox; // Board size and position
|
|
|
|
|
|
|
|
/// Flags used in ratsnest calculation and update.
|
|
|
|
int m_Status_Pcb;
|
|
|
|
|
|
|
|
/// Active pads (pads attached to a net ) count.
|
|
|
|
int m_NbNodes;
|
2008-12-04 04:28:11 +00:00
|
|
|
|
2011-09-14 20:04:58 +00:00
|
|
|
/// Active ratsnest count (ratsnests not already connected by tracks)
|
|
|
|
int m_NbNoconnect;
|
2008-12-04 04:28:11 +00:00
|
|
|
|
2011-09-14 20:04:58 +00:00
|
|
|
DLIST<BOARD_ITEM> m_Drawings; // linked list of lines & texts
|
|
|
|
DLIST<MODULE> m_Modules; // linked list of MODULEs
|
|
|
|
DLIST<TRACK> m_Track; // linked list of TRACKs and SEGVIAs
|
|
|
|
DLIST<SEGZONE> m_Zone; // linked list of SEGZONEs
|
2008-12-04 04:28:11 +00:00
|
|
|
|
2011-09-14 20:04:58 +00:00
|
|
|
/// nets info list (name, design constraints ..
|
|
|
|
NETINFO_LIST* m_NetInfo;
|
2007-12-09 12:59:06 +00:00
|
|
|
|
2011-09-14 20:04:58 +00:00
|
|
|
/// Ratsnest list for the BOARD
|
|
|
|
std::vector<RATSNEST_ITEM> m_FullRatsnest;
|
2009-10-03 17:18:08 +00:00
|
|
|
|
2011-09-14 20:04:58 +00:00
|
|
|
/// Ratsnest list relative to a given footprint (used while moving a footprint).
|
|
|
|
std::vector<RATSNEST_ITEM> m_LocalRatsnest;
|
2009-08-10 02:22:56 +00:00
|
|
|
|
2011-09-14 20:04:58 +00:00
|
|
|
/// zone contour currently in progress
|
|
|
|
ZONE_CONTAINER* m_CurrentZoneContour;
|
|
|
|
|
|
|
|
/// List of current netclasses. There is always the default netclass.
|
|
|
|
NETCLASSES m_NetClasses;
|
|
|
|
|
|
|
|
/// Current net class name used to display netclass info.
|
|
|
|
/// This is also the last used netclass after starting a track.
|
|
|
|
wxString m_CurrentNetClassName;
|
2009-10-03 17:18:08 +00:00
|
|
|
|
2009-10-01 16:46:13 +00:00
|
|
|
// handling of vias and tracks size:
|
|
|
|
// the first value is always the value of the current NetClass
|
|
|
|
// The others values are extra values
|
2011-09-14 20:04:58 +00:00
|
|
|
|
|
|
|
/// Vias size and drill list(max count = HISTORY_MAX_COUNT)
|
|
|
|
std::vector <VIA_DIMENSION> m_ViasDimensionsList;
|
|
|
|
|
2010-01-31 20:01:46 +00:00
|
|
|
// The first value is the current netclass via size
|
2011-09-14 20:04:58 +00:00
|
|
|
// tracks widths (max count = HISTORY_MAX_COUNT)
|
|
|
|
// The first value is the current netclass track width
|
|
|
|
std::vector <int> m_TrackWidthList;
|
|
|
|
|
|
|
|
/// Index for m_ViaSizeList to select the value.
|
|
|
|
/// 0 is the index selection of the default value Netclass
|
|
|
|
unsigned m_ViaSizeSelector;
|
|
|
|
|
|
|
|
// Index for m_TrackWidthList to select the value.
|
|
|
|
unsigned m_TrackWidthSelector;
|
2010-01-31 20:01:46 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
BOARD_DESIGN_SETTINGS* m_boardDesignSettings; // Link to current design settings
|
|
|
|
COLORS_DESIGN_SETTINGS* m_colorsSettings; // Link to current colors settings
|
2007-12-09 12:59:06 +00:00
|
|
|
|
2011-09-16 15:54:50 +00:00
|
|
|
/**
|
|
|
|
* Function chainMarkedSegments
|
|
|
|
* is used by MarkTrace() to set the BUSY flag of connected segments of the trace
|
|
|
|
* segment located at \a aPosition on aLayerMask.
|
|
|
|
* Vias are put in list but their flags BUSY is not set
|
|
|
|
* @param aPosition A wxPoint object containing the position of the starting search.
|
|
|
|
* @param aLayerMask The allowed layers for segments to search.
|
|
|
|
* @param aList The track list to fill with points of flagged segments.
|
|
|
|
*/
|
|
|
|
void chainMarkedSegments( wxPoint aPosition, int aLayerMask, TRACK_PTRS* aList );
|
|
|
|
|
2009-09-28 16:14:45 +00:00
|
|
|
public:
|
2011-09-14 15:08:44 +00:00
|
|
|
BOARD( EDA_ITEM* aParent, PCB_BASE_FRAME* frame );
|
2007-12-09 12:59:06 +00:00
|
|
|
~BOARD();
|
|
|
|
|
2009-12-07 03:46:13 +00:00
|
|
|
/**
|
|
|
|
* Function GetDefaultLayerName
|
|
|
|
* returns a default name of a PCB layer when given \a aLayerNumber. This
|
|
|
|
* function is static so it can be called without a BOARD instance. Use
|
|
|
|
* GetLayerName() if want the layer names of a specific BOARD, which could
|
|
|
|
* be different than the default if the user has renamed any copper layers.
|
|
|
|
*
|
|
|
|
* @param aLayerNumber is the layer number to fetch
|
|
|
|
* @return wxString - containing the layer name or "BAD INDEX" if aLayerNumber
|
|
|
|
* is not legal
|
|
|
|
*/
|
|
|
|
static wxString GetDefaultLayerName( int aLayerNumber );
|
|
|
|
|
2007-12-09 12:59:06 +00:00
|
|
|
/**
|
|
|
|
* Function GetPosition
|
|
|
|
* is here to satisfy BOARD_ITEM's requirements, but this implementation
|
|
|
|
* is a dummy.
|
|
|
|
* @return const wxPoint& of (0,0)
|
|
|
|
*/
|
|
|
|
wxPoint& GetPosition();
|
2008-02-12 01:02:53 +00:00
|
|
|
|
2007-12-09 12:59:06 +00:00
|
|
|
/**
|
|
|
|
* Function Add
|
|
|
|
* adds the given item to this BOARD and takes ownership of its memory.
|
|
|
|
* @param aBoardItem The item to add to this board.
|
2008-02-12 01:02:53 +00:00
|
|
|
* @param aControl An int which can vary how the item is added.
|
2007-12-09 12:59:06 +00:00
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
void Add( BOARD_ITEM* aBoardItem, int aControl = 0 );
|
2009-06-11 14:26:17 +00:00
|
|
|
|
|
|
|
#define ADD_APPEND 1 ///< aControl flag for Add( aControl ), appends not inserts
|
2008-02-12 01:02:53 +00:00
|
|
|
|
2007-12-09 12:59:06 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function Delete
|
2008-12-06 21:20:50 +00:00
|
|
|
* removes the given single item from this BOARD and deletes its memory.
|
2007-12-09 12:59:06 +00:00
|
|
|
* @param aBoardItem The item to remove from this board and delete
|
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
void Delete( BOARD_ITEM* aBoardItem )
|
2008-12-06 21:20:50 +00:00
|
|
|
{
|
2011-09-14 20:04:58 +00:00
|
|
|
// developers should run DEBUG versions and fix such calls with NULL
|
|
|
|
wxASSERT( aBoardItem );
|
|
|
|
|
2008-12-06 21:20:50 +00:00
|
|
|
if( aBoardItem )
|
|
|
|
delete Remove( aBoardItem );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function Remove
|
2011-09-14 20:04:58 +00:00
|
|
|
* removes \a aBoardItem from this BOARD and returns it to caller without deleting it.
|
2008-12-06 21:20:50 +00:00
|
|
|
* @param aBoardItem The item to remove from this board.
|
|
|
|
* @return BOARD_ITEM* \a aBoardItem which was passed in.
|
|
|
|
*/
|
|
|
|
BOARD_ITEM* Remove( BOARD_ITEM* aBoardItem );
|
|
|
|
|
2007-12-09 12:59:06 +00:00
|
|
|
/**
|
|
|
|
* Function DeleteMARKERs
|
|
|
|
* deletes ALL MARKERS from the board.
|
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
void DeleteMARKERs();
|
2007-12-09 12:59:06 +00:00
|
|
|
|
2007-12-29 19:15:58 +00:00
|
|
|
/**
|
|
|
|
* Function DeleteZONEOutlines
|
|
|
|
* deletes ALL zone outlines from the board.
|
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
void DeleteZONEOutlines();
|
2011-09-14 15:08:44 +00:00
|
|
|
|
2007-12-29 19:15:58 +00:00
|
|
|
|
2007-12-09 12:59:06 +00:00
|
|
|
/**
|
|
|
|
* Function GetMARKER
|
|
|
|
* returns the MARKER at a given index.
|
2009-08-01 19:26:05 +00:00
|
|
|
* @param index The array type index into a collection of MARKER_PCBS.
|
|
|
|
* @return MARKER_PCB* - a pointer to the MARKER_PCB or NULL if index out of range.
|
2007-12-09 12:59:06 +00:00
|
|
|
*/
|
2009-08-01 19:26:05 +00:00
|
|
|
MARKER_PCB* GetMARKER( int index ) const
|
2007-12-09 12:59:06 +00:00
|
|
|
{
|
|
|
|
if( (unsigned) index < m_markers.size() )
|
|
|
|
return m_markers[index];
|
2011-09-14 20:04:58 +00:00
|
|
|
|
2007-12-09 12:59:06 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2009-06-11 14:26:17 +00:00
|
|
|
|
2007-12-09 12:59:06 +00:00
|
|
|
/**
|
|
|
|
* Function GetMARKERCount
|
2009-08-01 19:26:05 +00:00
|
|
|
* @return int - The number of MARKER_PCBS.
|
2007-12-09 12:59:06 +00:00
|
|
|
*/
|
|
|
|
int GetMARKERCount() const
|
|
|
|
{
|
|
|
|
return (int) m_markers.size();
|
|
|
|
}
|
|
|
|
|
2009-06-11 14:26:17 +00:00
|
|
|
|
2011-04-05 17:49:14 +00:00
|
|
|
/**
|
2011-09-14 20:04:58 +00:00
|
|
|
* Function ResetHighLight
|
|
|
|
* Reset all high light data to the init state
|
2011-04-05 17:49:14 +00:00
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
void ResetHighLight()
|
2011-04-05 17:49:14 +00:00
|
|
|
{
|
|
|
|
m_hightLight.Clear();
|
|
|
|
m_hightLightPrevious.Clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2011-09-14 20:04:58 +00:00
|
|
|
* Function GetHighLightNetCode
|
|
|
|
* @return netcode of net to highlight (-1 when no net selected)
|
2011-04-05 17:49:14 +00:00
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
int GetHighLightNetCode() { return m_hightLight.m_netCode; }
|
2011-04-05 17:49:14 +00:00
|
|
|
|
|
|
|
/**
|
2011-09-14 20:04:58 +00:00
|
|
|
* Function SetHighLightNet
|
|
|
|
* @param aNetCode = netcode of net to highlight
|
2011-04-05 17:49:14 +00:00
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
void SetHighLightNet( int aNetCode)
|
2011-04-05 17:49:14 +00:00
|
|
|
{
|
|
|
|
m_hightLight.m_netCode = aNetCode;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2011-09-14 20:04:58 +00:00
|
|
|
* Function IsHighLightNetON
|
|
|
|
* @return true if a net is currently highlighted
|
2011-04-05 17:49:14 +00:00
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
bool IsHighLightNetON() { return m_hightLight.m_highLightOn; }
|
2011-04-05 17:49:14 +00:00
|
|
|
|
|
|
|
/**
|
2011-09-14 20:04:58 +00:00
|
|
|
* Function HighLightOFF
|
|
|
|
* Disable highlight.
|
2011-04-05 17:49:14 +00:00
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
void HighLightOFF() { m_hightLight.m_highLightOn = false; }
|
2011-04-05 17:49:14 +00:00
|
|
|
|
|
|
|
/**
|
2011-09-14 20:04:58 +00:00
|
|
|
* Function HighLightON
|
|
|
|
* Enable highlight.
|
|
|
|
* if m_hightLight_NetCode >= 0, this net will be highlighted
|
2011-04-05 17:49:14 +00:00
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
void HighLightON() { m_hightLight.m_highLightOn = true; }
|
2011-04-05 17:49:14 +00:00
|
|
|
|
|
|
|
/**
|
2011-09-14 20:04:58 +00:00
|
|
|
* Function PushHighLight
|
|
|
|
* save current high light info for later use
|
2011-04-05 17:49:14 +00:00
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
void PushHighLight();
|
2011-04-05 17:49:14 +00:00
|
|
|
|
|
|
|
/**
|
2011-09-14 20:04:58 +00:00
|
|
|
* Function PopHighLight
|
|
|
|
* retrieve a previously saved high light info
|
2011-04-05 17:49:14 +00:00
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
void PopHighLight();
|
2011-04-05 17:49:14 +00:00
|
|
|
|
2008-01-23 01:50:16 +00:00
|
|
|
/**
|
|
|
|
* Function GetCopperLayerCount
|
|
|
|
* @return int - The number of copper layers in the BOARD.
|
|
|
|
*/
|
2011-09-14 15:08:44 +00:00
|
|
|
int GetCopperLayerCount() const;
|
2010-01-21 07:41:30 +00:00
|
|
|
|
|
|
|
void SetCopperLayerCount( int aCount );
|
|
|
|
|
2009-10-18 23:22:26 +00:00
|
|
|
/**
|
|
|
|
* Function GetEnabledLayers
|
|
|
|
* is a proxy function that calls the correspondent function in m_BoardSettings
|
|
|
|
* Returns a bit-mask of all the layers that are enabled
|
|
|
|
* @return int - the enabled layers in bit-mapped form.
|
|
|
|
*/
|
2011-09-14 15:08:44 +00:00
|
|
|
int GetEnabledLayers() const;
|
2009-10-18 23:22:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetEnabledLayers
|
|
|
|
* is a proxy function that calls the correspondent function in m_BoardSettings
|
|
|
|
* Changes the bit-mask of enabled layers
|
2010-12-29 17:47:32 +00:00
|
|
|
* @param aLayerMask = The new bit-mask of enabled layers
|
2009-10-18 23:22:26 +00:00
|
|
|
*/
|
|
|
|
void SetEnabledLayers( int aLayerMask );
|
|
|
|
|
2010-01-31 20:01:46 +00:00
|
|
|
/**
|
|
|
|
* Function IsLayerEnabled
|
|
|
|
* is a proxy function that calls the correspondent function in m_BoardSettings
|
|
|
|
* tests whether a given layer is enabled
|
2010-12-29 17:47:32 +00:00
|
|
|
* @param aLayer = The layer to be tested
|
2010-01-31 20:01:46 +00:00
|
|
|
* @return bool - true if the layer is visible.
|
|
|
|
*/
|
|
|
|
bool IsLayerEnabled( int aLayer ) const
|
|
|
|
{
|
|
|
|
return GetBoardDesignSettings()->IsLayerEnabled( aLayer );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function IsLayerVisible
|
|
|
|
* is a proxy function that calls the correspondent function in m_BoardSettings
|
|
|
|
* tests whether a given layer is visible
|
|
|
|
* @param aLayerIndex = The index of the layer to be tested
|
|
|
|
* @return bool - true if the layer is visible.
|
|
|
|
*/
|
|
|
|
bool IsLayerVisible( int aLayerIndex ) const
|
|
|
|
{
|
|
|
|
return GetBoardDesignSettings()->IsLayerVisible( aLayerIndex );
|
|
|
|
}
|
|
|
|
|
2009-10-18 23:22:26 +00:00
|
|
|
/**
|
2010-01-21 07:41:30 +00:00
|
|
|
* Function GetVisibleLayers
|
2009-10-18 23:22:26 +00:00
|
|
|
* is a proxy function that calls the correspondent function in m_BoardSettings
|
2010-01-21 07:41:30 +00:00
|
|
|
* Returns a bit-mask of all the layers that are visible
|
|
|
|
* @return int - the visible layers in bit-mapped form.
|
2009-10-18 23:22:26 +00:00
|
|
|
*/
|
2011-09-14 15:08:44 +00:00
|
|
|
int GetVisibleLayers() const;
|
2009-10-18 23:22:26 +00:00
|
|
|
|
|
|
|
/**
|
2010-01-21 07:41:30 +00:00
|
|
|
* Function SetVisibleLayers
|
2009-10-18 23:22:26 +00:00
|
|
|
* is a proxy function that calls the correspondent function in m_BoardSettings
|
2010-01-21 07:41:30 +00:00
|
|
|
* changes the bit-mask of visible layers
|
2010-12-29 17:47:32 +00:00
|
|
|
* @param aLayerMask = The new bit-mask of visible layers
|
2009-10-18 23:22:26 +00:00
|
|
|
*/
|
2010-01-21 07:41:30 +00:00
|
|
|
void SetVisibleLayers( int aLayerMask );
|
2009-10-18 23:22:26 +00:00
|
|
|
|
2010-01-25 06:45:34 +00:00
|
|
|
// these 2 functions are not tidy at this time, since there are PCB_VISIBLEs that
|
|
|
|
// are not stored in the bitmap.
|
|
|
|
|
2009-10-18 23:22:26 +00:00
|
|
|
/**
|
|
|
|
* Function GetVisibleElements
|
|
|
|
* is a proxy function that calls the correspondent function in m_BoardSettings
|
|
|
|
* returns a bit-mask of all the element categories that are visible
|
2010-01-21 20:53:01 +00:00
|
|
|
* @return int - the visible element bitmap or-ed from enum PCB_VISIBLE
|
|
|
|
* @see enum PCB_VISIBLE
|
2009-10-18 23:22:26 +00:00
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
int GetVisibleElements() const;
|
2009-10-18 23:22:26 +00:00
|
|
|
|
2010-01-21 07:41:30 +00:00
|
|
|
/**
|
|
|
|
* Function SetVisibleElements
|
|
|
|
* is a proxy function that calls the correspondent function in m_BoardSettings
|
|
|
|
* changes the bit-mask of visible element categories
|
2010-01-21 20:53:01 +00:00
|
|
|
* @param aMask = The new bit-mask of visible element bitmap or-ed from enum PCB_VISIBLE
|
|
|
|
* @see enum PCB_VISIBLE
|
2010-01-21 07:41:30 +00:00
|
|
|
*/
|
|
|
|
void SetVisibleElements( int aMask );
|
2009-10-18 23:22:26 +00:00
|
|
|
|
2010-01-30 14:46:26 +00:00
|
|
|
/**
|
|
|
|
* Function SetVisibleAlls
|
|
|
|
* changes the bit-mask of visible element categories and layers
|
|
|
|
* @see enum PCB_VISIBLE
|
|
|
|
*/
|
2010-01-31 20:01:46 +00:00
|
|
|
void SetVisibleAlls();
|
2010-01-30 14:46:26 +00:00
|
|
|
|
2010-01-25 06:45:34 +00:00
|
|
|
/**
|
|
|
|
* Function IsElementVisible
|
|
|
|
* tests whether a given element category is visible. Keep this as an
|
|
|
|
* inline function.
|
|
|
|
* @param aPCB_VISIBLE is from the enum by the same name
|
|
|
|
* @return bool - true if the element is visible.
|
|
|
|
* @see enum PCB_VISIBLE
|
|
|
|
*/
|
|
|
|
bool IsElementVisible( int aPCB_VISIBLE ) const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function SetElementVisibility
|
|
|
|
* changes the visibility of an element category
|
|
|
|
* @param aPCB_VISIBLE is from the enum by the same name
|
|
|
|
* @param aNewState = The new visibility state of the element category
|
|
|
|
* @see enum PCB_VISIBLE
|
|
|
|
*/
|
|
|
|
void SetElementVisibility( int aPCB_VISIBLE, bool aNewState );
|
|
|
|
|
2010-01-31 20:01:46 +00:00
|
|
|
/**
|
|
|
|
* Function IsModuleLayerVisible
|
|
|
|
* expects either of the two layers on which a module can reside, and returns
|
|
|
|
* whether that layer is visible.
|
|
|
|
* @param layer One of the two allowed layers for modules: LAYER_N_FRONT or LAYER_N_BACK
|
|
|
|
* @return bool - true if the layer is visible, else false.
|
|
|
|
*/
|
|
|
|
bool IsModuleLayerVisible( int layer );
|
|
|
|
|
2010-01-21 20:53:01 +00:00
|
|
|
/**
|
|
|
|
* Function GetVisibleElementColor
|
|
|
|
* returns the color of a pcb visible element.
|
|
|
|
* @see enum PCB_VISIBLE
|
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
int GetVisibleElementColor( int aPCB_VISIBLE );
|
2010-01-21 20:53:01 +00:00
|
|
|
|
2011-09-14 20:04:58 +00:00
|
|
|
void SetVisibleElementColor( int aPCB_VISIBLE, int aColor );
|
2011-09-14 15:08:44 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function GetBoardDesignSettings
|
2010-01-31 20:01:46 +00:00
|
|
|
* @return the current BOARD_DESIGN_SETTINGS in use
|
|
|
|
*/
|
|
|
|
BOARD_DESIGN_SETTINGS* GetBoardDesignSettings() const
|
|
|
|
{
|
|
|
|
return m_boardDesignSettings;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function SetBoardDesignSettings
|
2010-01-31 20:01:46 +00:00
|
|
|
* @param aDesignSettings = the new BOARD_DESIGN_SETTINGS to use
|
|
|
|
*/
|
|
|
|
void SetBoardDesignSettings( BOARD_DESIGN_SETTINGS* aDesignSettings)
|
|
|
|
{
|
|
|
|
m_boardDesignSettings = aDesignSettings;
|
|
|
|
}
|
|
|
|
|
2011-09-14 20:04:58 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function SetBoardSettings
|
2010-01-31 20:01:46 +00:00
|
|
|
* @return the current COLORS_DESIGN_SETTINGS in use
|
|
|
|
*/
|
|
|
|
COLORS_DESIGN_SETTINGS* GetColorsSettings() const
|
|
|
|
{
|
|
|
|
return m_colorsSettings;
|
|
|
|
}
|
|
|
|
|
2011-09-14 20:04:58 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function SetColorsSettings
|
2010-01-31 20:01:46 +00:00
|
|
|
* @param aColorsSettings = the new COLORS_DESIGN_SETTINGS to use
|
|
|
|
*/
|
|
|
|
void SetColorsSettings(COLORS_DESIGN_SETTINGS* aColorsSettings)
|
|
|
|
{
|
|
|
|
m_colorsSettings = aColorsSettings;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-01-23 01:50:16 +00:00
|
|
|
/**
|
|
|
|
* Function GetLayerName
|
2010-01-21 07:41:30 +00:00
|
|
|
* returns the name of the layer given by aLayerIndex.
|
2008-01-23 01:50:16 +00:00
|
|
|
*
|
2009-12-07 03:46:13 +00:00
|
|
|
* @param aLayerIndex A layer index, like LAYER_N_BACK, etc.
|
2008-01-23 01:50:16 +00:00
|
|
|
* @return wxString - the layer name.
|
|
|
|
*/
|
2008-02-12 01:02:53 +00:00
|
|
|
wxString GetLayerName( int aLayerIndex ) const;
|
|
|
|
|
2008-03-01 13:15:41 +00:00
|
|
|
/**
|
|
|
|
* Function SetLayerName
|
|
|
|
* changes the name of the layer given by aLayerIndex.
|
|
|
|
*
|
2009-12-07 03:46:13 +00:00
|
|
|
* @param aLayerIndex A layer index, like LAYER_N_BACK, etc.
|
2008-03-01 13:15:41 +00:00
|
|
|
* @param aLayerName The new layer name
|
2011-09-14 20:04:58 +00:00
|
|
|
* @return bool - true if aLayerName was legal and unique among other
|
2008-03-01 13:15:41 +00:00
|
|
|
* layer names at other layer indices and aLayerIndex was within range, else false.
|
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
bool SetLayerName( int aLayerIndex, const wxString& aLayerName );
|
2008-03-01 13:15:41 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetLayerType
|
|
|
|
* returns the type of the copper layer given by aLayerIndex.
|
|
|
|
*
|
2009-12-07 03:46:13 +00:00
|
|
|
* @param aLayerIndex A layer index, like LAYER_N_BACK, etc.
|
2008-03-01 13:15:41 +00:00
|
|
|
* @return LAYER_T - the layer type, or LAYER_T(-1) if the
|
|
|
|
* index was out of range.
|
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
LAYER_T GetLayerType( int aLayerIndex ) const;
|
2008-03-01 13:15:41 +00:00
|
|
|
|
|
|
|
/**
|
2009-12-12 00:25:46 +00:00
|
|
|
* Function SetLayerType
|
|
|
|
* changes the type of the layer given by aLayerIndex.
|
2008-03-01 13:15:41 +00:00
|
|
|
*
|
2009-12-07 03:46:13 +00:00
|
|
|
* @param aLayerIndex A layer index, like LAYER_N_BACK, etc.
|
2008-03-01 13:15:41 +00:00
|
|
|
* @param aLayerType The new layer type.
|
|
|
|
* @return bool - true if aLayerType was legal and aLayerIndex was within range, else false.
|
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
bool SetLayerType( int aLayerIndex, LAYER_T aLayerType );
|
2008-03-01 13:15:41 +00:00
|
|
|
|
2010-01-21 07:41:30 +00:00
|
|
|
/**
|
|
|
|
* Function SetLayerColor
|
|
|
|
* changes a layer color for any valid layer, including non-copper ones.
|
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
void SetLayerColor( int aLayer, int aColor );
|
2010-01-21 07:41:30 +00:00
|
|
|
|
2010-01-21 20:53:01 +00:00
|
|
|
/**
|
|
|
|
* Function GetLayerColor
|
|
|
|
* gets a layer color for any valid layer, including non-copper ones.
|
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
int GetLayerColor( int aLayer );
|
2008-03-01 13:15:41 +00:00
|
|
|
|
2009-10-21 19:16:25 +00:00
|
|
|
/* Functions to get some items count */
|
2011-09-14 20:04:58 +00:00
|
|
|
int GetNumSegmTrack();
|
|
|
|
|
|
|
|
/* Calculate the zone segment count */
|
|
|
|
int GetNumSegmZone();
|
|
|
|
|
2009-11-12 15:43:38 +00:00
|
|
|
unsigned GetNoconnectCount(); // Return the number of missing links.
|
2008-02-12 01:02:53 +00:00
|
|
|
|
2007-12-09 12:59:06 +00:00
|
|
|
/**
|
|
|
|
* Function GetNumRatsnests
|
|
|
|
* @return int - The number of rats
|
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
unsigned GetRatsnestsCount()
|
2007-12-09 12:59:06 +00:00
|
|
|
{
|
2009-05-28 08:42:24 +00:00
|
|
|
return m_FullRatsnest.size();
|
2007-12-09 12:59:06 +00:00
|
|
|
}
|
2008-02-12 01:02:53 +00:00
|
|
|
|
2009-06-11 14:26:17 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function GetNodesCount
|
2009-06-06 18:08:49 +00:00
|
|
|
* @return the number of pads members of nets (i.e. with netcode > 0)
|
2009-06-11 14:26:17 +00:00
|
|
|
*/
|
|
|
|
unsigned GetNodesCount();
|
2009-06-06 18:08:49 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function GetPadsCount
|
2009-06-06 18:08:49 +00:00
|
|
|
* @return the number of pads in board
|
2009-06-11 14:26:17 +00:00
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
unsigned GetPadsCount()
|
2009-06-06 18:08:49 +00:00
|
|
|
{
|
2009-06-11 14:26:17 +00:00
|
|
|
return m_NetInfo->GetPadsCount();
|
2009-06-06 18:08:49 +00:00
|
|
|
}
|
2007-12-09 12:59:06 +00:00
|
|
|
|
2011-02-25 16:23:24 +00:00
|
|
|
/**
|
|
|
|
* Function ComputeBoundingBox
|
|
|
|
* calculates the bounding box containing all board items (or board edge segments).
|
|
|
|
* @param aBoardEdgesOnly is true if we are interested in board edge segments only.
|
|
|
|
* @return bool - True if items (or board edge segments) were found.
|
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
bool ComputeBoundingBox( bool aBoardEdgesOnly = false );
|
2008-02-12 01:02:53 +00:00
|
|
|
|
2007-12-09 12:59:06 +00:00
|
|
|
/**
|
2009-04-17 08:51:02 +00:00
|
|
|
* Function DisplayInfo
|
2007-12-09 12:59:06 +00:00
|
|
|
* has knowledge about the frame and how and where to put status information
|
|
|
|
* about this object into the frame's message panel.
|
2010-12-08 20:12:46 +00:00
|
|
|
* Is virtual from EDA_ITEM.
|
2011-01-21 19:30:59 +00:00
|
|
|
* @param frame A EDA_DRAW_FRAME in which to print status information.
|
2008-02-12 01:02:53 +00:00
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
void DisplayInfo( EDA_DRAW_FRAME* frame );
|
2008-02-12 01:02:53 +00:00
|
|
|
|
2010-12-21 12:41:17 +00:00
|
|
|
/**
|
|
|
|
* Function Draw.
|
|
|
|
* Redraw the BOARD items but not cursors, axis or grid.
|
|
|
|
* @param aPanel = the panel relative to the board
|
2011-09-14 20:04:58 +00:00
|
|
|
* @param aDC = the current device context
|
2010-12-21 12:41:17 +00:00
|
|
|
* @param aDrawMode = GR_COPY, GR_OR ... (not always used)
|
|
|
|
* @param aOffset = an draw offset value (default = 0,0)
|
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
|
|
|
int aDrawMode, const wxPoint& aOffset = ZeroOffset );
|
2008-04-01 06:07:00 +00:00
|
|
|
|
2009-02-25 16:35:47 +00:00
|
|
|
/**
|
|
|
|
* Function DrawHighLight
|
|
|
|
* redraws the objects in the board that are associated with the given aNetCode
|
|
|
|
* and turns on or off the brilliance associated with that net according to the
|
2010-01-24 13:46:01 +00:00
|
|
|
* current value of global g_HighLight_Status
|
2009-02-25 16:35:47 +00:00
|
|
|
* @param aDrawPanel is needed for the clipping support.
|
2011-09-14 20:04:58 +00:00
|
|
|
* @param aDC = the current device context
|
2009-02-25 16:35:47 +00:00
|
|
|
* @param aNetCode is the net number to highlight or to dim.
|
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
void DrawHighLight( EDA_DRAW_PANEL* aDrawPanel, wxDC* aDC, int aNetCode );
|
2008-02-12 01:02:53 +00:00
|
|
|
|
2007-12-09 12:59:06 +00:00
|
|
|
/**
|
|
|
|
* Function Visit
|
|
|
|
* may be re-implemented for each derived class in order to handle
|
|
|
|
* all the types given by its member data. Implementations should call
|
|
|
|
* inspector->Inspect() on types in scanTypes[], and may use IterateForward()
|
|
|
|
* to do so on lists of such data.
|
|
|
|
* @param inspector An INSPECTOR instance to use in the inspection.
|
|
|
|
* @param testData Arbitrary data used by the inspector.
|
2008-02-12 01:02:53 +00:00
|
|
|
* @param scanTypes Which KICAD_T types are of interest and the order
|
2007-12-09 12:59:06 +00:00
|
|
|
* is significant too, terminated by EOT.
|
|
|
|
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
|
|
|
|
* else SCAN_CONTINUE, and determined by the inspector.
|
|
|
|
*/
|
2008-02-12 01:02:53 +00:00
|
|
|
SEARCH_RESULT Visit( INSPECTOR* inspector, const void* testData,
|
2009-06-11 14:26:17 +00:00
|
|
|
const KICAD_T scanTypes[] );
|
2007-12-09 12:59:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function FindNet
|
|
|
|
* searches for a net with the given netcode.
|
|
|
|
* @param aNetcode A netcode to search for.
|
2009-05-24 18:28:36 +00:00
|
|
|
* @return NETINFO_ITEM_ITEM* - the net or NULL if not found.
|
2007-12-09 12:59:06 +00:00
|
|
|
*/
|
2009-05-24 18:28:36 +00:00
|
|
|
NETINFO_ITEM* FindNet( int aNetcode ) const;
|
2007-12-09 12:59:06 +00:00
|
|
|
|
2008-01-06 20:58:27 +00:00
|
|
|
/**
|
2011-09-14 20:04:58 +00:00
|
|
|
* Function FindNet overloaded
|
2008-01-06 20:58:27 +00:00
|
|
|
* searches for a net with the given name.
|
|
|
|
* @param aNetname A Netname to search for.
|
2009-05-24 18:28:36 +00:00
|
|
|
* @return NETINFO_ITEM* - the net or NULL if not found.
|
2008-01-06 20:58:27 +00:00
|
|
|
*/
|
2009-06-11 14:26:17 +00:00
|
|
|
NETINFO_ITEM* FindNet( const wxString& aNetname ) const;
|
2008-01-06 20:58:27 +00:00
|
|
|
|
2008-02-07 17:10:12 +00:00
|
|
|
/**
|
|
|
|
* Function FindModuleByReference
|
|
|
|
* searches for a MODULE within this board with the given
|
|
|
|
* reference designator. Finds only the first one, if there
|
|
|
|
* is more than one such MODULE.
|
|
|
|
* @param aReference The reference designator of the MODULE to find.
|
|
|
|
* @return MODULE* - If found, the MODULE having the given reference
|
|
|
|
* designator, else NULL.
|
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
MODULE* FindModuleByReference( const wxString& aReference ) const;
|
2008-02-12 01:02:53 +00:00
|
|
|
|
2007-12-17 20:18:04 +00:00
|
|
|
/**
|
|
|
|
* Function ReturnSortedNetnamesList
|
|
|
|
* @param aNames An array string to fill with net names.
|
2011-09-14 20:04:58 +00:00
|
|
|
* @param aSortbyPadsCount true = sort by active pads count, false = no sort (i.e.
|
|
|
|
* leave the sort by net names)
|
2007-12-17 20:18:04 +00:00
|
|
|
* @return int - net names count.
|
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
int ReturnSortedNetnamesList( wxArrayString& aNames, bool aSortbyPadsCount );
|
2007-12-09 12:59:06 +00:00
|
|
|
|
2009-10-30 17:58:15 +00:00
|
|
|
/**************************************/
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function relative to NetClasses: **/
|
2009-10-30 17:58:15 +00:00
|
|
|
/**************************************/
|
2010-01-31 20:01:46 +00:00
|
|
|
|
2009-07-18 11:44:19 +00:00
|
|
|
/**
|
2009-08-17 02:59:38 +00:00
|
|
|
* Function SynchronizeNetsAndNetClasses
|
|
|
|
* copies NETCLASS info to each NET, based on NET membership in a NETCLASS.
|
2011-09-14 20:04:58 +00:00
|
|
|
* Must be called after a Design Rules edition, or after reading a netlist (or editing
|
|
|
|
* the list of nets) Also this function removes the non existing nets in netclasses
|
|
|
|
* and add net nets in default netclass (this happens after reading a netlist)
|
2009-07-18 11:44:19 +00:00
|
|
|
*/
|
2010-01-31 20:01:46 +00:00
|
|
|
void SynchronizeNetsAndNetClasses();
|
2009-07-18 11:44:19 +00:00
|
|
|
|
2009-10-01 16:46:13 +00:00
|
|
|
/**
|
|
|
|
* Function SetCurrentNetClass
|
|
|
|
* Must be called after a netclass selection (or after a netclass parameter change
|
2011-09-14 20:04:58 +00:00
|
|
|
* Initialize vias and tracks values displayed in comb boxes of the auxiliary toolbar
|
2009-11-12 15:43:38 +00:00
|
|
|
* and some others parameters (netclass name ....)
|
2009-10-03 17:18:08 +00:00
|
|
|
* @param aNetClassName = the new netclass name
|
|
|
|
* @return true if lists of tracks and vias sizes are modified
|
2009-10-01 16:46:13 +00:00
|
|
|
*/
|
2010-01-31 20:01:46 +00:00
|
|
|
bool SetCurrentNetClass( const wxString& aNetClassName );
|
2009-09-10 15:22:26 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function GetBiggestClearanceValue
|
2009-10-30 17:58:15 +00:00
|
|
|
* @return the biggest clearance value found in NetClasses list
|
2009-10-21 19:16:25 +00:00
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
int GetBiggestClearanceValue();
|
2009-10-21 19:16:25 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function GetCurrentTrackWidth
|
2009-11-12 15:43:38 +00:00
|
|
|
* @return the current track width, according to the selected options
|
2009-10-30 17:58:15 +00:00
|
|
|
* ( using the default netclass value or a preset value )
|
|
|
|
* the default netclass is always in m_TrackWidthList[0]
|
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
int GetCurrentTrackWidth()
|
2009-10-30 17:58:15 +00:00
|
|
|
{
|
|
|
|
return m_TrackWidthList[m_TrackWidthSelector];
|
|
|
|
}
|
|
|
|
|
2010-01-31 20:01:46 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function GetCurrentViaSize
|
2009-11-12 15:43:38 +00:00
|
|
|
* @return the current via size, according to the selected options
|
2009-10-30 17:58:15 +00:00
|
|
|
* ( using the default netclass value or a preset value )
|
|
|
|
* the default netclass is always in m_TrackWidthList[0]
|
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
int GetCurrentViaSize()
|
2009-10-30 17:58:15 +00:00
|
|
|
{
|
|
|
|
return m_ViasDimensionsList[m_ViaSizeSelector].m_Diameter;
|
|
|
|
}
|
|
|
|
|
2010-01-31 20:01:46 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function GetCurrentViaDrill
|
2009-11-12 15:43:38 +00:00
|
|
|
* @return the current via size, according to the selected options
|
2009-10-30 17:58:15 +00:00
|
|
|
* ( using the default netclass value or a preset value )
|
|
|
|
* the default netclass is always in m_TrackWidthList[0]
|
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
int GetCurrentViaDrill()
|
2009-10-30 17:58:15 +00:00
|
|
|
{
|
|
|
|
return m_ViasDimensionsList[m_ViaSizeSelector].m_Drill > 0 ?
|
2010-01-31 20:01:46 +00:00
|
|
|
m_ViasDimensionsList[m_ViaSizeSelector].m_Drill : -1;
|
2009-10-30 17:58:15 +00:00
|
|
|
}
|
|
|
|
|
2010-01-31 20:01:46 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function GetCurrentMicroViaSize
|
2009-10-30 17:58:15 +00:00
|
|
|
* @return the current micro via size,
|
|
|
|
* that is the current netclass value
|
|
|
|
*/
|
2011-09-14 15:08:44 +00:00
|
|
|
int GetCurrentMicroViaSize();
|
2009-10-30 17:58:15 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function GetCurrentMicroViaDrill
|
2009-10-30 17:58:15 +00:00
|
|
|
* @return the current micro via drill,
|
|
|
|
* that is the current netclass value
|
|
|
|
*/
|
2011-09-14 15:08:44 +00:00
|
|
|
int GetCurrentMicroViaDrill();
|
2009-10-21 19:16:25 +00:00
|
|
|
|
|
|
|
/***************************************************************************/
|
2010-01-31 20:01:46 +00:00
|
|
|
|
2007-12-09 12:59:06 +00:00
|
|
|
/**
|
|
|
|
* Function Save
|
|
|
|
* writes the data structures for this object out to a FILE in "*.brd" format.
|
|
|
|
* @param aFile The FILE to write to.
|
|
|
|
* @return bool - true if success writing else false.
|
2008-02-12 01:02:53 +00:00
|
|
|
*/
|
2010-01-31 20:01:46 +00:00
|
|
|
bool Save( FILE* aFile ) const;
|
2008-02-12 01:02:53 +00:00
|
|
|
|
2011-09-14 15:08:44 +00:00
|
|
|
|
2007-12-09 12:59:06 +00:00
|
|
|
/**
|
|
|
|
* Function GetClass
|
|
|
|
* returns the class name.
|
|
|
|
* @return wxString
|
|
|
|
*/
|
|
|
|
wxString GetClass() const
|
|
|
|
{
|
|
|
|
return wxT( "BOARD" );
|
|
|
|
}
|
|
|
|
|
2008-03-04 04:22:27 +00:00
|
|
|
|
2007-12-09 12:59:06 +00:00
|
|
|
#if defined(DEBUG)
|
2009-06-11 14:26:17 +00:00
|
|
|
|
2007-12-09 12:59:06 +00:00
|
|
|
/**
|
|
|
|
* Function Show
|
|
|
|
* is used to output the object tree, currently for debugging only.
|
2008-02-12 01:02:53 +00:00
|
|
|
* @param nestLevel An aid to prettier tree indenting, and is the level
|
2011-09-14 20:04:58 +00:00
|
|
|
* of nesting of this object within the overall tree.
|
2007-12-09 12:59:06 +00:00
|
|
|
* @param os The ostream& to output to.
|
|
|
|
*/
|
|
|
|
void Show( int nestLevel, std::ostream& os );
|
2008-02-12 01:02:53 +00:00
|
|
|
|
2007-12-09 12:59:06 +00:00
|
|
|
#endif
|
2008-01-04 12:27:16 +00:00
|
|
|
|
2008-02-12 01:02:53 +00:00
|
|
|
|
|
|
|
/*************************/
|
|
|
|
/* Copper Areas handling */
|
|
|
|
/*************************/
|
2009-06-11 14:26:17 +00:00
|
|
|
|
2008-11-27 10:12:46 +00:00
|
|
|
/**
|
|
|
|
* Function HitTestForAnyFilledArea
|
|
|
|
* tests if the given wxPoint is within the bounds of a filled area of this zone.
|
|
|
|
* the test is made on zones on layer from aStartLayer to aEndLayer
|
|
|
|
* Note: if a zone has its flag BUSY (in .m_State) is set, it is ignored.
|
2010-12-29 17:47:32 +00:00
|
|
|
* @param aRefPos A wxPoint to test
|
2008-11-27 10:12:46 +00:00
|
|
|
* @param aStartLayer the first layer to test
|
|
|
|
* @param aEndLayer the last layer (-1 to ignore it) to test
|
|
|
|
* @return ZONE_CONTAINER* return a pointer to the ZONE_CONTAINER found, else NULL
|
|
|
|
*/
|
2009-06-11 14:26:17 +00:00
|
|
|
ZONE_CONTAINER* HitTestForAnyFilledArea( const wxPoint& aRefPos,
|
|
|
|
int aStartLayer,
|
|
|
|
int aEndLayer = -1 );
|
2008-02-12 01:02:53 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function RedrawAreasOutlines
|
|
|
|
* Redraw all areas outlines on layer aLayer ( redraw all if aLayer < 0 )
|
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
void RedrawAreasOutlines( EDA_DRAW_PANEL* aPanel,
|
|
|
|
wxDC* aDC,
|
|
|
|
int aDrawMode,
|
|
|
|
int aLayer );
|
2008-02-12 01:02:53 +00:00
|
|
|
|
2008-09-26 19:51:36 +00:00
|
|
|
/**
|
|
|
|
* Function RedrawFilledAreas
|
|
|
|
* Redraw all filled areas on layer aLayer ( redraw all if aLayer < 0 )
|
|
|
|
*/
|
2011-01-21 19:30:59 +00:00
|
|
|
void RedrawFilledAreas( EDA_DRAW_PANEL* aPanel, wxDC* aDC, int aDrawMode, int aLayer );
|
2008-09-26 19:51:36 +00:00
|
|
|
|
2008-02-12 01:02:53 +00:00
|
|
|
/**
|
|
|
|
* Function SetAreasNetCodesFromNetNames
|
|
|
|
* Set the .m_NetCode member of all copper areas, according to the area Net Name
|
2009-11-12 15:43:38 +00:00
|
|
|
* The SetNetCodesFromNetNames is an equivalent to net name, for fast comparisons.
|
|
|
|
* However the Netcode is an arbitrary equivalence, it must be set after each netlist read
|
2008-02-12 01:02:53 +00:00
|
|
|
* or net change
|
|
|
|
* Must be called after pad netcodes are calculated
|
|
|
|
* @return : error count
|
2008-09-27 19:26:29 +00:00
|
|
|
* For non copper areas, netcode is set to 0
|
2008-02-12 01:02:53 +00:00
|
|
|
*/
|
2009-06-11 14:26:17 +00:00
|
|
|
int SetAreasNetCodesFromNetNames( void );
|
2008-02-12 01:02:53 +00:00
|
|
|
|
|
|
|
/**
|
2008-01-06 17:19:36 +00:00
|
|
|
* Function GetArea
|
|
|
|
* returns the Area (Zone Container) at a given index.
|
|
|
|
* @param index The array type index into a collection of ZONE_CONTAINER *.
|
|
|
|
* @return ZONE_CONTAINER* - a pointer to the Area or NULL if index out of range.
|
|
|
|
*/
|
|
|
|
ZONE_CONTAINER* GetArea( int index ) const
|
|
|
|
{
|
|
|
|
if( (unsigned) index < m_ZoneDescriptorList.size() )
|
|
|
|
return m_ZoneDescriptorList[index];
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2008-01-06 17:19:36 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2009-06-11 14:26:17 +00:00
|
|
|
|
2008-02-12 01:02:53 +00:00
|
|
|
/**
|
2008-01-10 20:53:41 +00:00
|
|
|
* Function GetAreaIndex
|
|
|
|
* returns the Area Index for the given Zone Container.
|
|
|
|
* @param aArea :The ZONE_CONTAINER to find.
|
|
|
|
* @return an Area Index in m_ZoneDescriptorList or -1 if non found.
|
|
|
|
*/
|
2009-06-11 14:26:17 +00:00
|
|
|
int GetAreaIndex( const ZONE_CONTAINER* aArea ) const
|
2008-01-10 20:53:41 +00:00
|
|
|
{
|
2009-06-11 14:26:17 +00:00
|
|
|
for( int ii = 0; ii < GetAreaCount(); ii++ ) // Search for aArea in list
|
2008-02-12 01:02:53 +00:00
|
|
|
{
|
2009-06-11 14:26:17 +00:00
|
|
|
if( aArea == GetArea( ii ) ) // Found !
|
2008-02-12 01:02:53 +00:00
|
|
|
return ii;
|
|
|
|
}
|
2009-06-11 14:26:17 +00:00
|
|
|
|
2008-01-10 20:53:41 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2008-02-12 01:02:53 +00:00
|
|
|
|
2009-06-11 14:26:17 +00:00
|
|
|
|
2008-01-06 17:19:36 +00:00
|
|
|
/**
|
|
|
|
* Function GetAreaCount
|
|
|
|
* @return int - The number of Areas or ZONE_CONTAINER.
|
|
|
|
*/
|
|
|
|
int GetAreaCount() const
|
|
|
|
{
|
|
|
|
return (int) m_ZoneDescriptorList.size();
|
|
|
|
}
|
|
|
|
|
2009-06-11 14:26:17 +00:00
|
|
|
|
2008-02-12 01:02:53 +00:00
|
|
|
/* Functions used in test, merge and cut outlines */
|
2009-06-11 14:26:17 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function AddArea
|
2009-08-23 15:22:44 +00:00
|
|
|
* Add an empty copper area to board areas list
|
2011-09-07 19:41:04 +00:00
|
|
|
* @param aNewZonesList = a PICKED_ITEMS_LIST * where to store new areas pickers (useful
|
|
|
|
* in undo commands) can be NULL
|
2011-09-14 20:04:58 +00:00
|
|
|
* @param aNetcode = the netcode of the copper area (0 = no net)
|
2009-08-23 15:22:44 +00:00
|
|
|
* @param aLayer = the layer of area
|
|
|
|
* @param aStartPointPosition = position of the first point of the polygon outline of this area
|
2011-09-14 20:04:58 +00:00
|
|
|
* @param aHatch = hatch option
|
2009-06-11 14:26:17 +00:00
|
|
|
* @return pointer to the new area
|
2008-02-12 01:02:53 +00:00
|
|
|
*/
|
2009-08-23 15:22:44 +00:00
|
|
|
ZONE_CONTAINER* AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode,
|
2009-09-27 11:00:21 +00:00
|
|
|
int aLayer, wxPoint aStartPointPosition, int aHatch );
|
2008-02-12 01:02:53 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function InsertArea
|
2009-06-11 14:26:17 +00:00
|
|
|
* add empty copper area to net, inserting after m_ZoneDescriptorList[iarea]
|
2008-02-12 01:02:53 +00:00
|
|
|
* @return pointer to the new area
|
|
|
|
*/
|
|
|
|
ZONE_CONTAINER* InsertArea( int netcode, int iarea, int layer, int x, int y, int hatch );
|
|
|
|
|
|
|
|
/**
|
2009-06-11 14:26:17 +00:00
|
|
|
* Function CompleteArea
|
2008-02-12 01:02:53 +00:00
|
|
|
* complete copper area contour by adding a line from last to first corner
|
|
|
|
* if there is only 1 or 2 corners, remove (delete) the area
|
|
|
|
* @param area_to_complete = area to complete or remove
|
|
|
|
* @param style = style of last corner
|
|
|
|
* @return 1 if Ok, 0 if area removed
|
2009-06-11 14:26:17 +00:00
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
int CompleteArea( ZONE_CONTAINER* area_to_complete, int style );
|
2008-02-12 01:02:53 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function TestAreaPolygon
|
|
|
|
* Test an area for self-intersection.
|
|
|
|
*
|
|
|
|
* @param CurrArea = copper area to test
|
|
|
|
* @return :
|
|
|
|
* -1 if arcs intersect other sides
|
|
|
|
* 0 if no intersecting sides
|
|
|
|
* 1 if intersecting sides, but no intersecting arcs
|
|
|
|
* Also sets utility2 flag of area with return value
|
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
int TestAreaPolygon( ZONE_CONTAINER* CurrArea );
|
2008-02-12 01:02:53 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function ClipAreaPolygon
|
|
|
|
* Process an area that has been modified, by clipping its polygon against itself.
|
|
|
|
* This may change the number and order of copper areas in the net.
|
2011-09-07 19:41:04 +00:00
|
|
|
* @param aNewZonesList = a PICKED_ITEMS_LIST * where to store new areas pickers (useful
|
|
|
|
* in undo commands) can be NULL
|
2009-08-23 15:22:44 +00:00
|
|
|
* @param aCurrArea = the zone to process
|
|
|
|
* @param bMessageBoxInt == true, shows message when clipping occurs.
|
|
|
|
* @param bMessageBoxArc == true, shows message when clipping can't be done due to arcs.
|
2011-09-30 18:15:37 +00:00
|
|
|
* @param bRetainArcs = true to handle arcs (not really used in KiCad)
|
2009-10-18 23:22:26 +00:00
|
|
|
* @return :
|
|
|
|
* -1 if arcs intersect other sides, so polygon can't be clipped
|
|
|
|
* 0 if no intersecting sides
|
|
|
|
* 1 if intersecting sides
|
2008-02-12 01:02:53 +00:00
|
|
|
* Also sets areas->utility1 flags if areas are modified
|
2009-06-11 14:26:17 +00:00
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
int ClipAreaPolygon( PICKED_ITEMS_LIST* aNewZonesList,
|
|
|
|
ZONE_CONTAINER* aCurrArea,
|
|
|
|
bool bMessageBoxArc,
|
|
|
|
bool bMessageBoxInt,
|
|
|
|
bool bRetainArcs = true );
|
2008-02-12 01:02:53 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Process an area that has been modified, by clipping its polygon against
|
|
|
|
* itself and the polygons for any other areas on the same net.
|
|
|
|
* This may change the number and order of copper areas in the net.
|
2009-08-23 15:22:44 +00:00
|
|
|
* @param aModifiedZonesList = a PICKED_ITEMS_LIST * where to store deleted or added areas
|
|
|
|
* (useful in undo commands. Can be NULL
|
2008-02-12 01:02:53 +00:00
|
|
|
* @param modified_area = area to test
|
2011-09-07 19:41:04 +00:00
|
|
|
* @param bMessageBoxInt : if true, shows message boxes when clipping occurs.
|
2010-12-29 17:47:32 +00:00
|
|
|
* @param bMessageBoxArc if true, shows message when clipping can't be done due to arcs.
|
2008-02-12 01:02:53 +00:00
|
|
|
* @return :
|
|
|
|
* -1 if arcs intersect other sides, so polygon can't be clipped
|
|
|
|
* 0 if no intersecting sides
|
|
|
|
* 1 if intersecting sides, polygon clipped
|
|
|
|
*/
|
2009-09-27 11:00:21 +00:00
|
|
|
int AreaPolygonModified( PICKED_ITEMS_LIST* aModifiedZonesList,
|
|
|
|
ZONE_CONTAINER* modified_area,
|
|
|
|
bool bMessageBoxArc,
|
|
|
|
bool bMessageBoxInt );
|
2008-02-12 01:02:53 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function CombineAllAreasInNet
|
2009-06-11 14:26:17 +00:00
|
|
|
* Checks all copper areas in net for intersections, combining them if found
|
2011-09-14 20:04:58 +00:00
|
|
|
* @param aDeletedList = a PICKED_ITEMS_LIST * where to store deleted areas (useful
|
|
|
|
* in undo commands can be NULL
|
2009-06-11 14:26:17 +00:00
|
|
|
* @param aNetCode = net to consider
|
|
|
|
* @param bMessageBox : if true display warning message box
|
|
|
|
* @param bUseUtility : if true, don't check areas if both utility flags are 0
|
|
|
|
* Sets utility flag = 1 for any areas modified
|
|
|
|
* If an area has self-intersecting arcs, doesn't try to combine it
|
2008-02-12 01:02:53 +00:00
|
|
|
*/
|
2009-09-27 11:00:21 +00:00
|
|
|
int CombineAllAreasInNet( PICKED_ITEMS_LIST* aDeletedList,
|
|
|
|
int aNetCode,
|
|
|
|
bool bMessageBox,
|
|
|
|
bool bUseUtility );
|
2009-08-23 15:22:44 +00:00
|
|
|
|
2010-11-12 15:17:10 +00:00
|
|
|
/**
|
|
|
|
* Function RemoveArea
|
2009-08-23 15:22:44 +00:00
|
|
|
* remove copper area from net, and put it in a deleted list (if exists)
|
2011-09-14 20:04:58 +00:00
|
|
|
* @param aDeletedList = a PICKED_ITEMS_LIST * where to store deleted areas (useful
|
|
|
|
* in undo commands can be NULL
|
2009-08-23 15:22:44 +00:00
|
|
|
* @param area_to_remove = area to delete or put in deleted list
|
|
|
|
*/
|
|
|
|
void RemoveArea( PICKED_ITEMS_LIST* aDeletedList, ZONE_CONTAINER* area_to_remove );
|
2008-02-12 01:02:53 +00:00
|
|
|
|
|
|
|
/**
|
2009-06-11 14:26:17 +00:00
|
|
|
* Function TestAreaIntersections
|
|
|
|
* Check for intersection of a given copper area with other areas in same net
|
|
|
|
* @param area_to_test = area to compare to all other areas in the same net
|
2008-02-12 01:02:53 +00:00
|
|
|
*/
|
|
|
|
bool TestAreaIntersections( ZONE_CONTAINER* area_to_test );
|
|
|
|
|
|
|
|
/**
|
2009-06-11 14:26:17 +00:00
|
|
|
* Function TestAreaIntersection
|
|
|
|
* Test for intersection of 2 copper areas
|
|
|
|
* area_to_test must be after area_ref in m_ZoneDescriptorList
|
|
|
|
* @param area_ref = area reference
|
|
|
|
* @param area_to_test = area to compare for intersection calculations
|
|
|
|
* @return : 0 if no intersection
|
|
|
|
* 1 if intersection
|
|
|
|
* 2 if arcs intersect
|
2008-02-12 01:02:53 +00:00
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
int TestAreaIntersection( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area_to_test );
|
2008-02-12 01:02:53 +00:00
|
|
|
|
|
|
|
/**
|
2009-06-11 14:26:17 +00:00
|
|
|
* Function CombineAreas
|
|
|
|
* If possible, combine 2 copper areas
|
2011-09-14 20:04:58 +00:00
|
|
|
* @param aDeletedList = a PICKED_ITEMS_LIST * where to store deleted areas (useful
|
|
|
|
* in undo commands can be NULL
|
2009-11-12 15:43:38 +00:00
|
|
|
* @param area_ref = the main area (zone)
|
2009-08-23 15:22:44 +00:00
|
|
|
* @param area_to_combine = the zone that can be merged with area_ref
|
2009-06-11 14:26:17 +00:00
|
|
|
* area_ref must be BEFORE area_to_combine
|
|
|
|
* area_to_combine will be deleted, if areas are combined
|
|
|
|
* @return : 0 if no intersection
|
|
|
|
* 1 if intersection
|
|
|
|
* 2 if arcs intersect
|
2008-02-12 01:02:53 +00:00
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
int CombineAreas( PICKED_ITEMS_LIST* aDeletedList,
|
|
|
|
ZONE_CONTAINER* area_ref,
|
|
|
|
ZONE_CONTAINER* area_to_combine );
|
2008-02-12 01:02:53 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function Test_Drc_Areas_Outlines_To_Areas_Outlines
|
2011-08-09 03:41:20 +00:00
|
|
|
* tests area outlines for DRC:
|
|
|
|
* Tests areas inside other areas.
|
|
|
|
* Tests areas too close.
|
|
|
|
*
|
|
|
|
* @param aArea_To_Examine: area to compare with other areas, or if NULL then
|
|
|
|
* all areas are compared to all others.
|
2008-02-12 01:02:53 +00:00
|
|
|
* @param aCreate_Markers: if true create DRC markers. False: do not creates anything
|
|
|
|
* @return errors count
|
2009-06-11 14:26:17 +00:00
|
|
|
*/
|
2011-09-14 20:04:58 +00:00
|
|
|
int Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_Examine,
|
|
|
|
bool aCreate_Markers );
|
2008-11-18 18:13:55 +00:00
|
|
|
|
|
|
|
/****** function relative to ratsnest calculations: */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function Test_Connection_To_Copper_Areas
|
|
|
|
* init .m_ZoneSubnet parameter in tracks and pads according to the connections to areas found
|
2009-11-12 15:43:38 +00:00
|
|
|
* @param aNetcode = netcode to analyze. if -1, analyze all nets
|
2008-11-18 18:13:55 +00:00
|
|
|
*/
|
|
|
|
void Test_Connections_To_Copper_Areas( int aNetcode = -1 );
|
2011-09-14 20:04:58 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetViaByPosition
|
|
|
|
* finds the first via at \a aPosition on \a aLayer.
|
|
|
|
* <p>
|
|
|
|
* This function does not use the normal hit test to locate a via which which tests
|
|
|
|
* if a position is within the via's bounding box. It tests for the actual locate
|
|
|
|
* of the via.
|
|
|
|
* </p>
|
|
|
|
* @param aPosition The wxPoint to HitTest() against.
|
|
|
|
* @param aLayerMask The layers to search. Use -1 for a don't care.
|
|
|
|
* @return TRACK* A point a to the SEGVIA object if found, else NULL.
|
|
|
|
*/
|
|
|
|
TRACK* GetViaByPosition( const wxPoint& aPosition, int aLayerMask = -1 );
|
2011-09-15 17:58:35 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetPad
|
|
|
|
* finds a pad \a aPosition on \a aLayer.
|
|
|
|
*
|
|
|
|
* @param aPosition A wxPoint object containing the position to hit test.
|
|
|
|
* @param aLayerMask A layer or layers to mask the hit test.
|
|
|
|
* @return A pointer to a D_PAD object if found or NULL if not found.
|
|
|
|
*/
|
|
|
|
D_PAD* GetPad( const wxPoint& aPosition, int aLayerMask = ALL_LAYERS );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetPad
|
|
|
|
* finds a pad connected to \a aEndPoint of \a aTrace.
|
|
|
|
*
|
|
|
|
* @param aTrace A pointer to a TRACK object to hit test against.
|
|
|
|
* @param aEndPoint The end point of \a aTrace the hit test against.
|
|
|
|
* @return A pointer to a D_PAD object if found or NULL if not found.
|
|
|
|
*/
|
|
|
|
D_PAD* GetPad( TRACK* aTrace, int aEndPoint );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetPadFast
|
|
|
|
* return pad found at \a aPosition on \a aLayer uning the fast search method.
|
|
|
|
* <p>
|
|
|
|
* The fast search method only works if the pad list has already been built.
|
|
|
|
* </p>
|
|
|
|
* @param aPosition A wxPoint object containing the position to hit test.
|
|
|
|
* @param aLayer A layer or layers to mask the hit test.
|
|
|
|
* @return A pointer to a D_PAD object if found or NULL if not found.
|
|
|
|
*/
|
|
|
|
D_PAD* GetPadFast( const wxPoint& aPosition, int aLayer );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetPad
|
|
|
|
* locates the pad connected at \a aPosition on \a aLayer starting at list postion
|
|
|
|
* \a aPad
|
|
|
|
* <p>
|
|
|
|
* This function uses a fast search in this sorted pad list and it is faster than
|
|
|
|
* GetPadFast(). This list is a sorted pad list must be built before calling this
|
|
|
|
* function.
|
|
|
|
* </p>
|
2011-09-16 14:13:02 +00:00
|
|
|
* @note The normal pad list is sorted by increasing netcodes.
|
2011-09-15 17:58:35 +00:00
|
|
|
* @param aPad A D_PAD object pointer the first pad in the list to begin searching.
|
|
|
|
* @param aPosition A wxPoint object containing the position to test.
|
2011-09-16 14:13:02 +00:00
|
|
|
* @param aLayerMask A layer or layers to mask the hit test.
|
2011-09-15 17:58:35 +00:00
|
|
|
* @return A D_PAD object pointer to the connected pad.
|
|
|
|
*/
|
2011-09-23 13:57:12 +00:00
|
|
|
D_PAD* GetPad( D_PAD** aPad, const wxPoint& aPosition, int aLayerMask );
|
2011-09-16 14:13:02 +00:00
|
|
|
|
2011-09-17 01:22:26 +00:00
|
|
|
/**
|
|
|
|
* Function GetSortedPadListByXCoord
|
|
|
|
* first empties then fills the vector with all pads and sorts them by
|
|
|
|
* increasing x coordinate. The vector only holds pointers to the pads and
|
|
|
|
* those pointers are only references to pads which are owned by the BOARD
|
|
|
|
* through other links.
|
|
|
|
* @param aVector Where to put the pad pointers.
|
|
|
|
*/
|
|
|
|
void GetSortedPadListByXCoord( std::vector<D_PAD*>& aVector );
|
|
|
|
|
|
|
|
|
2011-09-16 14:13:02 +00:00
|
|
|
/**
|
|
|
|
* Function GetTrace
|
|
|
|
* find the segment of \a aTrace at \a aPosition on \a aLayer if \a Layer is visible.
|
|
|
|
* Traces that are flagged as deleted or busy are ignored.
|
|
|
|
*
|
|
|
|
* @param aTrace A pointer to the TRACK object to search.
|
|
|
|
* @param aPosition A wxPoint object containing the position to test.
|
|
|
|
* @param aLayerMask A layer or layers to mask the hit test. Use -1 to ignore
|
|
|
|
* layer mask.
|
|
|
|
* @return A TRACK object pointer if found otherwise NULL.
|
|
|
|
*/
|
|
|
|
TRACK* GetTrace( TRACK* aTrace, const wxPoint& aPosition, int aLayerMask );
|
2011-09-16 15:54:50 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function MarkTrace
|
2011-09-20 13:57:40 +00:00
|
|
|
* marks a chain of trace segments, connected to \a aTrace.
|
2011-09-16 15:54:50 +00:00
|
|
|
* <p>
|
|
|
|
* Each segment is marked by setting the BUSY bit into m_Flags. Electrical
|
|
|
|
* continuity is detected by walking each segment, and finally the segments
|
|
|
|
* are rearranged into a contiguous chain within the given list.
|
|
|
|
* </p>
|
|
|
|
*
|
|
|
|
* @param aTrace The segment within a list of trace segments to test.
|
|
|
|
* @param aCount A pointer to an integer where to return the number of
|
|
|
|
* marked segments.
|
|
|
|
* @param aTraceLength A pointer to an integer where to return the length of the
|
|
|
|
* trace.
|
|
|
|
* @param aDieLength A pointer to an integer where to return the extra lengths inside
|
|
|
|
* integrated circuits from the pads connected to this track to the
|
|
|
|
* die (if any).
|
|
|
|
* @param aReorder true for reorder the interesting segments (useful for
|
|
|
|
* track edition/deletion) in this case the flag BUSY is
|
|
|
|
* set (the user is responsible of flag clearing). False
|
|
|
|
* for no reorder : useful when we want just calculate the
|
|
|
|
* track length in this case, flags are reset
|
|
|
|
* @return TRACK* The first in the chain of interesting segments.
|
|
|
|
*/
|
|
|
|
TRACK* MarkTrace( TRACK* aTrace, int* aCount, int* aTraceLength,
|
|
|
|
int* aDieLength, bool aReorder );
|
2011-09-16 18:54:04 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetFootprint
|
|
|
|
* get a footprint by its bounding rectangle at \a aPosition on \a aLayer.
|
|
|
|
* <p>
|
|
|
|
* If more than one footprint is at \a aPosition, then the closest footprint on the
|
|
|
|
* active layer is returned. The distance is calculated via manhattan distance from
|
|
|
|
* the center of the bounding rectangle to \a aPosition.
|
|
|
|
*
|
2011-09-17 01:22:26 +00:00
|
|
|
* @param aPosition A wxPoint object containing the position to test.
|
2011-09-16 18:54:04 +00:00
|
|
|
* @param aActiveLayer Layer to test.
|
|
|
|
* @param aVisibleOnly Search only the visible layers if true.
|
|
|
|
* @param aIgnoreLocked Ignore locked modules when true.
|
|
|
|
* @return MODULE* The best module or NULL if none.
|
|
|
|
*/
|
|
|
|
MODULE* GetFootprint( const wxPoint& aPosition, int aActiveLayer,
|
|
|
|
bool aVisibleOnly, bool aIgnoreLocked = false );
|
2011-09-17 01:22:26 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetLockPoint
|
|
|
|
* returns the item at the "attachment" point at the end of a trace at \a aPosition
|
|
|
|
* on \a aLayerMask.
|
|
|
|
* <p>
|
|
|
|
* This may be a PAD or another trace segment.
|
|
|
|
* </p>
|
|
|
|
*
|
|
|
|
* @param aPosition A wxPoint object containing the position to test.
|
|
|
|
* @param aLayerMask A layer or layers to mask the hit test. Use -1 to ignore
|
|
|
|
* layer mask.
|
|
|
|
* @return A pointer to a BOARD_ITEM object if found otherwise NULL.
|
|
|
|
*/
|
|
|
|
BOARD_ITEM* GetLockPoint( const wxPoint& aPosition, int aLayerMask );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function CreateLockPoint
|
|
|
|
* creates an intermediate point on \a aSegment and break it into two segments
|
|
|
|
* at \a aPoition.
|
|
|
|
* <p>
|
|
|
|
* The new segment starts from \a aPosition and ends at the end point of \a
|
|
|
|
* aSegement. The original segment now ends at \a aPosition.
|
|
|
|
* </p>
|
|
|
|
*
|
|
|
|
* @param aPosition A wxPoint object containing the position to test and the new
|
|
|
|
* segment start position if the return value is not NULL.
|
|
|
|
* @param aSegment The trace segment to create the lock point on.
|
|
|
|
* @param aList The pick list to add the created items to.
|
|
|
|
* @return NULL if no new point was created or a pointer to a TRACK ojbect of the
|
|
|
|
* created segment. If \a aSegment points to a via the exact value of \a
|
|
|
|
* aPosition and a pointer to the via are returned.
|
|
|
|
*/
|
|
|
|
TRACK* CreateLockPoint( wxPoint& aPosition, TRACK* aSegment, PICKED_ITEMS_LIST* aList );
|
2007-12-09 12:59:06 +00:00
|
|
|
};
|
|
|
|
|
2009-06-11 14:26:17 +00:00
|
|
|
#endif // #ifndef CLASS_BOARD_H
|