added ZONE_CONTAINER::GetClass() and beautified

This commit is contained in:
dickelbeck 2008-01-23 22:39:09 +00:00
parent 9da29ee2e2
commit 143d07903a
1 changed files with 160 additions and 110 deletions

View File

@ -10,10 +10,11 @@
/************************/ /************************/
/* class ZONE_CONTAINER */ /* class ZONE_CONTAINER */
/************************/ /************************/
/* handle a list of polygons delimiting a copper zone /* 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. * 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. * others polygons inside this main polygon are holes.
*/ */
class ZONE_CONTAINER : public BOARD_ITEM class ZONE_CONTAINER : public BOARD_ITEM
{ {
@ -23,8 +24,9 @@ public:
THERMAL_PAD, // Use thermal relief for pads THERMAL_PAD, // Use thermal relief for pads
PAD_IN_ZONE // pads are covered by copper PAD_IN_ZONE // pads are covered by copper
}; };
wxString m_Netname; // Net Name wxString m_Netname; // Net Name
CPolyLine * m_Poly; // outlines CPolyLine* m_Poly; // outlines
int m_CornerSelection; // For corner moving, corner index to drag, or -1 if no selection int m_CornerSelection; // For corner moving, corner index to drag, or -1 if no selection
int m_ZoneClearance; // clearance value int m_ZoneClearance; // clearance value
int m_GridFillValue; // Grid used for filling int m_GridFillValue; // Grid used for filling
@ -35,24 +37,33 @@ private:
int m_NetCode; // Net number for fast comparisons int m_NetCode; // Net number for fast comparisons
public: public:
ZONE_CONTAINER(BOARD * parent); ZONE_CONTAINER( BOARD * parent );
~ZONE_CONTAINER(); ~ZONE_CONTAINER();
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
int ReadDescr( FILE* aFile, int* aLineNum = NULL ); int ReadDescr( FILE* aFile, int* aLineNum = NULL );
wxPoint & GetPosition( ) { static wxPoint pos ;return pos; } wxPoint& GetPosition()
void UnLink(void) {}; {
static wxPoint pos;
return pos;
}
/** Function copy void UnLink( void )
{
};
/**
* Function copy
* copy usefull data from the source. * copy usefull data from the source.
* flags and linked list pointers are NOT copied * flags and linked list pointers are NOT copied
*/ */
void Copy( ZONE_CONTAINER * src ); void Copy( ZONE_CONTAINER* src );
void Display_Infos( WinEDA_DrawFrame* frame ); void Display_Infos( WinEDA_DrawFrame* frame );
/** Function Draw /**
* Function Draw
* Draws the zone outline. * Draws the zone outline.
* @param panel = current Draw Panel * @param panel = current Draw Panel
* @param DC = current Device Context * @param DC = current Device Context
@ -62,8 +73,12 @@ public:
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 );
int GetNet( void ) const { return m_NetCode; } int GetNet( void ) const
{
return m_NetCode;
}
void SetNet( int anet_code ); void SetNet( int anet_code );
/** /**
* Function HitTest * Function HitTest
* tests if the given wxPoint is within the bounds of this object. * tests if the given wxPoint is within the bounds of this object.
@ -79,6 +94,7 @@ public:
* @param refPos : A wxPoint to test * @param refPos : A wxPoint to test
*/ */
int HitTestForCorner( const wxPoint& refPos ); int HitTestForCorner( const wxPoint& refPos );
/** /**
* Function HitTestForEdge * Function HitTestForEdge
* tests if the given wxPoint near a corner, or near the segment define by 2 corners. * tests if the given wxPoint near a corner, or near the segment define by 2 corners.
@ -95,7 +111,8 @@ public:
*/ */
bool HitTest( EDA_Rect& refArea ); bool HitTest( EDA_Rect& refArea );
/** Function Fill_Zone() /**
* Function Fill_Zone()
* Calculate the zone filling * Calculate the zone filling
* The zone outline is a frontier, and can be complex (with holes) * The zone outline is a frontier, and can be complex (with holes)
* The filling starts from starting points like pads, tracks. * The filling starts from starting points like pads, tracks.
@ -105,15 +122,16 @@ public:
* @param verbose = true to show error messages * @param verbose = true to show error messages
* @return error level (0 = no error) * @return error level (0 = no error)
*/ */
int Fill_Zone( WinEDA_PcbFrame* frame, wxDC* DC, bool verbose = TRUE); int Fill_Zone( WinEDA_PcbFrame* frame, wxDC* DC, bool verbose = TRUE );
/* Geometric transformations: */ /* Geometric transformations: */
/** /**
* Function Move * Function Move
* Move the outlines * Move the outlines
* @param offset = moving vector * @param offset = moving vector
*/ */
void Move(const wxPoint& offset ); void Move( const wxPoint& offset );
/** /**
* Function Move * Function Move
@ -121,8 +139,7 @@ public:
* @param centre = rot centre * @param centre = rot centre
* @param angle = in 0.1 degree * @param angle = in 0.1 degree
*/ */
void Rotate( const wxPoint& centre, int angle); void Rotate( const wxPoint& centre, int angle );
/** /**
* Function Mirror * Function Mirror
@ -130,18 +147,29 @@ public:
* the layer is not changed * the layer is not changed
* @param mirror_ref = vertical axis position * @param mirror_ref = vertical axis position
*/ */
void Mirror( const wxPoint& mirror_ref); void Mirror( const wxPoint& mirror_ref );
/**
* Function GetClass
* returns the class name.
* @return wxString
*/
wxString GetClass() const
{
return wxT( "ZONE_CONTAINER" );
}
}; };
/*******************/ /*******************/
/* class EDGE_ZONE */ /* class EDGE_ZONE */
/*******************/ /*******************/
/* Classe used temporary to create a zone outline. /* Classe used temporary to create a zone outline.
* *
* TODO: remove this class and use only the ZONE_CONTAINER::m_Poly * TODO: remove this class and use only the ZONE_CONTAINER::m_Poly
* to create outlines * to create outlines
*/ */
class EDGE_ZONE : public DRAWSEGMENT class EDGE_ZONE : public DRAWSEGMENT
{ {
private: private:
@ -152,12 +180,24 @@ public:
~EDGE_ZONE(); ~EDGE_ZONE();
EDGE_ZONE* Next() { return (EDGE_ZONE*) Pnext; } EDGE_ZONE* Next()
{
return (EDGE_ZONE*) Pnext;
}
EDGE_ZONE* Back() { return (EDGE_ZONE*) Pback; } EDGE_ZONE* Back()
{
return (EDGE_ZONE*) Pback;
}
int GetNet( void ) const { return m_NetCode; } int GetNet( void ) const
void SetNet( int anet_code ) { m_NetCode = anet_code; } {
return m_NetCode;
}
void SetNet( int anet_code )
{
m_NetCode = anet_code;
}
/** /**
* Function Display_Infos * Function Display_Infos
@ -175,6 +215,16 @@ public:
* @return bool - true if success writing else false. * @return bool - true if success writing else false.
*/ */
bool Save( FILE* aFile ) const; bool Save( FILE* aFile ) const;
/**
* Function GetClass
* returns the class name.
* @return wxString
*/
wxString GetClass() const
{
return wxT( "EDGE_ZONE" );
}
}; };
#endif // #ifndef CLASS_ZONE_H #endif // #ifndef CLASS_ZONE_H