Commit 143d0790 authored by dickelbeck's avatar dickelbeck

added ZONE_CONTAINER::GetClass() and beautified

parent 9da29ee2
...@@ -10,83 +10,99 @@ ...@@ -10,83 +10,99 @@
/************************/ /************************/
/* 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
{ {
public: public:
enum m_PadInZone { // How pads are covered by copper in zone enum m_PadInZone { // How pads are covered by copper in zone
PAD_NOT_IN_ZONE, // Pads are not covered PAD_NOT_IN_ZONE, // Pads are not covered
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
CPolyLine * m_Poly; // outlines wxString m_Netname; // Net Name
int m_CornerSelection; // For corner moving, corner index to drag, or -1 if no selection CPolyLine* m_Poly; // outlines
int m_ZoneClearance; // clearance value int m_CornerSelection; // For corner moving, corner index to drag, or -1 if no selection
int m_GridFillValue; // Grid used for filling int m_ZoneClearance; // clearance value
m_PadInZone m_PadOption; // see m_PadInZone int m_GridFillValue; // Grid used for filling
int utility, utility2; // flags used in polygon calculations m_PadInZone m_PadOption; // see m_PadInZone
int utility, utility2; // flags used in polygon calculations
private: 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;
/** Function copy return pos;
* copy usefull data from the source. }
* flags and linked list pointers are NOT copied
*/ void UnLink( void )
void Copy( ZONE_CONTAINER * src ); {
};
void Display_Infos( WinEDA_DrawFrame* frame );
/**
/** Function Draw * Function copy
* Draws the zone outline. * copy usefull data from the source.
* @param panel = current Draw Panel * flags and linked list pointers are NOT copied
* @param DC = current Device Context */
* @param offset = Draw offset (usually wxPoint(0,0)) void Copy( ZONE_CONTAINER* src );
* @param draw_mode = draw mode: OR, XOR ..
*/ void Display_Infos( WinEDA_DrawFrame* frame );
void Draw( WinEDA_DrawPanel* panel, wxDC* DC,
const wxPoint& offset, int draw_mode ); /**
* Function Draw
int GetNet( void ) const { return m_NetCode; } * Draws the zone outline.
void SetNet( int anet_code ); * @param panel = current Draw Panel
/** * @param DC = current Device Context
* Function HitTest * @param offset = Draw offset (usually wxPoint(0,0))
* tests if the given wxPoint is within the bounds of this object. * @param draw_mode = draw mode: OR, XOR ..
* @param refPos A wxPoint to test */
* @return bool - true if a hit, else false void Draw( WinEDA_DrawPanel* panel, wxDC* DC,
*/ const wxPoint& offset, int draw_mode );
bool HitTest( const wxPoint& refPos );
int GetNet( void ) const
/** {
* Function HitTestForCorner return m_NetCode;
* tests if the given wxPoint near a corner, or near the segment define by 2 corners. }
* @return -1 if none, corner index in .corner <vector> void SetNet( int anet_code );
* @param refPos : A wxPoint to test
*/ /**
int HitTestForCorner( const wxPoint& refPos ); * Function HitTest
/** * tests if the given wxPoint is within the bounds of this object.
* Function HitTestForEdge * @param refPos A wxPoint to test
* tests if the given wxPoint near a corner, or near the segment define by 2 corners. * @return bool - true if a hit, else false
* @return -1 if none, or index of the starting corner in .corner <vector> */
* @param refPos : A wxPoint to test bool HitTest( const wxPoint& refPos );
*/
int HitTestForEdge( const wxPoint& refPos ); /**
* Function HitTestForCorner
* tests if the given wxPoint near a corner, or near the segment define by 2 corners.
* @return -1 if none, corner index in .corner <vector>
* @param refPos : A wxPoint to test
*/
int HitTestForCorner( const wxPoint& refPos );
/**
* Function HitTestForEdge
* tests if the given wxPoint near a corner, or near the segment define by 2 corners.
* @return -1 if none, or index of the starting corner in .corner <vector>
* @param refPos : A wxPoint to test
*/
int HitTestForEdge( const wxPoint& refPos );
/** /**
* Function HitTest (overlayed) * Function HitTest (overlayed)
* tests if the given EDA_Rect contains the bounds of this object. * tests if the given EDA_Rect contains the bounds of this object.
...@@ -95,70 +111,94 @@ public: ...@@ -95,70 +111,94 @@ public:
*/ */
bool HitTest( EDA_Rect& refArea ); bool HitTest( EDA_Rect& refArea );
/** Function Fill_Zone() /**
* Calculate the zone filling * Function Fill_Zone()
* The zone outline is a frontier, and can be complex (with holes) * Calculate the zone filling
* The filling starts from starting points like pads, tracks. * The zone outline is a frontier, and can be complex (with holes)
* If exists the old filling is removed * The filling starts from starting points like pads, tracks.
* @param frame = reference to the main frame * If exists the old filling is removed
* @param DC = current Device Context * @param frame = reference to the main frame
* @param verbose = true to show error messages * @param DC = current Device Context
* @return error level (0 = no error) * @param verbose = true to show error messages
*/ * @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
* Move the outlines /**
* @param offset = moving vector * Function Move
*/ * Move the outlines
void Move(const wxPoint& offset ); * @param offset = moving vector
*/
/** void Move( const wxPoint& offset );
* Function Move
* Move the outlines /**
* @param centre = rot centre * Function Move
* @param angle = in 0.1 degree * Move the outlines
*/ * @param centre = rot centre
void Rotate( const wxPoint& centre, int angle); * @param angle = in 0.1 degree
*/
void Rotate( const wxPoint& centre, int angle );
/**
* Function Mirror /**
* Mirror the outlines , relative to a given horizontal axis * Function Mirror
* the layer is not changed * Mirror the outlines , relative to a given horizontal axis
* @param mirror_ref = vertical axis position * the layer is not changed
*/ * @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:
int m_NetCode; int m_NetCode;
public: public:
EDGE_ZONE( BOARD * StructFather ); EDGE_ZONE( BOARD * StructFather );
~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;
}
int GetNet( void ) const
{
return m_NetCode;
}
void SetNet( int anet_code )
{
m_NetCode = anet_code;
}
EDGE_ZONE* Back() { return (EDGE_ZONE*) Pback; }
int GetNet( void ) const { return m_NetCode; }
void SetNet( int anet_code ) { m_NetCode = anet_code; }
/** /**
* Function Display_Infos * Function Display_Infos
* has knowledge about the frame and how and where to put status information * has knowledge about the frame and how and where to put status information
...@@ -173,8 +213,18 @@ public: ...@@ -173,8 +213,18 @@ public:
* writes the data structures for this object out to a FILE in "*.brd" format. * writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to. * @param aFile The FILE to write to.
* @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
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