Commit 5748b791 authored by dickelbeck's avatar dickelbeck

added some conditional DEBUG code for showing the pcb object tree in simple XML format

parent 02a2268f
...@@ -18,8 +18,7 @@ ...@@ -18,8 +18,7 @@
// DrawStructureType names for error messages only: // DrawStructureType names for error messages only:
static wxString DrawStructureTypeName[MAX_STRUCT_TYPE_ID + 1] static wxString DrawStructureTypeName[MAX_STRUCT_TYPE_ID + 1] = {
= {
wxT( "Not init" ), wxT( "Not init" ),
wxT( "Pcb" ), wxT( "Pcb" ),
...@@ -168,10 +167,9 @@ void EDA_BaseStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC ) ...@@ -168,10 +167,9 @@ void EDA_BaseStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
*/ */
{ {
} }
#endif #endif
/*********************************************/ /*********************************************/
wxString EDA_BaseStruct::ReturnClassName( void ) wxString EDA_BaseStruct::ReturnClassName( void )
/*********************************************/ /*********************************************/
...@@ -191,6 +189,48 @@ wxString EDA_BaseStruct::ReturnClassName( void ) ...@@ -191,6 +189,48 @@ wxString EDA_BaseStruct::ReturnClassName( void )
} }
#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
* of nesting of this object within the overall tree.
* @param os The ostream& to output to.
*/
void EDA_BaseStruct::Show( int nestLevel, std::ostream& os )
{
// for now, make it look like XML:
NestedSpace( nestLevel, os ) << '<' << ReturnClassName().mb_str() << ">\n";
EDA_BaseStruct* kid = m_Son;
for( ; kid; kid = kid->Pnext )
{
kid->Show( nestLevel+1, os );
}
NestedSpace( nestLevel, os ) << "</" << ReturnClassName().mb_str() << ">\n";
}
/**
* Function NestedSpace
* outputs nested space for pretty indenting.
* @param nestLevel The nest count
* @param os The ostream&, where to output
* @return std::ostream& - for continuation.
**/
std::ostream& EDA_BaseStruct::NestedSpace( int nestLevel, std::ostream& os )
{
for( int i=0; i<nestLevel; ++i )
os << ' '; // number of spaces here controls indent per nest level
return os;
}
#endif
/**********************************************************************************************/ /**********************************************************************************************/
EDA_BaseLineStruct::EDA_BaseLineStruct( EDA_BaseStruct* StructFather, DrawStructureType idtype ) : EDA_BaseLineStruct::EDA_BaseLineStruct( EDA_BaseStruct* StructFather, DrawStructureType idtype ) :
EDA_BaseStruct( StructFather, idtype ) EDA_BaseStruct( StructFather, idtype )
...@@ -721,3 +761,4 @@ void DrawPickedStruct::DeleteWrapperList( void ) ...@@ -721,3 +761,4 @@ void DrawPickedStruct::DeleteWrapperList( void )
delete wrapp_struct; delete wrapp_struct;
} }
} }
...@@ -6,6 +6,11 @@ ...@@ -6,6 +6,11 @@
#define BASE_STRUCT_H #define BASE_STRUCT_H
#if defined(DEBUG)
#include <iostream> // needed for Show()
#endif
/* Id for class identification, at run time */ /* Id for class identification, at run time */
enum DrawStructureType { enum DrawStructureType {
TYPE_NOT_INIT = 0, TYPE_NOT_INIT = 0,
...@@ -123,8 +128,30 @@ public: ...@@ -123,8 +128,30 @@ public:
const wxPoint& offset, const wxPoint& offset,
int draw_mode, int draw_mode,
int Color = -1 ); int Color = -1 );
#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
* of nesting of this object within the overall tree.
* @param os The ostream& to output to.
*/
virtual void Show( int nestLevel, std::ostream& os );
/**
* Function NestedSpace
* outputs nested space for pretty indenting.
* @param nestLevel The nest count
* @param os The ostream&, where to output
* @return std::ostream& - for continuation.
**/
static std::ostream& NestedSpace( int nestLevel, std::ostream& os );
#endif
}; };
// Text justify: // Text justify:
// Values -1,0,1 are used in computations, do not change them // Values -1,0,1 are used in computations, do not change them
typedef enum { typedef enum {
......
...@@ -176,15 +176,16 @@ public: ...@@ -176,15 +176,16 @@ public:
EDA_BoardDesignSettings( void ); EDA_BoardDesignSettings( void );
}; };
// Values for m_DisplayViaMode member: // Values for m_DisplayViaMode member:
enum DisplayViaMode { enum DisplayViaMode {
VIA_HOLE_NOT_SHOW = 0, VIA_HOLE_NOT_SHOW = 0,
VIA_SPECIAL_HOLE_SHOW, VIA_SPECIAL_HOLE_SHOW,
ALL_VIA_HOLE_SHOW, ALL_VIA_HOLE_SHOW,
OPT_VIA_HOLE_END OPT_VIA_HOLE_END
}; };
class BOARD : public EDA_BaseStruct class BOARD : public EDA_BaseStruct
{ {
public: public:
...@@ -212,7 +213,7 @@ public: ...@@ -212,7 +213,7 @@ public:
CHEVELU* m_Ratsnest; // pointeur liste des chevelus CHEVELU* m_Ratsnest; // pointeur liste des chevelus
CHEVELU* m_LocalRatsnest; // pointeur liste des chevelus d'un module CHEVELU* m_LocalRatsnest; // pointeur liste des chevelus d'un module
EDGE_ZONE* m_CurrentLimitZone;/* pointeur sur la liste des segments EDGE_ZONE* m_CurrentLimitZone; /* pointeur sur la liste des segments
* de delimitation de la zone en cours de trace */ * de delimitation de la zone en cours de trace */
BOARD( EDA_BaseStruct* StructFather, WinEDA_BasePcbFrame* frame ); BOARD( EDA_BaseStruct* StructFather, WinEDA_BasePcbFrame* frame );
...@@ -230,6 +231,18 @@ public: ...@@ -230,6 +231,18 @@ public:
// Calcul du rectangle d'encadrement: // Calcul du rectangle d'encadrement:
bool ComputeBoundaryBox( void ); bool ComputeBoundaryBox( void );
#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
* of nesting of this object within the overall tree.
* @param os The ostream& to output to.
*/
virtual void Show( int nestLevel, std::ostream& os );
#endif
}; };
......
...@@ -254,3 +254,36 @@ bool BOARD::ComputeBoundaryBox( void ) ...@@ -254,3 +254,36 @@ bool BOARD::ComputeBoundaryBox( void )
return Has_Items; return Has_Items;
} }
#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
* of nesting of this object within the overall tree.
* @param os The ostream& to output to.
*/
void BOARD::Show( int nestLevel, std::ostream& os )
{
// for now, make it look like XML:
NestedSpace( nestLevel, os ) << '<' << ReturnClassName().mb_str() << ">\n";
// specialization of the output:
EDA_BaseStruct* p = m_Modules;
for( ; p; p = p->Pnext )
p->Show( nestLevel+1, os );
p = m_Drawings;
for( ; p; p = p->Pnext )
p->Show( nestLevel+1, os );
EDA_BaseStruct* kid = m_Son;
for( ; kid; kid = kid->Pnext )
{
kid->Show( nestLevel+1, os );
}
NestedSpace( nestLevel, os ) << "</" << ReturnClassName().mb_str() << ">\n";
}
#endif
This diff is collapsed.
/*******************************************************/ /*******************************************************/
/* class_module.h : module description (excepted pads) */ /* class_module.h : module description (excepted pads) */
/*******************************************************/ /*******************************************************/
class Pcb3D_GLCanvas; class Pcb3D_GLCanvas;
class Struct3D_Master; class Struct3D_Master;
/************************************/ /************************************/
/* Modules (footprints) description */ /* Modules (footprints) description */
/* pad are in class_pad.xx */ /* pad are in class_pad.xx */
/************************************/ /************************************/
/* Format des modules: /* Format des modules:
Description generale * Description generale
Description segments contour * Description segments contour
Description textes * Description textes
Description pastilles * Description pastilles
*/ */
/* Flags :*/ /* Flags :*/
...@@ -24,9 +24,10 @@ enum Mod_Attribut /* Attributs d'un module */ ...@@ -24,9 +24,10 @@ enum Mod_Attribut /* Attributs d'un module */
{ {
MOD_DEFAULT = 0, /* Type default */ MOD_DEFAULT = 0, /* Type default */
MOD_CMS = 1, /* Pour module apparaissant dans les MOD_CMS = 1, /* Pour module apparaissant dans les
fichiers de placement automatique (principalement modules CMS */ * fichiers de placement automatique (principalement modules CMS */
MOD_VIRTUAL = 2 /* Module virtuel constitue par un dessin sur circuit MOD_VIRTUAL = 2 /* Module virtuel constitue par un dessin sur circuit
(connecteur, trou de percage..) */ * (connecteur, trou de percage..) */
}; };
/* flags for autoplace and autoroute (.m_ModuleStatus member) */ /* flags for autoplace and autoroute (.m_ModuleStatus member) */
...@@ -34,24 +35,24 @@ enum Mod_Attribut /* Attributs d'un module */ ...@@ -34,24 +35,24 @@ enum Mod_Attribut /* Attributs d'un module */
#define MODULE_is_PLACED 0x02 /* In autoplace: module automatically placed */ #define MODULE_is_PLACED 0x02 /* In autoplace: module automatically placed */
#define MODULE_to_PLACE 0x04 /* In autoplace: module waiting for autoplace */ #define MODULE_to_PLACE 0x04 /* In autoplace: module waiting for autoplace */
class MODULE: public EDA_BaseStruct class MODULE : public EDA_BaseStruct
{ {
public: public:
int m_Layer; // layer number int m_Layer; // layer number
wxPoint m_Pos; // Real coord on board wxPoint m_Pos; // Real coord on board
D_PAD * m_Pads; /* Pad list (linked list) */ D_PAD* m_Pads; /* Pad list (linked list) */
EDA_BaseStruct * m_Drawings; /* Graphic items list (linked list) */ EDA_BaseStruct* m_Drawings; /* Graphic items list (linked list) */
Struct3D_Master * m_3D_Drawings; /* Pointeur sur la liste des elements de trace 3D*/ Struct3D_Master* m_3D_Drawings; /* Pointeur sur la liste des elements de trace 3D*/
TEXTE_MODULE * m_Reference; // texte reference du composant (U34, R18..) TEXTE_MODULE* m_Reference; // texte reference du composant (U34, R18..)
TEXTE_MODULE * m_Value; // texte valeur du composant (74LS00, 22K..) TEXTE_MODULE* m_Value; // texte valeur du composant (74LS00, 22K..)
wxString m_LibRef; /* nom du module en librairie */ wxString m_LibRef; /* nom du module en librairie */
int m_Attributs; /* Flags bits a bit ( voir enum Mod_Attribut ) */ int m_Attributs; /* Flags bits a bit ( voir enum Mod_Attribut ) */
int m_Orient ; /* orientation en 1/10 degres */ int m_Orient; /* orientation en 1/10 degres */
int flag ; /* flag utilise en trace rastnest et routage auto */ int flag; /* flag utilise en trace rastnest et routage auto */
int m_ModuleStatus; /* For autoplace: flags (LOCKED, AUTOPLACED) */ int m_ModuleStatus; /* For autoplace: flags (LOCKED, AUTOPLACED) */
EDA_Rect m_BoundaryBox; /* position/taille du cadre de reperage (coord locales)*/ EDA_Rect m_BoundaryBox; /* position/taille du cadre de reperage (coord locales)*/
EDA_Rect m_RealBoundaryBox ; /* position/taille du module (coord relles) */ EDA_Rect m_RealBoundaryBox; /* position/taille du module (coord relles) */
int m_PadNum; // Nombre total de pads int m_PadNum; // Nombre total de pads
int m_AltPadNum; // en placement auto Nombre de pads actifs pour int m_AltPadNum; // en placement auto Nombre de pads actifs pour
// les calculs // les calculs
...@@ -67,23 +68,24 @@ public: ...@@ -67,23 +68,24 @@ public:
wxString m_KeyWord; // Liste des mots cles relatifs au module wxString m_KeyWord; // Liste des mots cles relatifs au module
public: public:
MODULE(BOARD * parent); MODULE( BOARD* parent );
MODULE(MODULE * module); MODULE( MODULE* module );
~MODULE(void); ~MODULE( void );
void Copy(MODULE * Module); // Copy structure void Copy( MODULE* Module ); // Copy structure
MODULE * Next(void) { return (MODULE *) Pnext; }
void Set_Rectangle_Encadrement(void); /* mise a jour du rect d'encadrement MODULE* Next( void ) { return (MODULE*) Pnext; }
en coord locales (orient 0 et origine = pos module) */
void SetRectangleExinscrit(void); /* mise a jour du rect d'encadrement void Set_Rectangle_Encadrement( void );/* mise a jour du rect d'encadrement
et de la surface en coord reelles */ * en coord locales (orient 0 et origine = pos module) */
void SetRectangleExinscrit( void );/* mise a jour du rect d'encadrement
* et de la surface en coord reelles */
// deplacements // deplacements
void SetPosition(const wxPoint & newpos); void SetPosition( const wxPoint& newpos );
void SetOrientation(int newangle); void SetOrientation( int newangle );
/* supprime du chainage la structure Struct */ /* supprime du chainage la structure Struct */
void UnLink( void ); void UnLink( void );
...@@ -114,21 +116,32 @@ public: ...@@ -114,21 +116,32 @@ public:
/* Readind and writing data on files */ /* Readind and writing data on files */
int WriteDescr( FILE * File ); int WriteDescr( FILE* File );
int Write_3D_Descr( FILE * File ); int Write_3D_Descr( FILE* File );
int ReadDescr( FILE * File, int * LineNum = NULL); int ReadDescr( FILE* File, int* LineNum = NULL );
int Read_3D_Descr( FILE * File, int * LineNum = NULL); int Read_3D_Descr( FILE* File, int* LineNum = NULL );
/* drawing functions */ /* drawing functions */
void Draw(WinEDA_DrawPanel * panel, wxDC * DC, void Draw( WinEDA_DrawPanel* panel, wxDC* DC,
const wxPoint & offset, int draw_mode); const wxPoint& offset, int draw_mode );
void Draw3D(Pcb3D_GLCanvas * glcanvas); void Draw3D( Pcb3D_GLCanvas* glcanvas );
void DrawEdgesOnly(WinEDA_DrawPanel * panel, wxDC * DC, void DrawEdgesOnly( WinEDA_DrawPanel* panel, wxDC* DC,
const wxPoint & offset,int draw_mode); const wxPoint& offset, int draw_mode );
void DrawAncre(WinEDA_DrawPanel * panel, wxDC * DC, void DrawAncre( WinEDA_DrawPanel* panel, wxDC* DC,
const wxPoint & offset, int dim_ancre, int draw_mode); const wxPoint& offset, int dim_ancre, int draw_mode );
/* miscellaneous */ /* miscellaneous */
void Display_Infos(WinEDA_BasePcbFrame * frame); void Display_Infos( WinEDA_BasePcbFrame* frame );
};
#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
* of nesting of this object within the overall tree.
* @param os The ostream& to output to.
*/
virtual void Show( int nestLevel, std::ostream& os );
#endif
};
This diff is collapsed.
This diff is collapsed.
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