Commit 143d0790 authored by dickelbeck's avatar dickelbeck
Browse files

added ZONE_CONTAINER::GetClass() and beautified

parent 9da29ee2
Loading
Loading
Loading
Loading
+167 −117
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@
/************************/
/* 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.
@@ -23,6 +24,7 @@ public:
        THERMAL_PAD,                // Use thermal relief for pads
        PAD_IN_ZONE                 // pads are covered by copper
    };
    
    wxString    m_Netname;          // Net Name
    CPolyLine*  m_Poly;             // outlines
    int         m_CornerSelection;  // For corner moving, corner index to drag, or -1 if no selection
@@ -41,10 +43,18 @@ public:
    bool    Save( FILE* aFile ) const;
    int     ReadDescr( FILE* aFile, int* aLineNum = NULL );

	wxPoint & GetPosition( ) { static wxPoint pos ;return pos; }
	void UnLink(void) {};
    wxPoint& GetPosition()
    {
        static wxPoint pos; 
        return pos;
    }

	/** Function copy
    void UnLink( void )
    {
    };

    /** 
     * Function copy
     * copy usefull data from the source.
     * flags and linked list pointers are NOT copied
     */
@@ -52,7 +62,8 @@ public:

    void    Display_Infos( WinEDA_DrawFrame* frame );

	/** Function Draw
    /**
     * Function Draw
     * Draws the zone outline.
     * @param panel = current Draw Panel
     * @param DC = current Device Context
@@ -62,8 +73,12 @@ public:
    void    Draw( WinEDA_DrawPanel* panel, wxDC* DC,
                  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 );

    /**
     * Function HitTest
     * tests if the given wxPoint is within the bounds of this object.
@@ -79,6 +94,7 @@ public:
     * @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.
@@ -95,7 +111,8 @@ public:
     */
    bool    HitTest( EDA_Rect& refArea );

	/** Function Fill_Zone()
    /**
     * Function Fill_Zone()
     * Calculate the zone filling
     * The zone outline is a frontier, and can be complex (with holes)
     * The filling starts from starting points like pads, tracks.
@@ -108,6 +125,7 @@ public:
    int     Fill_Zone( WinEDA_PcbFrame* frame, wxDC* DC, bool verbose = TRUE );

    /* Geometric transformations: */

    /**
     * Function Move
     * Move the outlines
@@ -123,7 +141,6 @@ public:
     */
    void    Rotate( const wxPoint& centre, int angle );

	
    /**
     * Function Mirror
     * Mirror the outlines , relative to a given horizontal axis
@@ -132,11 +149,22 @@ public:
     */
    void    Mirror( const wxPoint& mirror_ref );
    
    /**
     * Function GetClass
     * returns the class name.
     * @return wxString
     */
    wxString GetClass() const
    {
        return wxT( "ZONE_CONTAINER" );
    }
};


/*******************/
/* class EDGE_ZONE */
/*******************/

/* Classe used temporary to create a zone outline.
 *
 * TODO: remove this class and use only the ZONE_CONTAINER::m_Poly
@@ -152,12 +180,24 @@ public:

    ~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; }
	void SetNet( int anet_code ) { m_NetCode = anet_code; }
    int GetNet( void ) const
    {
        return m_NetCode;
    }
    void SetNet( int anet_code )
    {
        m_NetCode = anet_code;
    }

    /**
     * Function Display_Infos
@@ -175,6 +215,16 @@ public:
     * @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( "EDGE_ZONE" );
    }
};

#endif  // #ifndef CLASS_ZONE_H