Commit bffa0689 authored by CHARRAS's avatar CHARRAS

changes in file organisation and classes to prepare zone redesign

parent aaa0acf7
...@@ -4,6 +4,13 @@ Started 2007-June-11 ...@@ -4,6 +4,13 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2007-Dec-09 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+pcbnew:
changes in file organisation and classes to prepare zone redesign. No real new code.
class zone functions and definitions moved in class_zone.h and .cpp
2007-Dec-07 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2007-Dec-07 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================ ================================================================================
+pcbnew +pcbnew
......
...@@ -18,6 +18,7 @@ OBJECTS= \ ...@@ -18,6 +18,7 @@ OBJECTS= \
onrightclick.o\ onrightclick.o\
class_board.o\ class_board.o\
class_track.o \ class_track.o \
class_drc_item.o \
drawframe.o\ drawframe.o\
drawpanel.o\ drawpanel.o\
set_color.o \ set_color.o \
...@@ -68,6 +69,9 @@ files.o: files.cpp $(COMMON) ...@@ -68,6 +69,9 @@ files.o: files.cpp $(COMMON)
class_marker.o: ../pcbnew/class_marker.cpp ../pcbnew/class_marker.h $(COMMON) class_marker.o: ../pcbnew/class_marker.cpp ../pcbnew/class_marker.h $(COMMON)
$(CXX) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp $(CXX) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp
class_drc_item.o: ../pcbnew/class_drc_item.cpp $(COMMON)
$(CXX) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp
sel_layer.o: ../pcbnew/sel_layer.cpp $(COMMON) sel_layer.o: ../pcbnew/sel_layer.cpp $(COMMON)
$(CXX) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp $(CXX) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp
......
...@@ -41,6 +41,8 @@ enum KICAD_T { ...@@ -41,6 +41,8 @@ enum KICAD_T {
TYPESCREEN, TYPESCREEN,
TYPEBLOCK, TYPEBLOCK,
TYPEEDGEZONE, TYPEEDGEZONE,
TYPEZONE_POLYEDGE,
TYPEZONE_CONTAINER,
// Draw Items in schematic // Draw Items in schematic
DRAW_POLYLINE_STRUCT_TYPE, DRAW_POLYLINE_STRUCT_TYPE,
......
This diff is collapsed.
...@@ -140,6 +140,9 @@ struct CHEVELU; ...@@ -140,6 +140,9 @@ struct CHEVELU;
class Ki_PageDescr; class Ki_PageDescr;
class DrawBlockStruct; class DrawBlockStruct;
/* Class to handle a board */
#include "class_board.h"
// Class for handle current printed board design settings // Class for handle current printed board design settings
#define HIST0RY_NUMBER 8 #define HIST0RY_NUMBER 8
class EDA_BoardDesignSettings class EDA_BoardDesignSettings
...@@ -195,204 +198,7 @@ enum DisplayViaMode { ...@@ -195,204 +198,7 @@ enum DisplayViaMode {
OPT_VIA_HOLE_END OPT_VIA_HOLE_END
}; };
/* Handle info to display a board */
class BOARD : public BOARD_ITEM
{
friend class WinEDA_PcbFrame;
private:
std::vector<MARKER*> m_markers; ///< MARKERs for clearance problems, owned by pointer
// std::vector<MARKER*> m_markersUnconnected; ///< MARKERs for unconnected problems, owned by pointer
public:
WinEDA_BasePcbFrame* m_PcbFrame; // Window de visualisation
EDA_Rect m_BoundaryBox; // Limites d'encadrement du PCB
int m_Unused;
int m_Status_Pcb; // Mot d'etat: Bit 1 = Chevelu calcule
EDA_BoardDesignSettings* m_BoardSettings; // Link to current design settings
int m_NbNets; // Nombre de nets (equipotentielles)
int m_NbNodes; // nombre de pads connectes
int m_NbLinks; // nombre de chevelus
int m_NbLoclinks; // nombre de chevelus dans Local ratsnest
// minimal de pistes a tracer
int m_NbNoconnect; // nombre de chevelus actifs
int m_NbSegmTrack; // nombre d'elements de type segments de piste
int m_NbSegmZone; // nombre d'elements de type segments de zone
BOARD_ITEM* m_Drawings; // linked list of lines & texts
MODULE* m_Modules; // linked list of MODULEs
EQUIPOT* m_Equipots; // linked list of nets
TRACK* m_Track; // linked list of TRACKs and SEGVIAs
SEGZONE* m_Zone; // linked list of SEGZONEs
D_PAD** m_Pads; // pointeur liste d'acces aux pads
int m_NbPads; // nombre total de pads
CHEVELU* m_Ratsnest; // pointeur liste des chevelus
CHEVELU* m_LocalRatsnest; // pointeur liste des chevelus d'un module
EDGE_ZONE* m_CurrentLimitZone; /* pointeur sur la liste des segments
* de delimitation de la zone en cours de trace */
BOARD( EDA_BaseStruct* StructFather, WinEDA_BasePcbFrame* frame );
~BOARD();
/**
* Function GetPosition
* is here to satisfy BOARD_ITEM's requirements, but this implementation
* is a dummy.
* @return const wxPoint& of (0,0)
*/
wxPoint& GetPosition();
/* supprime du chainage la structure Struct */
void UnLink();
/**
* Function Add
* adds the given item to this BOARD and takes ownership of its memory.
* @param aBoardItem The item to add to this board.
* @param aControl An int which can vary how the item is added.
*/
void Add( BOARD_ITEM* aBoardItem, int aControl = 0 );
/**
* Function Delete
* deletes the given single item from this BOARD and deletes its memory. If you
* need the object after deletion, first copy it.
* @param aBoardItem The item to remove from this board and delete
*/
void Delete( BOARD_ITEM* aBoardItem );
/**
* Function DeleteMARKERs
* deletes ALL MARKERS from the board.
*/
void DeleteMARKERs();
/**
* Function DeleteMARKER
* deletes one MARKER from the board.
* @param aIndex The index of the marker to delete.
*/
void DeleteMARKER( int aIndex );
/**
* Function GetMARKER
* returns the MARKER at a given index.
* @param index The array type index into a collection of MARKERS.
* @return MARKER* - a pointer to the MARKER or NULL if index out of range.
*/
MARKER* GetMARKER( int index ) const
{
if( (unsigned) index < m_markers.size() )
return m_markers[index];
return NULL;
}
/**
* Function GetMARKERCount
* @return int - The number of MARKERS.
*/
int GetMARKERCount() const
{
return (int) m_markers.size();
}
/* Routines de calcul des nombres de segments pistes et zones */
int GetNumSegmTrack();
int GetNumSegmZone();
int GetNumNoconnect(); // retourne le nombre de connexions manquantes
/**
* Function GetNumRatsnests
* @return int - The number of rats
*/
int GetNumRatsnests()
{
return m_NbLinks;
}
int GetNumNodes(); // retourne le nombre de pads a netcode > 0
// Calcul du rectangle d'encadrement:
bool ComputeBoundaryBox();
/**
* 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 );
/**
* 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.
* @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[] );
/**
* Function FindNet
* searches for a net with the given netcode.
* @param aNetcode A netcode to search for.
* @return EQUIPOT* - the net or NULL if not found.
*/
EQUIPOT* FindNet( int aNetcode ) const;
/**
* 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.
*/
bool Save( FILE* aFile ) const;
/**
* Function GetClass
* returns the class name.
* @return wxString
*/
wxString GetClass() const
{
return wxT( "BOARD" );
}
#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 Show( int nestLevel, std::ostream& os );
#endif
};
/* Description d'un ecran */
class PCB_SCREEN : public BASE_SCREEN class PCB_SCREEN : public BASE_SCREEN
{ {
public: public:
...@@ -512,32 +318,7 @@ public: ...@@ -512,32 +318,7 @@ public:
#include "class_mire.h" #include "class_mire.h"
#include "class_track.h" #include "class_track.h"
#include "class_marker.h" #include "class_marker.h"
#include "class_zone.h"
/*******************/
/* class EDGE_ZONE */
/*******************/
class EDGE_ZONE : public DRAWSEGMENT
{
public:
EDGE_ZONE( BOARD_ITEM* StructFather );
EDGE_ZONE( const EDGE_ZONE& edgezone );
~EDGE_ZONE();
EDGE_ZONE* Next() { return (EDGE_ZONE*) Pnext; }
EDGE_ZONE* Back() { return (EDGE_ZONE*) Pback; }
/**
* 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.
*/
bool Save( FILE* aFile ) const;
};
class DISPLAY_OPTIONS class DISPLAY_OPTIONS
......
...@@ -6,65 +6,7 @@ ...@@ -6,65 +6,7 @@
#include "pcbnew.h" #include "pcbnew.h"
#include "bitmaps.h" //#include "bitmaps.h"
wxString DRC_ITEM::GetErrorText() const
{
switch( m_ErrorCode )
{
// case DRCE_: not assigned yet
case DRCE_UNCONNECTED_PADS:
return wxString( _("Unconnected pads") );
case DRCE_TRACK_NEAR_THROUGH_HOLE:
return wxString( _("Track near thru-hole") );
case DRCE_TRACK_NEAR_PAD:
return wxString( _("Track near pad") );
case DRCE_TRACK_NEAR_VIA:
return wxString( _("Track near via") );
case DRCE_VIA_NEAR_VIA:
return wxString( _("Via near via") );
case DRCE_VIA_NEAR_TRACK:
return wxString( _("Via near track") );
case DRCE_TRACK_ENDS1:
case DRCE_TRACK_ENDS2:
case DRCE_TRACK_ENDS3:
case DRCE_TRACK_ENDS4:
case DRCE_ENDS_PROBLEM1:
case DRCE_ENDS_PROBLEM2:
case DRCE_ENDS_PROBLEM3:
case DRCE_ENDS_PROBLEM4:
case DRCE_ENDS_PROBLEM5:
return wxString( _("Two track ends") );
case DRCE_TRACK_UNKNOWN1:
return wxString( _("This looks bad") ); ///< @todo check source code and change this comment
case DRCE_TRACKS_CROSSING:
return wxString( _("Tracks crossing") );
case DRCE_PAD_NEAR_PAD1:
return wxString( _("Pad near pad") );
case DRCE_VIA_HOLE_BIGGER:
return wxString( _("Via hole > diameter"));
default:
return wxString( wxT("PROGRAM BUG, PLEASE LEAVE THE ROOM.") );
}
}
wxString DRC_ITEM::ShowCoord( const wxPoint& aPos )
{
wxString temp;
wxString ret;
ret << wxT("@(") << valeur_param( aPos.x, temp );
ret << wxT(",") << valeur_param( aPos.y, temp );
ret << wxT(")");
return ret;
}
/*****************/ /*****************/
...@@ -229,7 +171,7 @@ void BOARD::DeleteMARKERs() ...@@ -229,7 +171,7 @@ void BOARD::DeleteMARKERs()
} }
/* Routines de calcul des nombres de segments pistes et zones */ /* Calculate the track segment count */
int BOARD::GetNumSegmTrack() int BOARD::GetNumSegmTrack()
{ {
TRACK* CurTrack = m_Track; TRACK* CurTrack = m_Track;
...@@ -243,6 +185,7 @@ int BOARD::GetNumSegmTrack() ...@@ -243,6 +185,7 @@ int BOARD::GetNumSegmTrack()
} }
/* Calculate the zone segment count */
int BOARD::GetNumSegmZone() int BOARD::GetNumSegmZone()
{ {
TRACK* CurTrack = m_Zone; TRACK* CurTrack = m_Zone;
...@@ -256,14 +199,14 @@ int BOARD::GetNumSegmZone() ...@@ -256,14 +199,14 @@ int BOARD::GetNumSegmZone()
} }
// retourne le nombre de connexions manquantes // return the unconnection count
int BOARD::GetNumNoconnect() int BOARD::GetNumNoconnect()
{ {
return m_NbNoconnect; return m_NbNoconnect;
} }
// retourne le nombre de pads a netcode > 0 // return the active pad count ( pads with a netcode > 0 )
int BOARD::GetNumNodes() int BOARD::GetNumNodes()
{ {
return m_NbNodes; return m_NbNodes;
...@@ -274,14 +217,12 @@ int BOARD::GetNumNodes() ...@@ -274,14 +217,12 @@ int BOARD::GetNumNodes()
bool BOARD::ComputeBoundaryBox() bool BOARD::ComputeBoundaryBox()
/***********************************/ /***********************************/
/* Determine le rectangle d'encadrement du pcb /** Function ComputeBoundaryBox()
* Ce rectangle englobe les contours pcb, pads , vias et piste * Calculate the bounding box of the board
* Sortie: * This box contains pcb edges, pads , vias and tracks
* m_PcbBox * Update m_PcbBox member
* *
* retourne: * @return 0 for an empty board (no items), else 1
* 0 si aucun element utile
* 1 sinon
*/ */
{ {
int rayon, cx, cy, d, xmin, ymin, xmax, ymax; int rayon, cx, cy, d, xmin, ymin, xmax, ymax;
...@@ -293,7 +234,7 @@ bool BOARD::ComputeBoundaryBox() ...@@ -293,7 +234,7 @@ bool BOARD::ComputeBoundaryBox()
xmin = ymin = 0x7FFFFFFFl; xmin = ymin = 0x7FFFFFFFl;
xmax = ymax = -0x7FFFFFFFl; xmax = ymax = -0x7FFFFFFFl;
/* Analyse des Contours PCB */ /* Analyse PCB edges*/
PtStruct = m_Drawings; PtStruct = m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext )
{ {
...@@ -328,7 +269,7 @@ bool BOARD::ComputeBoundaryBox() ...@@ -328,7 +269,7 @@ bool BOARD::ComputeBoundaryBox()
} }
} }
/* Analyse des Modules */ /* Analyse footprints */
MODULE* module = m_Modules; MODULE* module = m_Modules;
for( ; module != NULL; module = (MODULE*) module->Pnext ) for( ; module != NULL; module = (MODULE*) module->Pnext )
{ {
...@@ -351,7 +292,7 @@ bool BOARD::ComputeBoundaryBox() ...@@ -351,7 +292,7 @@ bool BOARD::ComputeBoundaryBox()
} }
} }
/* Analyse des segments de piste et zone*/ /* Analyse track and zones */
for( Track = m_Track; Track != NULL; Track = (TRACK*) Track->Pnext ) for( Track = m_Track; Track != NULL; Track = (TRACK*) Track->Pnext )
{ {
d = (Track->m_Width / 2) + 1; d = (Track->m_Width / 2) + 1;
...@@ -848,47 +789,4 @@ void BOARD::Show( int nestLevel, std::ostream& os ) ...@@ -848,47 +789,4 @@ void BOARD::Show( int nestLevel, std::ostream& os )
} }
/* wrote this before discovering ReturnPcbLayerName()
const char* BOARD::ShowLayer( int aLayer )
{
const char* rs;
switch( aLayer )
{
case LAYER_COPPER_LAYER_N: rs = "cu"; break;
case LAYER_N_2: rs = "layer2"; break;
case LAYER_N_3: rs = "layer3"; break;
case LAYER_N_4: rs = "layer4"; break;
case LAYER_N_5: rs = "layer5"; break;
case LAYER_N_6: rs = "layer6"; break;
case LAYER_N_7: rs = "layer7"; break;
case LAYER_N_8: rs = "layer8"; break;
case LAYER_N_9: rs = "layer9"; break;
case LAYER_N_10: rs = "layer10"; break;
case LAYER_N_11: rs = "layer11"; break;
case LAYER_N_12: rs = "layer12"; break;
case LAYER_N_13: rs = "layer13"; break;
case LAYER_N_14: rs = "layer14"; break;
case LAYER_N_15: rs = "layer15"; break;
case LAYER_CMP_N: rs = "cmp"; break;
case ADHESIVE_N_CU: rs = "cu/adhesive"; break;
case ADHESIVE_N_CMP: rs = "cmp/adhesive"; break;
case SOLDERPASTE_N_CU: rs = "cu/sldrpaste"; break;
case SOLDERPASTE_N_CMP: rs = "cmp/sldrpaste"; break;
case SILKSCREEN_N_CU: rs = "cu/silkscreen"; break;
case SILKSCREEN_N_CMP: rs = "cmp/silkscreen"; break;
case SOLDERMASK_N_CU: rs = "cu/sldrmask"; break;
case SOLDERMASK_N_CMP: rs = "cmp/sldrmask"; break;
case DRAW_N: rs = "drawing"; break;
case COMMENT_N: rs = "comment"; break;
case ECO1_N: rs = "eco_1"; break;
case ECO2_N: rs = "eco_2"; break;
case EDGE_N: rs = "edge"; break;
default: rs = "???"; break;
}
return rs;
}
*/
#endif #endif
/**************************************************************/
/* class_board.h - Class BOARD to handle a board */
/**************************************************************/
#ifndef CLASS_BOARD_H
#define CLASS_BOARD_H
class ZONE_CONTAINER;
class EDA_BoardDesignSettings;
/***********************************************/
/* class BOARD : handle datas to build a board */
/***********************************************/
class BOARD : public BOARD_ITEM
{
friend class WinEDA_PcbFrame;
private:
std::vector<MARKER*> m_markers; ///< MARKERs for clearance problems, owned by pointer
// std::vector<MARKER*> m_markersUnconnected; ///< MARKERs for unconnected problems, owned by pointer
std::vector<ZONE_CONTAINER*> m_ZoneDescriptorList; ///< edge zone descriptors, owned by pointer
public:
WinEDA_BasePcbFrame* m_PcbFrame; // Window de visualisation
EDA_Rect m_BoundaryBox; // Board size and position
int m_Unused;
int m_Status_Pcb; // Flags used in ratsnet calculation and update
EDA_BoardDesignSettings* m_BoardSettings; // Link to current design settings
int m_NbNets; // Nets (equipotentielles) count
int m_NbNodes; // Active pads (pads attached to a net ) count
int m_NbLinks; // Ratsnet count
int m_NbLoclinks; // Rastests to shew while creating a track
int m_NbNoconnect; // Active ratsnet count (rastnest not alraedy connected by tracks
int m_NbSegmTrack; // Track items count
int m_NbSegmZone; // Zone items count
BOARD_ITEM* m_Drawings; // linked list of lines & texts
MODULE* m_Modules; // linked list of MODULEs
EQUIPOT* m_Equipots; // linked list of nets
TRACK* m_Track; // linked list of TRACKs and SEGVIAs
SEGZONE* m_Zone; // linked list of SEGZONEs
D_PAD** m_Pads; // Entry for a sorted pad list (used in ratsnest calculations)
int m_NbPads; // Pad count
CHEVELU* m_Ratsnest; // Rastnest list
CHEVELU* m_LocalRatsnest; // Rastnest list used while moving a footprint
EDGE_ZONE* m_CurrentLimitZone; /* pointeur sur la liste des segments
* de delimitation de la zone en cours de trace */
BOARD( EDA_BaseStruct* StructFather, WinEDA_BasePcbFrame* frame );
~BOARD();
/**
* Function GetPosition
* is here to satisfy BOARD_ITEM's requirements, but this implementation
* is a dummy.
* @return const wxPoint& of (0,0)
*/
wxPoint& GetPosition();
/* supprime du chainage la structure Struct */
void UnLink();
/**
* Function Add
* adds the given item to this BOARD and takes ownership of its memory.
* @param aBoardItem The item to add to this board.
* @param aControl An int which can vary how the item is added.
*/
void Add( BOARD_ITEM* aBoardItem, int aControl = 0 );
/**
* Function Delete
* deletes the given single item from this BOARD and deletes its memory. If you
* need the object after deletion, first copy it.
* @param aBoardItem The item to remove from this board and delete
*/
void Delete( BOARD_ITEM* aBoardItem );
/**
* Function DeleteMARKERs
* deletes ALL MARKERS from the board.
*/
void DeleteMARKERs();
/**
* Function DeleteMARKER
* deletes one MARKER from the board.
* @param aIndex The index of the marker to delete.
*/
void DeleteMARKER( int aIndex );
/**
* Function GetMARKER
* returns the MARKER at a given index.
* @param index The array type index into a collection of MARKERS.
* @return MARKER* - a pointer to the MARKER or NULL if index out of range.
*/
MARKER* GetMARKER( int index ) const
{
if( (unsigned) index < m_markers.size() )
return m_markers[index];
return NULL;
}
/**
* Function GetMARKERCount
* @return int - The number of MARKERS.
*/
int GetMARKERCount() const
{
return (int) m_markers.size();
}
/* Routines de calcul des nombres de segments pistes et zones */
int GetNumSegmTrack();
int GetNumSegmZone();
int GetNumNoconnect(); // retourne le nombre de connexions manquantes
/**
* Function GetNumRatsnests
* @return int - The number of rats
*/
int GetNumRatsnests()
{
return m_NbLinks;
}
int GetNumNodes(); // retourne le nombre de pads a netcode > 0
// Calcul du rectangle d'encadrement:
bool ComputeBoundaryBox();
/**
* 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 );
/**
* 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.
* @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[] );
/**
* Function FindNet
* searches for a net with the given netcode.
* @param aNetcode A netcode to search for.
* @return EQUIPOT* - the net or NULL if not found.
*/
EQUIPOT* FindNet( int aNetcode ) const;
/**
* 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.
*/
bool Save( FILE* aFile ) const;
/**
* Function GetClass
* returns the class name.
* @return wxString
*/
wxString GetClass() const
{
return wxT( "BOARD" );
}
#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 Show( int nestLevel, std::ostream& os );
#endif
};
#endif // #ifndef CLASS_BOARD_H
/*************************************************/
/* class_drc_item.cpp - DRC_ITEM class functions */
/*************************************************/
#include "fctsys.h"
#include "common.h"
#include "pcbnew.h"
wxString DRC_ITEM::GetErrorText() const
{
switch( m_ErrorCode )
{
// case DRCE_: not assigned yet
case DRCE_UNCONNECTED_PADS:
return wxString( _("Unconnected pads") );
case DRCE_TRACK_NEAR_THROUGH_HOLE:
return wxString( _("Track near thru-hole") );
case DRCE_TRACK_NEAR_PAD:
return wxString( _("Track near pad") );
case DRCE_TRACK_NEAR_VIA:
return wxString( _("Track near via") );
case DRCE_VIA_NEAR_VIA:
return wxString( _("Via near via") );
case DRCE_VIA_NEAR_TRACK:
return wxString( _("Via near track") );
case DRCE_TRACK_ENDS1:
case DRCE_TRACK_ENDS2:
case DRCE_TRACK_ENDS3:
case DRCE_TRACK_ENDS4:
case DRCE_ENDS_PROBLEM1:
case DRCE_ENDS_PROBLEM2:
case DRCE_ENDS_PROBLEM3:
case DRCE_ENDS_PROBLEM4:
case DRCE_ENDS_PROBLEM5:
return wxString( _("Two track ends") );
case DRCE_TRACK_UNKNOWN1:
return wxString( _("This looks bad") ); ///< @todo check source code and change this comment
case DRCE_TRACKS_CROSSING:
return wxString( _("Tracks crossing") );
case DRCE_PAD_NEAR_PAD1:
return wxString( _("Pad near pad") );
case DRCE_VIA_HOLE_BIGGER:
return wxString( _("Via hole > diameter"));
default:
return wxString( wxT("PROGRAM BUG, PLEASE LEAVE THE ROOM.") );
}
}
wxString DRC_ITEM::ShowCoord( const wxPoint& aPos )
{
wxString temp;
wxString ret;
ret << wxT("@(") << valeur_param( aPos.x, temp );
ret << wxT(",") << valeur_param( aPos.y, temp );
ret << wxT(")");
return ret;
}
/**********************************/
/* classes to handle copper zones */
/**********************************/
#include "fctsys.h"
#include "wxstruct.h"
#include "gr_basic.h"
#include "common.h"
#include "pcbnew.h"
/************************/
/* class ZONE_CONTAINER */
/************************/
ZONE_CONTAINER::ZONE_CONTAINER (BOARD * parent):
BOARD_ITEM (parent, TYPEZONE_CONTAINER)
{
m_NetCode = -1; // Net number for fast comparisons
}
ZONE_CONTAINER::~ZONE_CONTAINER()
{
}
bool ZONE_CONTAINER::Save( FILE* aFile ) const
{
return true;
}
/**********************/
/* Class EDGE_ZONE */
/**********************/
/* Constructor */
EDGE_ZONE::EDGE_ZONE( BOARD_ITEM* parent ) :
DRAWSEGMENT( parent, TYPEEDGEZONE )
{
m_Width = 2; // a minimum for visibility, while dragging
}
/* Destructor */
EDGE_ZONE:: ~EDGE_ZONE()
{
}
bool EDGE_ZONE::Save( FILE* aFile ) const
{
if( GetState( DELETED ) )
return true;
int ret = fprintf( aFile, "ZE %d %d %d %d %d %lX %X\n",
m_Start.x, m_Start.y,
m_End.x, m_End.y,
m_Angle,
m_TimeStamp,
ReturnStatus()
);
return (ret > 14 );
}
/**********************************/
/* classes to handle copper zones */
/**********************************/
#ifndef CLASS_ZONE_H
#define CLASS_ZONE_H
/************************/
/* class ZONE_CONTAINER */
/************************/
/* handle a list of polygons delimiting a copper zone
* a zone is described by a main polygon, a time stamp, a layer and a net name.
* others polygons inside this main polygon are holes.
*/
class ZONE_CONTAINER : public BOARD_ITEM // Not sure BOARD_ITEM is better than EDA_BaseStruct
{
public:
wxString m_Netname; /* Net Name */
private:
int m_NetCode; // Net number for fast comparisons
public:
ZONE_CONTAINER(BOARD * parent);
~ZONE_CONTAINER();
bool Save( FILE* aFile ) const;
};
/*******************/
/* class EDGE_ZONE */
/*******************/
class EDGE_ZONE : public DRAWSEGMENT
{
public:
EDGE_ZONE( BOARD_ITEM* StructFather );
EDGE_ZONE( const EDGE_ZONE& edgezone );
~EDGE_ZONE();
EDGE_ZONE* Next() { return (EDGE_ZONE*) Pnext; }
EDGE_ZONE* Back() { return (EDGE_ZONE*) Pback; }
/**
* 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.
*/
bool Save( FILE* aFile ) const;
};
#endif // #ifndef CLASS_ZONE_H
...@@ -30,41 +30,6 @@ void EDA_BaseStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC ) ...@@ -30,41 +30,6 @@ void EDA_BaseStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
} }
/**********************/
/* Classe EDGE_ZONE */
/**********************/
/* Classe EDGE_ZONE: constructeur */
EDGE_ZONE::EDGE_ZONE( BOARD_ITEM* parent ) :
DRAWSEGMENT( parent, TYPEEDGEZONE )
{
m_Width = 2; // a minimum for visibility, while dragging
}
/* Effacement memoire de la structure */
EDGE_ZONE:: ~EDGE_ZONE()
{
}
bool EDGE_ZONE::Save( FILE* aFile ) const
{
if( GetState( DELETED ) )
return true;
int ret = fprintf( aFile, "ZE %d %d %d %d %d %lX %X\n",
m_Start.x, m_Start.y,
m_End.x, m_End.y,
m_Angle,
m_TimeStamp,
ReturnStatus()
);
return (ret > 14 );
}
/**********************/ /**********************/
/* Classe DRAWSEGMENT */ /* Classe DRAWSEGMENT */
/**********************/ /**********************/
......
...@@ -34,7 +34,9 @@ OBJECTS= $(TARGET).o classpcb.o\ ...@@ -34,7 +34,9 @@ OBJECTS= $(TARGET).o classpcb.o\
class_text_mod.o\ class_text_mod.o\
class_pcb_text.o\ class_pcb_text.o\
class_board_item.o\ class_board_item.o\
class_drc_item.o\
class_board.o\ class_board.o\
class_zone.o\
drawframe.o\ drawframe.o\
drawpanel.o\ drawpanel.o\
track.o \ track.o \
......
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