Commit 45cdad8b authored by CHARRAS's avatar CHARRAS

changes in track connectivity computation

parent 28b17187
......@@ -4,6 +4,24 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2007-Oct-13 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+ pcbnew:
remove a change for Read VIA because via attributes
(TROUGH VIA, BLIND VIA or BURIED VIA) are autorisations for layer connection,
and are not a real layer indicator.
If a via connect layers from copper to component, it can have a BURIED VIA attribute.
the meaning is for this via the layer pair can be changed for other layer pair
if after editing this via connect 2 tracks which are only int internal layers,
its layer pair can be changed.
If a via has a TROUGH VIA attribute, it connects ALL layers, whenever tracks
connected to it.
Note: curenty: only TROUGH VIA are handled.
Other types (BLIND VIA and BURIED VIA) are only experimental.
A **lot** of code is needed for a full support.
enhancements in connectivity computation
2007-Oct-15 UPDATE Geoff Harland <gharlandau@yahoo.com.au>
================================================================================
......
This diff is collapsed.
No preview for this file type
This diff is collapsed.
......@@ -49,9 +49,9 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
if ( (pad->m_Masque_Layer & ALL_CU_LAYERS) == ALL_CU_LAYERS )
text << _("all copper layers");
else if( (pad->m_Masque_Layer & CUIVRE_LAYER) == CUIVRE_LAYER )
text << _("copper layers");
text << _("copper layer");
else if( (pad->m_Masque_Layer & CMP_LAYER) == CMP_LAYER )
text << _("cmp layers");
text << _("cmp layer");
else text << _("???");
text << _( ") of " ) << ( (MODULE*) GetParent() )->GetReference();
break;
......
......@@ -7,41 +7,43 @@
#include "base_struct.h"
/* Type des Vias (shape)*/
/* Forme des Vias ( parametre .shape ) */
#define VIA_NORMALE 3 /* type via : traversante (throught via) */
#define VIA_ENTERREE 2 /* type via : enterree ou aveugle (blind via) */
#define VIA_BORGNE 1 /* type via : borgne ou demi-traversante (buried via) */
#define VIA_NOT_DEFINED 0 /* reserved */
#define SQUARE_VIA 0x80000000 /* Flag pour forme carree */
// Via attributes (m_Shape parmeter)
#define THROUGH_VIA 3 /* Always a through hole via */
#define BURIED_VIA 2 /* this via can be on internal layers */
#define BLIND_VIA 1 /* this via which connect from internal layers to an external layer */
#define NOT_DEFINED_VIA 0 /* reserved (unused) */
#define SQUARE_VIA_SHAPE 0x80000000 /* Flag pour forme carree */
#define VIA_NORMALE THROUGH_VIA
#define VIA_ENTERREE BURIED_VIA
#define VIA_BORGNE BLIND_VIA
/***/
class TRACK : public BOARD_ITEM
{
public:
int m_Width; // 0 = line, > 0 = tracks, bus ...
wxPoint m_Start; // Line start point
wxPoint m_End; // Line end point
int m_Shape; // vias: shape and type, Track = shape..
int m_Drill; // for vias: via drill (- 1 for default value)
BOARD_ITEM* start; // pointers to a connected item (pad or track)
BOARD_ITEM* end;
int m_Width; // 0 = line, > 0 = tracks, bus ...
wxPoint m_Start; // Line start point
wxPoint m_End; // Line end point
int m_Shape; // vias: shape and type, Track = shape..
int m_Drill; // for vias: via drill (- 1 for default value)
BOARD_ITEM* start; // pointers to a connected item (pad or track)
BOARD_ITEM* end;
// chain = 0 indique une connexion non encore traitee
int m_Param; // Auxiliary variable ( used in some computations )
int m_Param; // Auxiliary variable ( used in some computations )
protected:
int m_NetCode; // Net number
int m_Sous_Netcode; /* In rastnest routines : for the current net,
protected:
int m_NetCode; // Net number
int m_Sous_Netcode; /* In rastnest routines : for the current net,
* block number (number common to the current connected items found) */
TRACK( const TRACK& track ); // protected so Copy() is used instead.
public:
TRACK( BOARD_ITEM* StructFather, KICAD_T idtype = TYPETRACK );
......@@ -49,14 +51,14 @@ public:
* Function Copy
* will copy this object whether it is a TRACK or a SEGVIA returning
* the corresponding type.
* @return - TRACK*, SEGVIA*, or SEGZONE*, declared as the least common
* @return - TRACK*, SEGVIA*, or SEGZONE*, declared as the least common
* demoninator: TRACK
*/
TRACK* Copy() const;
TRACK* Copy() const;
TRACK* Next() const { return (TRACK*) Pnext; }
TRACK* Next() const { return (TRACK*) Pnext; }
TRACK* Back() const { return (TRACK*) Pback; }
TRACK* Back() const { return (TRACK*) Pback; }
/* supprime du chainage la structure Struct */
......@@ -80,8 +82,8 @@ public:
TRACK* GetBestInsertPoint( BOARD* Pcb );
/* Copie d'un Element d'une chaine de n elements
TRACK* CopyList( int NbSegm = 1 ) const;
*/
* TRACK* CopyList( int NbSegm = 1 ) const;
*/
/* Recherche du debut du net
* ( les elements sont classes par net_code croissant ) */
......@@ -105,15 +107,15 @@ public:
int GetSubNet() const { return m_Sous_Netcode; }
void SetSubNet( int aSubNetCode ) { m_Sous_Netcode = aSubNetCode; }
/**
* Function GetLength
* returns the length of the track using the hypotenuse calculation.
* @return double - the length of the track
*/
double GetLength() const;
double GetLength() const;
/* Display on screen: */
void Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode );
......@@ -122,57 +124,57 @@ public:
/**
* Function ReturnMaskLayer
* returns a "layer mask", which is a bitmap of all layers on which the
* returns a "layer mask", which is a bitmap of all layers on which the
* TRACK segment or SEGVIA physically resides.
* @return int - a layer mask, see pcbstruct.h's CUIVRE_LAYER, etc.
*/
int ReturnMaskLayer();
int IsPointOnEnds( const wxPoint& point, int min_dist = 0 );
bool IsNull(); // return TRUE if segment lenght = 0
int ReturnMaskLayer();
int IsPointOnEnds( const wxPoint& point, int min_dist = 0 );
bool IsNull(); // return TRUE if segment lenght = 0
/**
* Function Display_Infos
* has knowledge about the frame and how and where to put status information
* about this object into the frame's message panel.
* Is virtual from EDA_BaseStruct.
* @param frame A WinEDA_DrawFrame in which to print status information.
*/
void Display_Infos( WinEDA_DrawFrame* frame );
*/
void Display_Infos( WinEDA_DrawFrame* frame );
/**
* Function ShowWidth
* returns the width of the track in displayable user units.
*/
wxString ShowWidth();
wxString ShowWidth();
/**
* Function Visit
* is re-implemented here because TRACKs and SEGVIAs are in the same list
* within BOARD. If that were not true, then we could inherit the
* version from EDA_BaseStruct. This one does not iterate through scanTypes
* but only looks at the first item in the list.
* but only looks at the first item in the list.
* @param inspector An INSPECTOR instance to use in the inspection.
* @param testData Arbitrary data used by the inspector.
* @param scanTypes Which KICAD_T types are of interest and the order
* @param scanTypes Which KICAD_T types are of interest and the order
* 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.
*/
SEARCH_RESULT Visit( INSPECTOR* inspector, const void* testData,
const KICAD_T scanTypes[] );
SEARCH_RESULT Visit( INSPECTOR* inspector, const void* testData,
const KICAD_T scanTypes[] );
/**
* 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 HitTest( const wxPoint& refPos );
bool HitTest( const wxPoint& refPos );
/**
* Function GetClass
......@@ -181,20 +183,22 @@ public:
*/
wxString GetClass() const
{
return wxT("TRACK");
return wxT( "TRACK" );
}
#if defined(DEBUG)
#if defined (DEBUG)
/**
* Function Show
* is used to output the object tree, currently for debugging only.
* @param nestLevel An aid to prettier tree indenting, and is the level
* @param nestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree.
* @param os The ostream& to output to.
*/
void Show( int nestLevel, std::ostream& os );
#endif
#endif
};
......@@ -202,7 +206,7 @@ class SEGZONE : public TRACK
{
public:
SEGZONE( BOARD_ITEM* StructFather );
/**
* Function GetClass
* returns the class name.
......@@ -210,11 +214,11 @@ public:
*/
wxString GetClass() const
{
return wxT("ZONE");
return wxT( "ZONE" );
}
SEGZONE* Next() const { return (SEGZONE*) Pnext; }
SEGZONE* Next() const { return (SEGZONE*) Pnext; }
};
......@@ -227,21 +231,21 @@ public:
TRACK( source )
{
}
/**
* Function IsOnLayer
* tests to see if this object is on the given layer. Is virtual
* tests to see if this object is on the given layer. Is virtual
* from BOARD_ITEM. Tests the starting and ending range of layers for the
* via.
* @param aLayer The layer to test for.
* @return bool - true if on given layer, else false.
*/
bool IsOnLayer( int aLayer ) const;
void SetLayerPair( int top_layer, int bottom_layer );
void ReturnLayerPair( int* top_layer, int* bottom_layer ) const;
/**
* Function GetClass
* returns the class name.
......@@ -249,21 +253,22 @@ public:
*/
wxString GetClass() const
{
return wxT("VIA");
return wxT( "VIA" );
}
#if defined(DEBUG)
#if defined (DEBUG)
/**
* Function Show
* is used to output the object tree, currently for debugging only.
* @param nestLevel An aid to prettier tree indenting, and is the level
* @param nestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree.
* @param os The ostream& to output to.
*/
void Show( int nestLevel, std::ostream& os );
#endif
#endif
};
......
......@@ -413,5 +413,5 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
}
SetToolbars();
Affiche_Status_Box(); /* Affichage des coord curseur */
Affiche_Status_Box(); /* Display new cursor coordinates */
}
......@@ -172,33 +172,12 @@ int WinEDA_BasePcbFrame::ReadListeSegmentDescr( wxDC* DC, FILE* File,
PtSegm->m_Width = width;
// Before specifying the value for any new via's Shape property, check
// the values of its top_layer and bottom_layer properties, to determine
// what value should *really* be assigned to that property (as all
// versions of KiCad up until revision 335 (committed on 2007-Oct-13)
// could sometimes assign an inappropriate value to that property).
if( makeType == TYPEVIA )
{
int b_layer = (layer >> 4) & 15;
int t_layer = layer & 15;
if( ( ( b_layer == COPPER_LAYER_N ) && ( t_layer == CMP_N ) )
|| ( ( b_layer == CMP_N ) && ( t_layer == COPPER_LAYER_N ) ) )
{
// The via is really of a "standard" (through-hole) type
shape = VIA_NORMALE;
}
else if( ( b_layer == COPPER_LAYER_N ) || ( t_layer == CMP_N )
|| ( b_layer == CMP_N ) || ( t_layer == COPPER_LAYER_N ) )
{
// The via is really of a "blind" type
shape = VIA_BORGNE;
}
else
{
// The via is really of a "buried" type
shape = VIA_ENTERREE;
}
}
// a THROUGH HOLE VIA always connects all layers
if ( shape == THROUGH_VIA )
layer = (COPPER_LAYER_N << 4) + LAYER_CMP_N;
}
PtSegm->m_Shape = shape;
if( arg_count < 7 )
......@@ -221,11 +200,11 @@ int WinEDA_BasePcbFrame::ReadListeSegmentDescr( wxDC* DC, FILE* File,
{
case TYPETRACK:
case TYPEVIA:
DisplayActivity( PerCent, wxT( "Tracks:" ) );
DisplayActivity( PerCent, _( "Tracks:" ) );
break;
case TYPEZONE:
DisplayActivity( PerCent, wxT( "Zones:" ) );
DisplayActivity( PerCent, _( "Zones:" ) );
break;
}
#endif
......
......@@ -663,6 +663,21 @@ TEXTE_MODULE* LocateTexteModule( BOARD* Pcb, MODULE** PtModule, int typeloc )
}
/******************************************/
inline int Dist(wxPoint & p1, wxPoint & p2)
/******************************************/
/*
return the dist min between p1 and p2
*/
{
int dist;
dist = abs(p1.x - p2.x) + abs (p1.y - p2.y);
dist *= 7;
dist /= 10;
return dist;
}
/**************************************************************/
TRACK* Locate_Piste_Connectee( TRACK* PtRefSegm, TRACK* pt_base,
TRACK* pt_lim, int extr )
......@@ -686,6 +701,7 @@ TRACK* Locate_Piste_Connectee( TRACK* PtRefSegm, TRACK* pt_base,
int Reflayer;
wxPoint pos_ref;
int ii;
int min_dist;
if( extr == START )
pos_ref = PtRefSegm->m_Start;
......@@ -708,13 +724,16 @@ TRACK* Locate_Piste_Connectee( TRACK* PtRefSegm, TRACK* pt_base,
goto suite;
if( PtSegmN == PtRefSegm )
goto suite;
if( pos_ref == PtSegmN->m_Start )
min_dist = (PtSegmN->m_Width + PtRefSegm->m_Width)/2;
if( Dist(pos_ref, PtSegmN->m_Start) < min_dist )
{ /* Test des couches */
if( Reflayer & PtSegmN->ReturnMaskLayer() )
return PtSegmN;
}
if( pos_ref == PtSegmN->m_End )
if( Dist(pos_ref, PtSegmN->m_End) < min_dist )
{ /* Test des couches */
if( Reflayer & PtSegmN->ReturnMaskLayer() )
return PtSegmN;
......@@ -732,13 +751,16 @@ suite:
goto suite1;
if( PtSegmB == PtRefSegm )
goto suite1;
if( pos_ref == PtSegmB->m_Start )
min_dist = (PtSegmB->m_Width + PtRefSegm->m_Width)/2;
if( Dist(pos_ref, PtSegmB->m_Start) < min_dist )
{ /* Test des couches */
if( Reflayer & PtSegmB->ReturnMaskLayer() )
return PtSegmB;
}
if( pos_ref == PtSegmB->m_End )
if( Dist(pos_ref, PtSegmB->m_End) < min_dist )
{ /* Test des couches */
if( Reflayer & PtSegmB->ReturnMaskLayer() )
return PtSegmB;
......@@ -769,13 +791,16 @@ suite1:
continue;
}
if( pos_ref == PtSegmN->m_Start )
min_dist = (PtSegmN->m_Width + PtRefSegm->m_Width)/2;
if( Dist(pos_ref,PtSegmN->m_Start) < min_dist )
{ /* Test des couches */
if( Reflayer & PtSegmN->ReturnMaskLayer() )
return PtSegmN;
}
if( pos_ref == PtSegmN->m_End )
if( Dist(pos_ref, PtSegmN->m_End) < min_dist )
{ /* Test des couches */
if( Reflayer & PtSegmN->ReturnMaskLayer() )
return PtSegmN;
......
......@@ -30,8 +30,7 @@
void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
/*************************************************************************/
/* Traite les commandes declenche par le bouton gauche de la souris,
* quand un outil est deja selectionn
/* Handle the left click in footprint editor
*/
{
BOARD_ITEM* DrawStruct = GetCurItem();
......@@ -39,7 +38,7 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
DrawPanel->CursorOff( DC );
if( m_ID_current_state == 0 )
{
if( DrawStruct && DrawStruct->m_Flags ) // Commande "POPUP" en cours
if( DrawStruct && DrawStruct->m_Flags ) // Command in progress
{
switch( DrawStruct->Type() )
{
......@@ -75,7 +74,7 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
DrawStruct = GetCurItem();
if( !DrawStruct || (DrawStruct->m_Flags == 0) )
{
DrawStruct = (BOARD_ITEM*) ModeditLocateAndDisplay();
DrawStruct = ModeditLocateAndDisplay();
SetCurItem( DrawStruct );
}
......@@ -177,9 +176,9 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
wxMenu* PopMenu )
/*********************************************************************/
/* Prepare le menu PullUp affich par un click sur le bouton droit
* de la souris.
* Ce menu est ensuite complt par la liste des commandes de ZOOM
/* Handle the right click in the footprint editor:
* Create the pull up menu
* After this menu is built, the standart ZOOM menu is added
*/
{
BOARD_ITEM* DrawStruct = GetCurItem();
......@@ -376,9 +375,8 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
/****************************************************************************/
/* Appel sur un double click:
* pour un lment editable (textes, composant):
* appel de l'editeur correspondant.
/* Handle the double click in the footprin editor:
* If the double clicked item is editable: call the corresponding editor.
*/
{
BOARD_ITEM* DrawStruct = GetCurItem();
......@@ -392,13 +390,13 @@ void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
case 0:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{
DrawStruct = PcbGeneralLocateAndDisplay();
DrawStruct = ModeditLocateAndDisplay();
}
if( (DrawStruct == NULL) || (DrawStruct->m_Flags != 0) )
break;
// Element localis
// Item found
SetCurItem( DrawStruct );
switch( DrawStruct->Type() )
......
......@@ -33,7 +33,7 @@ static bool DisplayRastnestInProgress; // Enable the display of the ratsnes
* Build_Board_Ratsnest( wxDC* DC ) Create this rastnest
* for each net:
* First:
* we create links (and therefore a logical block) between 2 pad. This is achieved by:
* we create a link (and therefore a logical block) between 2 pad. This is achieved by:
* search for a pad without link.
* search its nearest pad
* link these 2 pads (i.e. create a ratsnest item)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment