|
|
|
@ -9,6 +9,20 @@ |
|
|
|
#include "gr_basic.h" |
|
|
|
#include "PolyLine.h" |
|
|
|
|
|
|
|
/* a small class used when filling areas with segments */ |
|
|
|
class SEGMENT |
|
|
|
{ |
|
|
|
public: |
|
|
|
wxPoint m_Start; // starting point of a segment |
|
|
|
wxPoint m_End; // ending point of a segment |
|
|
|
public: |
|
|
|
SEGMENT() {} |
|
|
|
SEGMENT( const wxPoint & aStart, const wxPoint & aEnd) |
|
|
|
{ |
|
|
|
m_Start = aStart; |
|
|
|
m_End = aEnd; |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
/************************/ |
|
|
|
/* class ZONE_CONTAINER */ |
|
|
|
@ -33,28 +47,32 @@ public: |
|
|
|
int m_ThermalReliefGapValue; // tickness of the gap in thermal reliefs |
|
|
|
int m_ThermalReliefCopperBridgeValue; // tickness of the copper bridge in thermal reliefs |
|
|
|
int utility, utility2; // flags used in polygon calculations |
|
|
|
bool m_IsFilled; // true when a zone was filled, false after deleting the filled areas |
|
|
|
std::vector <CPolyPt> m_FilledPolysList; /* set of filled polygons used to draw a zone as a filled area. |
|
|
|
* from outlines (m_Poly) but unlike m_Poly these filled polygons have no hole (they are all in one piece) |
|
|
|
* In very simple cases m_FilledPolysList is same as m_Poly |
|
|
|
* In less simple cases (when m_Poly has holes) m_FilledPolysList is a polygon equivalent to m_Poly, without holes |
|
|
|
* In complex cases an ouline decribed by m_Poly can have many filled areas |
|
|
|
*/ |
|
|
|
int m_Unused; /* waiting for use */ |
|
|
|
std::vector <SEGMENT> m_FillSegmList; /* set of segments used to fill area, when fill zone by segment is used. |
|
|
|
* ( m_FillMode == 1 ) |
|
|
|
* in this case segments have m_ZoneMinThickness width |
|
|
|
*/ |
|
|
|
|
|
|
|
private: |
|
|
|
int m_NetCode; // Net number for fast comparisons |
|
|
|
int m_ZoneSubnet; // variable used in rastnest computations:handle block number in zone connection calculations |
|
|
|
int m_NetCode; // Net number for fast comparisons |
|
|
|
int m_ZoneSubnet; // variable used in rastnest computations:handle block number in zone connection calculations |
|
|
|
|
|
|
|
public: |
|
|
|
ZONE_CONTAINER( BOARD* parent ); |
|
|
|
~ZONE_CONTAINER(); |
|
|
|
|
|
|
|
bool Save( FILE* aFile ) const; |
|
|
|
int ReadDescr( FILE* aFile, int* aLineNum = NULL ); |
|
|
|
bool Save( FILE* aFile ) const; |
|
|
|
int ReadDescr( FILE* aFile, int* aLineNum = NULL ); |
|
|
|
|
|
|
|
/** virtual function GetPosition |
|
|
|
* @return a wxPoint, position of the first point of the outline |
|
|
|
*/ |
|
|
|
* @return a wxPoint, position of the first point of the outline |
|
|
|
*/ |
|
|
|
wxPoint& GetPosition(); |
|
|
|
|
|
|
|
|
|
|
|
@ -63,9 +81,9 @@ public: |
|
|
|
* copy usefull data from the source. |
|
|
|
* flags and linked list pointers are NOT copied |
|
|
|
*/ |
|
|
|
void Copy( ZONE_CONTAINER* src ); |
|
|
|
void Copy( ZONE_CONTAINER* src ); |
|
|
|
|
|
|
|
void DisplayInfo( WinEDA_DrawFrame* frame ); |
|
|
|
void DisplayInfo( WinEDA_DrawFrame* frame ); |
|
|
|
|
|
|
|
/** |
|
|
|
* Function Draw |
|
|
|
@ -75,10 +93,10 @@ public: |
|
|
|
* @param offset = Draw offset (usually wxPoint(0,0)) |
|
|
|
* @param aDrawMode = GR_OR, GR_XOR, GR_COPY .. |
|
|
|
*/ |
|
|
|
void Draw( WinEDA_DrawPanel* panel, |
|
|
|
wxDC* DC, |
|
|
|
int aDrawMode, |
|
|
|
const wxPoint& offset = ZeroOffset ); |
|
|
|
void Draw( WinEDA_DrawPanel* panel, |
|
|
|
wxDC* DC, |
|
|
|
int aDrawMode, |
|
|
|
const wxPoint& offset = ZeroOffset ); |
|
|
|
|
|
|
|
/** |
|
|
|
* Function DrawDrawFilledArea |
|
|
|
@ -88,10 +106,10 @@ public: |
|
|
|
* @param offset = Draw offset (usually wxPoint(0,0)) |
|
|
|
* @param aDrawMode = GR_OR, GR_XOR, GR_COPY .. |
|
|
|
*/ |
|
|
|
void DrawFilledArea( WinEDA_DrawPanel* panel, |
|
|
|
wxDC* DC, |
|
|
|
int aDrawMode, |
|
|
|
const wxPoint& offset = ZeroOffset ); |
|
|
|
void DrawFilledArea( WinEDA_DrawPanel* panel, |
|
|
|
wxDC* DC, |
|
|
|
int aDrawMode, |
|
|
|
const wxPoint& offset = ZeroOffset ); |
|
|
|
|
|
|
|
/** |
|
|
|
* Function DrawWhileCreateOutline |
|
|
|
@ -115,7 +133,7 @@ public: |
|
|
|
* Remove insulated copper islands found in m_FilledPolysList. |
|
|
|
* @param aPcb = the board to analyse |
|
|
|
*/ |
|
|
|
void Test_For_Copper_Island_And_Remove_Insulated_Islands( BOARD* aPcb ); |
|
|
|
void Test_For_Copper_Island_And_Remove_Insulated_Islands( BOARD* aPcb ); |
|
|
|
|
|
|
|
/** function CalculateSubAreaBoundaryBox |
|
|
|
* Calculates the bounding box of a a filled area ( list of CPolyPt ) |
|
|
|
@ -156,7 +174,7 @@ public: |
|
|
|
* Fin the nat name corresponding to the net code. |
|
|
|
* @return bool - true if net found, else false |
|
|
|
*/ |
|
|
|
bool SetNetNameFromNetCode( void); |
|
|
|
bool SetNetNameFromNetCode( void ); |
|
|
|
|
|
|
|
/** |
|
|
|
* Function HitTest |
|
|
|
@ -173,7 +191,7 @@ public: |
|
|
|
* @param aRefPos A wxPoint to test |
|
|
|
* @return bool - true if a hit, else false |
|
|
|
*/ |
|
|
|
bool HitTestFilledArea( const wxPoint& aRefPos ); |
|
|
|
bool HitTestFilledArea( const wxPoint& aRefPos ); |
|
|
|
|
|
|
|
/** function BuildFilledPolysListData |
|
|
|
* Build m_FilledPolysList data from real outlines (m_Poly) |
|
|
|
@ -202,18 +220,19 @@ public: |
|
|
|
* Copy (Add) polygons created by kbool (after Do_Operation) to m_FilledPolysList |
|
|
|
* @param aBoolengine = the kbool engine used in Do_Operation |
|
|
|
* @return the corner count |
|
|
|
*/ |
|
|
|
int CopyPolygonsFromBoolengineToFilledPolysList( Bool_Engine* aBoolengine ); |
|
|
|
*/ |
|
|
|
int CopyPolygonsFromBoolengineToFilledPolysList( Bool_Engine* aBoolengine ); |
|
|
|
|
|
|
|
/** Function CopyPolygonsFromFilledPolysListToBoolengine |
|
|
|
* Copy (Add) polygons created by kbool (after Do_Operation) to m_FilledPolysList |
|
|
|
* @param aBoolengine = kbool engine |
|
|
|
* @param aGroup = group in kbool engine (GROUP_A or GROUP_B only) |
|
|
|
* @return the corner count |
|
|
|
*/ |
|
|
|
int CopyPolygonsFromFilledPolysListToBoolengine( Bool_Engine* aBoolengine, GroupType aGroup = GROUP_A); |
|
|
|
*/ |
|
|
|
int CopyPolygonsFromFilledPolysListToBoolengine( Bool_Engine* aBoolengine, |
|
|
|
GroupType aGroup = GROUP_A ); |
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 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> |
|
|
|
@ -258,7 +277,7 @@ public: |
|
|
|
* @param aFrame = reference to the main frame |
|
|
|
* @return number of segments created |
|
|
|
*/ |
|
|
|
int Fill_Zone_Areas_With_Segments( WinEDA_PcbFrame* aFrame ); |
|
|
|
int Fill_Zone_Areas_With_Segments( ); |
|
|
|
|
|
|
|
|
|
|
|
/* Geometric transformations: */ |
|
|
|
@ -268,14 +287,14 @@ public: |
|
|
|
* Move the outlines |
|
|
|
* @param offset = moving vector |
|
|
|
*/ |
|
|
|
void Move( const wxPoint& offset ); |
|
|
|
void Move( const wxPoint& offset ); |
|
|
|
|
|
|
|
/** |
|
|
|
* Function MoveEdge |
|
|
|
* Move the outline Edge. m_CornerSelection is the start point of the outline edge |
|
|
|
* @param offset = moving vector |
|
|
|
*/ |
|
|
|
void MoveEdge( const wxPoint& offset ); |
|
|
|
void MoveEdge( const wxPoint& offset ); |
|
|
|
|
|
|
|
/** |
|
|
|
* Function Rotate |
|
|
|
@ -283,7 +302,7 @@ public: |
|
|
|
* @param centre = rot centre |
|
|
|
* @param angle = in 0.1 degree |
|
|
|
*/ |
|
|
|
void Rotate( const wxPoint& centre, int angle ); |
|
|
|
void Rotate( const wxPoint& centre, int angle ); |
|
|
|
|
|
|
|
/** |
|
|
|
* Function Flip |
|
|
|
@ -291,7 +310,7 @@ public: |
|
|
|
* (like Mirror() but changes layer) |
|
|
|
* @param const wxPoint& aCentre - the rotation point. |
|
|
|
*/ |
|
|
|
virtual void Flip(const wxPoint& aCentre ); |
|
|
|
virtual void Flip( const wxPoint& aCentre ); |
|
|
|
|
|
|
|
/** |
|
|
|
* Function Mirror |
|
|
|
@ -299,7 +318,7 @@ public: |
|
|
|
* 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 |
|
|
|
@ -345,6 +364,7 @@ public: |
|
|
|
m_Poly->AppendCorner( position.x, position.y ); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
int GetHatchStyle() const |
|
|
|
{ |
|
|
|
return m_Poly->GetHatchStyle(); |
|
|
|
|