pcbnew: addded zones in non copper areas and starting work to use polygons in zone fill algos in not copper areas

work in progress: see changelog
This commit is contained in:
charras 2008-09-26 19:51:36 +00:00
parent 064fcf5491
commit 27cf4ad0ad
27 changed files with 2633 additions and 1481 deletions

View File

@ -5,6 +5,18 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2008-Sep-26 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+pcbnew:
Starting work to use polygons in zone fill algos.
Currently, use this to add zone on non copper layers (technical layers)
Only for eyes.
Plot outputs do not handle this.
Problems with holes in zones.
Also: first used of wxFormBuilder
2008-Sep-17 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+pcbnew:

View File

@ -727,42 +727,41 @@ wxPoint LibDrawPin::ReturnPinEndPoint()
int LibDrawPin::ReturnPinDrawOrient( int TransMat[2][2] )
/********************************************************/
/* Return the pin real orientation (PIN_UP, PIN_DOWN, PIN_RIGHT, PIN_LEFT),
* according to its orientation,
* AND the matrix transform (rot, mirror) TransMat
/** Function ReturnPinDrawOrient
* Return the pin real orientation (PIN_UP, PIN_DOWN, PIN_RIGHT, PIN_LEFT),
* according to its orientation and the matrix transform (rot, mirror) TransMat
* @param TransMat = transform matrix
*/
{
int orient;
int x1 = 0, y1 = 0;
int t1, t2;
wxPoint end; // position of a end pin starting at 0,0 according to its orientation, lenght = 1
switch( m_Orient )
{
case PIN_UP:
y1 = 1; break;
end.y = 1; break;
case PIN_DOWN:
y1 = -1; break;
end.y = -1; break;
case PIN_LEFT:
x1 = -1; break;
end.x = -1; break;
case PIN_RIGHT:
x1 = 1; break;
end.x = 1; break;
}
t1 = TransMat[0][0] * x1 + TransMat[0][1] * y1;
t2 = TransMat[1][0] * x1 + TransMat[1][1] * y1;
end = TransformCoordinate( TransMat, end ); // = pos of end point, accordint to the component orientation
orient = PIN_UP;
if( t1 == 0 )
if( end.x == 0 )
{
if( t2 > 0 )
if( end.y > 0 )
orient = PIN_DOWN;
}
else
{
orient = PIN_RIGHT;
if( t1 < 0 )
if( end.x < 0 )
orient = PIN_LEFT;
}

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -51,6 +51,8 @@ set(PCBNEW_SRCS
# dialog_graphic_items_options.cpp
# dialog_initpcb.cpp
# dialog_netlist.cpp
zones_non_copper_type_functions.cpp
dialog_non_copper_zones_properties.cpp
# dialog_pad_edit.cpp
dialog_setup_libs.cpp
dialog_orient_footprints.cpp

View File

@ -1063,6 +1063,24 @@ void BOARD::RedrawAreasOutlines(WinEDA_DrawPanel* panel, wxDC * aDC, int aDrawMo
}
}
/***********************************************************************************************/
void BOARD::RedrawFilledAreas(WinEDA_DrawPanel* panel, wxDC * aDC, int aDrawMode, int aLayer)
/***********************************************************************************************/
/**
* Function RedrawFilledAreas
* Redraw all areas outlines on layer aLayer ( redraw all if aLayer < 0 )
*/
{
if ( ! aDC ) return;
for( int ii = 0; ii < GetAreaCount(); ii++ )
{
ZONE_CONTAINER* edge_zone = GetArea(ii);
if( (aLayer < 0) || (aLayer == edge_zone->GetLayer()) )
edge_zone->DrawFilledArea( panel, aDC, aDrawMode );
}
}
#if defined(DEBUG)

View File

@ -366,6 +366,12 @@ public:
*/
void RedrawAreasOutlines(WinEDA_DrawPanel* panel, wxDC * aDC, int aDrawMode, int aLayer);
/**
* Function RedrawFilledAreas
* Redraw all filled areas on layer aLayer ( redraw all if aLayer < 0 )
*/
void RedrawFilledAreas(WinEDA_DrawPanel* panel, wxDC * aDC, int aDrawMode, int aLayer);
/**
* Function SetAreasNetCodesFromNetNames
* Set the .m_NetCode member of all copper areas, according to the area Net Name

View File

@ -149,7 +149,11 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
TimeStampText.Printf( wxT( "(%8.8X)" ), item->m_TimeStamp );
text << TimeStampText;
}
if( ((ZONE_CONTAINER*) item)->GetNet() >= 0 )
if ( !((ZONE_CONTAINER*) item)->IsOnCopperLayer() )
{
text << wxT( " [" ) << _("Not on copper layer") << wxT( "]" );
}
else if( ((ZONE_CONTAINER*) item)->GetNet() >= 0 )
{
net = aPcb->FindNet( ( (ZONE_CONTAINER*) item )->GetNet() );
if( net )

View File

@ -84,8 +84,8 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const
// Save the outline main info
ret = fprintf( aFile, "ZInfo %8.8lX %d \"%s\"\n",
m_TimeStamp, m_NetCode,
CONV_TO_UTF8( m_Netname ) );
m_TimeStamp, m_NetCode,
CONV_TO_UTF8( m_Netname ) );
if( ret < 3 )
return false;
@ -122,9 +122,11 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const
case PAD_IN_ZONE:
padoption = 'I';
break;
case THERMAL_PAD:
padoption = 'T';
break;
case PAD_NOT_IN_ZONE:
padoption = 'X';
break;
@ -138,8 +140,8 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const
for( item_pos = 0; item_pos < corners_count; item_pos++ )
{
ret = fprintf( aFile, "ZCorner %d %d %d\n",
m_Poly->corner[item_pos].x, m_Poly->corner[item_pos].y,
m_Poly->corner[item_pos].end_contour );
m_Poly->corner[item_pos].x, m_Poly->corner[item_pos].y,
m_Poly->corner[item_pos].end_contour );
if( ret < 3 )
return false;
}
@ -157,7 +159,7 @@ int ZONE_CONTAINER::ReadDescr( FILE* aFile, int* aLineNum )
/** Function ReadDescr
* @param aFile = opened file
* @param aLineNum = pointer on a line number counter (can be NULL or missing)
* @return 0 if ok or NULL
* @return 1 if ok or 0
*/
{
char Line[1024], * text;
@ -182,7 +184,7 @@ int ZONE_CONTAINER::ReadDescr( FILE* aFile, int* aLineNum )
if( !has_corner )
m_Poly->Start( m_Layer, x, y, outline_hatch );
else
AppendCorner( wxPoint(x, y) );
AppendCorner( wxPoint( x, y ) );
has_corner = true;
if( flag )
m_Poly->Close();
@ -281,6 +283,9 @@ int ZONE_CONTAINER::ReadDescr( FILE* aFile, int* aLineNum )
}
}
if( !IsOnCopperLayer() )
SetNet( 0 );
return error ? 0 : 1;
}
@ -300,8 +305,8 @@ void ZONE_CONTAINER::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, con
return;
wxPoint seg_start, seg_end;
int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
int color = g_DesignSettings.m_LayerColor[m_Layer];
int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
int color = g_DesignSettings.m_LayerColor[m_Layer];
if( ( color & (ITEM_NOT_SHOW | HIGHT_LIGHT_FLAG) ) == ITEM_NOT_SHOW )
return;
@ -331,14 +336,14 @@ void ZONE_CONTAINER::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, con
int i_start_contour = 0;
for( int ic = 0; ic < GetNumCorners(); ic++ )
{
seg_start = GetCornerPosition(ic) + offset;
seg_start = GetCornerPosition( ic ) + offset;
if( m_Poly->corner[ic].end_contour == FALSE && ic < GetNumCorners() - 1 )
{
seg_end = GetCornerPosition(ic + 1) + offset;
seg_end = GetCornerPosition( ic + 1 ) + offset;
}
else
{
seg_end = GetCornerPosition(i_start_contour) + offset;
seg_end = GetCornerPosition( i_start_contour ) + offset;
i_start_contour = ic + 1;
}
GRLine( &panel->m_ClipBox, DC, seg_start.x, seg_start.y, seg_end.x, seg_end.y, 0, color );
@ -356,20 +361,108 @@ void ZONE_CONTAINER::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode, con
}
EDA_Rect ZONE_CONTAINER::GetBoundingBox()
/************************************************************************************/
void ZONE_CONTAINER::DrawFilledArea( WinEDA_DrawPanel* panel,
wxDC* DC, int aDrawMode, const wxPoint& offset )
/************************************************************************************/
/**
* Function DrawDrawFilledArea
* Draws the filled area for this zone (polygon list .m_FilledPolysList)
* @param panel = current Draw Panel
* @param DC = current Device Context
* @param offset = Draw offset (usually wxPoint(0,0))
* @param aDrawMode = GR_OR, GR_XOR, GR_COPY ..
*/
{
const int PRELOAD = 500000;
static int* CornersBuffer = NULL;
static unsigned CornersBufferSize = 0;
int ymax = -PRELOAD;
int ymin = PRELOAD;
int xmin = PRELOAD;
int xmax = -PRELOAD;
if( DC == NULL )
return;
int count = GetNumCorners();
if( !DisplayOpt.DisplayZones )
return;
for( int i=0; i<count; ++i )
unsigned imax = m_FilledPolysList.size();
if( imax == 0 ) // Nothing to draw
return;
int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
int color = g_DesignSettings.m_LayerColor[m_Layer];
if( ( color & (ITEM_NOT_SHOW | HIGHT_LIGHT_FLAG) ) == ITEM_NOT_SHOW )
return;
GRSetDrawMode( DC, aDrawMode );
if( DisplayOpt.ContrastModeDisplay )
{
wxPoint corner = GetCornerPosition(i);
if( !IsOnLayer( curr_layer ) )
{
color &= ~MASKCOLOR;
color |= DARKDARKGRAY;
}
}
if( aDrawMode & GR_SURBRILL )
{
if( aDrawMode & GR_AND )
color &= ~HIGHT_LIGHT_FLAG;
else
color |= HIGHT_LIGHT_FLAG;
}
if( color & HIGHT_LIGHT_FLAG )
color = ColorRefs[color & MASKCOLOR].m_LightColor;
// draw the filled polygon
if( CornersBuffer == NULL )
{
CornersBufferSize = imax * 4;
CornersBuffer = (int*) MyMalloc( CornersBufferSize * sizeof(int) );
}
if( (imax * 4) > CornersBufferSize )
{
CornersBufferSize = imax * 4;
CornersBuffer = (int*) realloc( CornersBuffer, CornersBufferSize * sizeof(int) );
}
int corners_count = 0;
for( unsigned ic = 0, ii = 0; ic < imax; ic++ )
{
CPolyPt* corner = &m_FilledPolysList[ic];
CornersBuffer[ii++] = corner->x + offset.x;
CornersBuffer[ii++] = corner->y + offset.y;
corners_count++;
if( corner->end_contour )
{
GRPoly( &panel->m_ClipBox, DC, corners_count, CornersBuffer,
1, 0, color, color );
corners_count = 0;
ii = 0;
}
}
}
/****************************************/
EDA_Rect ZONE_CONTAINER::GetBoundingBox()
/****************************************/
{
const int PRELOAD = 0x7FFFFFFF; // Biggest integer (32 bits)
int ymax = -PRELOAD;
int ymin = PRELOAD;
int xmin = PRELOAD;
int xmax = -PRELOAD;
int count = GetNumCorners();
for( int i = 0; i<count; ++i )
{
wxPoint corner = GetCornerPosition( i );
ymax = MAX( ymax, corner.y );
xmax = MAX( xmax, corner.x );
@ -377,7 +470,7 @@ EDA_Rect ZONE_CONTAINER::GetBoundingBox()
xmin = MIN( xmin, corner.x );
}
EDA_Rect ret( wxPoint(xmin,ymin), wxSize( xmax-xmin+1, ymax-ymin+1) );
EDA_Rect ret( wxPoint( xmin, ymin ), wxSize( xmax - xmin + 1, ymax - ymin + 1 ) );
return ret;
}
@ -386,6 +479,7 @@ EDA_Rect ZONE_CONTAINER::GetBoundingBox()
/**********************************************************************************************/
void ZONE_CONTAINER::DrawWhileCreateOutline( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode )
/***********************************************************************************************/
/**
* Function DrawWhileCreateOutline
* Draws the zone outline when ir is created.
@ -397,14 +491,14 @@ void ZONE_CONTAINER::DrawWhileCreateOutline( WinEDA_DrawPanel* panel, wxDC* DC,
* @param draw_mode = draw mode: OR, XOR ..
*/
{
int current_gr_mode = draw_mode;
bool is_close_segment = false;
int current_gr_mode = draw_mode;
bool is_close_segment = false;
wxPoint seg_start, seg_end;
if( DC == NULL )
return;
int curr_layer = ((PCB_SCREEN*)panel->GetScreen())->m_Active_Layer;
int color = g_DesignSettings.m_LayerColor[m_Layer] & MASKCOLOR;
int curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
int color = g_DesignSettings.m_LayerColor[m_Layer] & MASKCOLOR;
if( DisplayOpt.ContrastModeDisplay )
{
@ -417,18 +511,18 @@ void ZONE_CONTAINER::DrawWhileCreateOutline( WinEDA_DrawPanel* panel, wxDC* DC,
// draw the lines
wxPoint start_contour_pos = GetCornerPosition(0);
wxPoint start_contour_pos = GetCornerPosition( 0 );
for( int ic = 0; ic < GetNumCorners(); ic++ )
{
int xi = GetCornerPosition(ic).x;
int yi = GetCornerPosition(ic).y;
int xi = GetCornerPosition( ic ).x;
int yi = GetCornerPosition( ic ).y;
int xf, yf;
if( m_Poly->corner[ic].end_contour == FALSE && ic < GetNumCorners() - 1 )
{
is_close_segment = false;
xf = GetCornerPosition(ic + 1).x;
yf = GetCornerPosition(ic + 1).y;
if ( (m_Poly->corner[ic + 1].end_contour) || (ic == GetNumCorners() - 2) )
xf = GetCornerPosition( ic + 1 ).x;
yf = GetCornerPosition( ic + 1 ).y;
if( (m_Poly->corner[ic + 1].end_contour) || (ic == GetNumCorners() - 2) )
current_gr_mode = GR_XOR;
else
current_gr_mode = draw_mode;
@ -436,13 +530,13 @@ void ZONE_CONTAINER::DrawWhileCreateOutline( WinEDA_DrawPanel* panel, wxDC* DC,
else
{
is_close_segment = true;
current_gr_mode = GR_XOR;
current_gr_mode = GR_XOR;
xf = start_contour_pos.x;
yf = start_contour_pos.y;
start_contour_pos = GetCornerPosition(ic + 1);
start_contour_pos = GetCornerPosition( ic + 1 );
}
GRSetDrawMode( DC, current_gr_mode );
if ( is_close_segment )
if( is_close_segment )
GRLine( &panel->m_ClipBox, DC, xi, yi, xf, yf, 0, WHITE );
else
GRLine( &panel->m_ClipBox, DC, xi, yi, xf, yf, 0, color );
@ -450,7 +544,6 @@ void ZONE_CONTAINER::DrawWhileCreateOutline( WinEDA_DrawPanel* panel, wxDC* DC,
}
/**
* Function HitTest
* tests if the given wxPoint is within the bounds of this object.
@ -541,11 +634,11 @@ int ZONE_CONTAINER::HitTestForEdge( const wxPoint& refPos )
/* test the dist between segment and ref point */
dist = (int) GetPointToLineSegmentDistance( refPos.x,
refPos.y,
m_Poly->corner[item_pos].x,
m_Poly->corner[item_pos].y,
m_Poly->corner[end_segm].x,
m_Poly->corner[end_segm].y );
refPos.y,
m_Poly->corner[item_pos].x,
m_Poly->corner[item_pos].y,
m_Poly->corner[end_segm].x,
m_Poly->corner[end_segm].y );
if( dist <= min_dist )
{
m_CornerSelection = item_pos;
@ -609,23 +702,28 @@ void ZONE_CONTAINER::Display_Infos( WinEDA_DrawFrame* frame )
text_pos += 15;
if( GetNet() >= 0 )
if( IsOnCopperLayer() )
{
EQUIPOT* equipot = ( (WinEDA_PcbFrame*) frame )->m_Pcb->FindNet( GetNet() );
if( GetNet() >= 0 )
{
EQUIPOT* equipot = ( (WinEDA_PcbFrame*) frame )->m_Pcb->FindNet( GetNet() );
if( equipot )
msg = equipot->m_Netname;
else
msg = wxT( "<noname>" );
}
else // a netcode < 0 is an error
{
msg = wxT( " [" );
msg << m_Netname + wxT( "]" );
msg << wxT( " <" ) << _( "Not Found" ) << wxT( ">" );
}
if( equipot )
msg = equipot->m_Netname;
else
msg = wxT( "<noname>" );
}
else // a netcode < 0 is an error
{
msg = wxT( " [" );
msg << m_Netname + wxT( "]" );
msg << wxT( " <" ) << _( "Not Found" ) << wxT( ">" );
}
Affiche_1_Parametre( frame, text_pos, _( "NetName" ), msg, RED );
Affiche_1_Parametre( frame, text_pos, _( "NetName" ), msg, RED );
}
else
Affiche_1_Parametre( frame, text_pos, _( "Non Copper Zone" ), wxEmptyString, RED );
/* Display net code : (usefull in test or debug) */
text_pos += 18;
@ -657,12 +755,13 @@ void ZONE_CONTAINER::Move( const wxPoint& offset )
{
for( unsigned ii = 0; ii < m_Poly->corner.size(); ii++ )
{
SetCornerPosition(ii, GetCornerPosition(ii) + offset);
SetCornerPosition( ii, GetCornerPosition( ii ) + offset );
}
m_Poly->Hatch();
}
/**
* Function MoveEdge
* Move the outline Edge. m_CornerSelection is the start point of the outline edge
@ -673,17 +772,17 @@ void ZONE_CONTAINER::MoveEdge( const wxPoint& offset )
int ii = m_CornerSelection;
// Move the start point of the selected edge:
SetCornerPosition(ii, GetCornerPosition(ii) + offset);
SetCornerPosition( ii, GetCornerPosition( ii ) + offset );
// Move the end point of the selected edge:
if ( m_Poly->corner[ii].end_contour || ii == GetNumCorners() - 1)
if( m_Poly->corner[ii].end_contour || ii == GetNumCorners() - 1 )
{
int icont = m_Poly->GetContour( ii );
ii = m_Poly->GetContourStart( icont );
}
else
ii++;
SetCornerPosition(ii, GetCornerPosition(ii) + offset);
SetCornerPosition( ii, GetCornerPosition( ii ) + offset );
m_Poly->Hatch();
}

View File

@ -5,6 +5,8 @@
#ifndef CLASS_ZONE_H
#define CLASS_ZONE_H
#include <vector>
#include "PolyLine.h"
/************************/
@ -25,30 +27,38 @@ public:
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
int m_ZoneClearance; // clearance value
int m_GridFillValue; // Grid used for filling
m_PadInZone m_PadOption; // see m_PadInZone
int utility, utility2; // flags used in polygon calculations
wxString m_Netname; // Net Name
CPolyLine* m_Poly; // outlines
int m_CornerSelection; // For corner moving, corner index to drag, or -1 if no selection
int m_ZoneClearance; // clearance value
int m_GridFillValue; // Grid used for filling
m_PadInZone m_PadOption; // see m_PadInZone
int utility, utility2; // flags used in polygon calculations
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
*/
private:
int m_NetCode; // Net number for fast comparisons
int m_NetCode; // Net number for fast comparisons
public:
ZONE_CONTAINER( BOARD * parent );
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 );
wxPoint& GetPosition()
{
static wxPoint pos;
return pos;
}
void UnLink( void )
{
};
@ -58,9 +68,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 Display_Infos( WinEDA_DrawFrame* frame );
void Display_Infos( WinEDA_DrawFrame* frame );
/**
* Function Draw
@ -70,8 +80,23 @@ 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
* Draws the filled area for this zone (polygon list .m_FilledPolysList)
* @param panel = current Draw Panel
* @param DC = current Device Context
* @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 );
EDA_Rect GetBoundingBox();
@ -85,14 +110,26 @@ public:
* @param DC = current Device Context
* @param draw_mode = draw mode: OR, XOR ..
*/
void DrawWhileCreateOutline( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode = GR_OR );
void DrawWhileCreateOutline( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode = GR_OR );
/**
* Function IsOnCopperLayer
* @return true if this zone is on a copper layer, false if on a technical layer
*/
bool IsOnCopperLayer( void )
{
return ( GetLayer() < FIRST_NO_COPPER_LAYER ) ? true : false;
}
int GetNet( void ) const
{
return m_NetCode;
}
void SetNet( int anet_code );
void SetNet( int anet_code );
/**
* Function HitTest
@ -100,7 +137,15 @@ public:
* @param refPos A wxPoint to test
* @return bool - true if a hit, else false
*/
bool HitTest( const wxPoint& refPos );
bool HitTest( const wxPoint& refPos );
/** function BuildFilledPolysListData
* Build m_FilledPolysList data from real outlines (m_Poly)
* in order to have drawable (and plottable) filled polygons
* drawable filled polygons are polygons without hole
* @return number of polygons
*/
int BuildFilledPolysListData( void );
/**
* Function HitTestForCorner
@ -108,7 +153,7 @@ public:
* @return -1 if none, corner index in .corner <vector>
* @param refPos : A wxPoint to test
*/
int HitTestForCorner( const wxPoint& refPos );
int HitTestForCorner( const wxPoint& refPos );
/**
* Function HitTestForEdge
@ -116,7 +161,7 @@ public:
* @return -1 if none, or index of the starting corner in .corner <vector>
* @param refPos : A wxPoint to test
*/
int HitTestForEdge( const wxPoint& refPos );
int HitTestForEdge( const wxPoint& refPos );
/**
* Function HitTest (overlayed)
@ -124,7 +169,7 @@ public:
* @param refArea : the given EDA_Rect
* @return bool - true if a hit, else false
*/
bool HitTest( EDA_Rect& refArea );
bool HitTest( EDA_Rect& refArea );
/**
* Function Fill_Zone()
@ -137,7 +182,7 @@ public:
* @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: */
@ -146,14 +191,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
@ -161,7 +206,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 Mirror
@ -169,7 +214,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
@ -181,30 +226,35 @@ public:
return wxT( "ZONE_CONTAINER" );
}
/** Acces to m_Poly parameters
*/
int GetNumCorners(void)
/** Acces to m_Poly parameters
*/
int GetNumCorners( void )
{
return m_Poly->GetNumCorners();
}
void RemoveAllContours(void)
void RemoveAllContours( void )
{
m_Poly->RemoveAllContours();
}
wxPoint GetCornerPosition(int aCornerIndex)
wxPoint GetCornerPosition( int aCornerIndex )
{
return wxPoint(m_Poly->GetX(aCornerIndex), m_Poly->GetY(aCornerIndex));
return wxPoint( m_Poly->GetX( aCornerIndex ), m_Poly->GetY( aCornerIndex ) );
}
void SetCornerPosition(int aCornerIndex, wxPoint new_pos)
void SetCornerPosition( int aCornerIndex, wxPoint new_pos )
{
m_Poly->SetX(aCornerIndex, new_pos.x);
m_Poly->SetY(aCornerIndex, new_pos.y);
m_Poly->SetX( aCornerIndex, new_pos.x );
m_Poly->SetY( aCornerIndex, new_pos.y );
}
void AppendCorner( wxPoint position )
{
m_Poly->AppendCorner( position.x, position.y );

View File

@ -0,0 +1,69 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_non_copper_zones_properties.h"
///////////////////////////////////////////////////////////////////////////
BEGIN_EVENT_TABLE( DialogNonCopperZonesProperties, wxDialog )
EVT_INIT_DIALOG( DialogNonCopperZonesProperties::_wxFB_InitDialog )
EVT_BUTTON( wxID_OK, DialogNonCopperZonesProperties::_wxFB_OnOkClick )
EVT_BUTTON( wxID_CANCEL, DialogNonCopperZonesProperties::_wxFB_OnCancelClick )
END_EVENT_TABLE()
DialogNonCopperZonesProperties::DialogNonCopperZonesProperties( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* m_MainSizer;
m_MainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* m_UpperSizer;
m_UpperSizer = new wxBoxSizer( wxHORIZONTAL );
wxString m_OutlineAppearanceCtrlChoices[] = { _("Line"), _("Hatched Outline"), _("Full Hatched") };
int m_OutlineAppearanceCtrlNChoices = sizeof( m_OutlineAppearanceCtrlChoices ) / sizeof( wxString );
m_OutlineAppearanceCtrl = new wxRadioBox( this, wxID_ANY, _("Outlines Appearence"), wxDefaultPosition, wxDefaultSize, m_OutlineAppearanceCtrlNChoices, m_OutlineAppearanceCtrlChoices, 1, wxRA_SPECIFY_COLS );
m_OutlineAppearanceCtrl->SetSelection( 1 );
m_UpperSizer->Add( m_OutlineAppearanceCtrl, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
wxString m_OrientEdgesOptChoices[] = { _("Any"), _("H, V and 45 deg") };
int m_OrientEdgesOptNChoices = sizeof( m_OrientEdgesOptChoices ) / sizeof( wxString );
m_OrientEdgesOpt = new wxRadioBox( this, wxID_ANY, _("Zone Edges Orient"), wxDefaultPosition, wxDefaultSize, m_OrientEdgesOptNChoices, m_OrientEdgesOptChoices, 1, wxRA_SPECIFY_COLS );
m_OrientEdgesOpt->SetSelection( 0 );
m_UpperSizer->Add( m_OrientEdgesOpt, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
wxBoxSizer* m_ButtonsSizer;
m_ButtonsSizer = new wxBoxSizer( wxVERTICAL );
m_buttonOk = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonOk->SetDefault();
m_ButtonsSizer->Add( m_buttonOk, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
m_ButtonsSizer->Add( m_buttonCancel, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
m_UpperSizer->Add( m_ButtonsSizer, 1, wxALIGN_CENTER_VERTICAL, 5 );
m_MainSizer->Add( m_UpperSizer, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 );
m_staticTextLayerSelection = new wxStaticText( this, wxID_ANY, _("Layer selection:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextLayerSelection->Wrap( -1 );
m_MainSizer->Add( m_staticTextLayerSelection, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_LayerSelectionCtrl = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
m_MainSizer->Add( m_LayerSelectionCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
this->SetSizer( m_MainSizer );
this->Layout();
this->Centre( wxBOTH );
}
DialogNonCopperZonesProperties::~DialogNonCopperZonesProperties()
{
}

View File

@ -0,0 +1,418 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="9" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
<property name="disconnect_events">1</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">table</property>
<property name="file">dialog_non_copper_zones_properties</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="internationalize">1</property>
<property name="name">dialog_non_copper_zones_properties</property>
<property name="namespace"></property>
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="use_enum">1</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
<property name="bg"></property>
<property name="center">wxBOTH</property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="extra_style"></property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">DialogNonCopperZonesProperties</property>
<property name="pos"></property>
<property name="size">366,221</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass"></property>
<property name="title">Non Copper Zones Properties</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxFULL_REPAINT_ON_RESIZE|wxSUNKEN_BORDER</property>
<event name="OnActivate"></event>
<event name="OnActivateApp"></event>
<event name="OnChar"></event>
<event name="OnClose"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnHibernate"></event>
<event name="OnIconize"></event>
<event name="OnIdle"></event>
<event name="OnInitDialog">InitDialog</event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">m_MainSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxALIGN_CENTER_HORIZONTAL</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">m_UpperSizer</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxRadioBox" expanded="1">
<property name="bg"></property>
<property name="choices">&quot;Line&quot; &quot;Hatched Outline&quot; &quot;Full Hatched&quot;</property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Outlines Appearence</property>
<property name="majorDimension">1</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_OutlineAppearanceCtrl</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="selection">1</property>
<property name="size"></property>
<property name="style">wxRA_SPECIFY_COLS</property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRadioBox"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxRadioBox" expanded="1">
<property name="bg"></property>
<property name="choices">&quot;Any&quot; &quot;H, V and 45 deg&quot;</property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Zone Edges Orient</property>
<property name="majorDimension">1</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_OrientEdgesOpt</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="selection">0</property>
<property name="size"></property>
<property name="style">wxRA_SPECIFY_COLS</property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRadioBox"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">m_ButtonsSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="default">1</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_OK</property>
<property name="label">OK</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_buttonOk</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnOkClick</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_HORIZONTAL</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="default">0</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_CANCEL</property>
<property name="label">Cancel</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_buttonCancel</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnCancelClick</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Layer selection:</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_staticTextLayerSelection</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxListBox" expanded="1">
<property name="bg"></property>
<property name="choices"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">m_LayerSelectionCtrl</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnListBox"></event>
<event name="OnListBoxDClick"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
</object>
</wxFormBuilder_Project>

View File

@ -0,0 +1,61 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_non_copper_zones_properties__
#define __dialog_non_copper_zones_properties__
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/radiobox.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include <wx/stattext.h>
#include <wx/listbox.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DialogNonCopperZonesProperties
///////////////////////////////////////////////////////////////////////////////
class DialogNonCopperZonesProperties : public wxDialog
{
DECLARE_EVENT_TABLE()
private:
// Private event handlers
void _wxFB_InitDialog( wxInitDialogEvent& event ){ InitDialog( event ); }
void _wxFB_OnOkClick( wxCommandEvent& event ){ OnOkClick( event ); }
void _wxFB_OnCancelClick( wxCommandEvent& event ){ OnCancelClick( event ); }
protected:
wxRadioBox* m_OutlineAppearanceCtrl;
wxRadioBox* m_OrientEdgesOpt;
wxButton* m_buttonOk;
wxButton* m_buttonCancel;
wxStaticText* m_staticTextLayerSelection;
wxListBox* m_LayerSelectionCtrl;
// Virtual event handlers, overide them in your derived class
virtual void InitDialog( wxInitDialogEvent& event ){ event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); }
public:
DialogNonCopperZonesProperties( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Non Copper Zones Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 366,221 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxFULL_REPAINT_ON_RESIZE|wxSUNKEN_BORDER );
~DialogNonCopperZonesProperties();
};
#endif //__dialog_non_copper_zones_properties__

View File

@ -260,7 +260,7 @@ void WinEDA_ZoneFrame::CreateControls()
m_Parent->m_InternalUnits );
m_ZoneClearanceCtrl->SetValue( title );
if( Zone_45_Only )
if( g_Zone_45_Only )
m_OrientEdgesOpt->SetSelection( 1 );
static const int GridList[4] = { 25, 50, 100, 250 };
@ -297,7 +297,7 @@ void WinEDA_ZoneFrame::CreateControls()
m_FillOpt->SetSelection( 0 );
break;
}
s_Zone_Hatching = m_Zone_Container->m_Poly->GetHatchStyle();
g_Zone_Hatching = m_Zone_Container->m_Poly->GetHatchStyle();
}
else
@ -314,11 +314,11 @@ void WinEDA_ZoneFrame::CreateControls()
m_FillOpt->SetSelection( 0 );
break;
}
s_Zone_Hatching = m_Parent->m_Parent->m_EDA_Config->Read( ZONE_NET_OUTLINES_HATCH_OPTION_KEY,
g_Zone_Hatching = m_Parent->m_Parent->m_EDA_Config->Read( ZONE_NET_OUTLINES_HATCH_OPTION_KEY,
(long) CPolyLine::DIAGONAL_EDGE );
}
switch( s_Zone_Hatching )
switch( g_Zone_Hatching )
{
case CPolyLine::NO_HATCH:
m_OutlineAppearanceCtrl->SetSelection(0);
@ -485,21 +485,21 @@ bool WinEDA_ZoneFrame::AcceptOptions(bool aPromptForErrors)
switch( m_OutlineAppearanceCtrl->GetSelection() )
{
case 0:
s_Zone_Hatching = CPolyLine::NO_HATCH;
g_Zone_Hatching = CPolyLine::NO_HATCH;
break;
case 1:
s_Zone_Hatching = CPolyLine::DIAGONAL_EDGE;
g_Zone_Hatching = CPolyLine::DIAGONAL_EDGE;
break;
case 2:
s_Zone_Hatching = CPolyLine::DIAGONAL_FULL;
g_Zone_Hatching = CPolyLine::DIAGONAL_FULL;
break;
}
if( m_Parent->m_Parent->m_EDA_Config )
{
m_Parent->m_Parent->m_EDA_Config->Write( ZONE_NET_OUTLINES_HATCH_OPTION_KEY, (long)s_Zone_Hatching);
m_Parent->m_Parent->m_EDA_Config->Write( ZONE_NET_OUTLINES_HATCH_OPTION_KEY, (long)g_Zone_Hatching);
}
switch( m_GridCtrl->GetSelection() )
@ -526,9 +526,9 @@ bool WinEDA_ZoneFrame::AcceptOptions(bool aPromptForErrors)
g_DesignSettings.m_ZoneClearence =
ReturnValueFromString( g_UnitMetric, txtvalue, m_Parent->m_InternalUnits );
if( m_OrientEdgesOpt->GetSelection() == 0 )
Zone_45_Only = FALSE;
g_Zone_45_Only = FALSE;
else
Zone_45_Only = TRUE;
g_Zone_45_Only = TRUE;
/* Get the layer selection for this zone */
int ii = m_LayerSelectionCtrl->GetSelection();
@ -537,7 +537,7 @@ bool WinEDA_ZoneFrame::AcceptOptions(bool aPromptForErrors)
DisplayError( this, _( "Error : you must choose a layer" ) );
return false;
}
s_Zone_Layer = m_LayerId[ii];
g_CurrentZone_Layer = m_LayerId[ii];
/* Get the net name selection for this zone */
ii = m_ListNetNameSelection->GetSelection();

View File

@ -320,6 +320,8 @@ void DRC::testZones(bool adoTestFillSegments)
for( int ii = 0; ii < m_pcb->GetAreaCount(); ii++ )
{
ZONE_CONTAINER* Area_To_Test = m_pcb->GetArea( ii );
if( ! Area_To_Test->IsOnCopperLayer() )
continue;
if( Area_To_Test->GetNet() <= 0 )
{
m_currentMarker = fillMarker( Area_To_Test,

View File

@ -771,7 +771,7 @@ int WinEDA_PcbFrame::ReadPcbFile( FILE* File, bool Append )
wxBusyCursor dummy;
// Switch the locale to standard C (needed to print floating point numbers like 1.3)
// Switch the locale to standard C (needed to read floating point numbers like 1.3)
SetLocaleTo_C_standard( );
NbDraw = NbTrack = NbZone = NbMod = NbNets = -1;
@ -1010,6 +1010,13 @@ int WinEDA_PcbFrame::ReadPcbFile( FILE* File, bool Append )
BestZoom();
#ifdef PCBNEW
if( m_Pcb->m_ZoneDescriptorList.size() > 0 )
{ // Build filled areas
for( unsigned ia = 0; ia < m_Pcb->m_ZoneDescriptorList.size(); ia++ )
m_Pcb->m_ZoneDescriptorList[ia]->BuildFilledPolysListData( );
}
// Build connectivity info
Compile_Ratsnest( NULL, TRUE );
#endif
return 1;

View File

@ -20,6 +20,8 @@ OBJECTS= $(TARGET).o classpcb.o\
$(SPECCTRA_TOOLS)\
lay2plot.o\
dialog_freeroute_exchange.o\
dialog_non_copper_zones_properties.o\
zones_non_copper_type_functions.o\
modedit_undo_redo.o\
block_module_editor.o\
onrightclick.o\

View File

@ -18,6 +18,7 @@
#include "trigo.h"
#include "cell.h"
#include "worksheet.h"
#include "zones.h"
#include "protos.h"

View File

@ -8,6 +8,10 @@
#include <vector>
/* install function for DialogNonCopperZonesEditor dialog frame :*/
bool InstallDialogNonCopperZonesEditor(WinEDA_PcbFrame* aParent, ZONE_CONTAINER* aZone);
/***************/
/* PAD_CONNECT.CPP */
/***************/

View File

@ -173,7 +173,10 @@ void WinEDA_PcbFrame::Trace_Pcb( wxDC* DC, int mode )
// Areas must be drawn here only if not moved or dragged,
// because these areas are drawn by ManageCursor() in a specific manner
if ( (edge_zone->m_Flags & (IN_EDIT | IS_DRAGGED | IS_MOVED)) == 0 )
{
edge_zone->Draw( DrawPanel, DC, mode );
edge_zone->DrawFilledArea( DrawPanel, DC, mode );
}
}
// draw the BOARD's markers.

37
pcbnew/zones.h Normal file
View File

@ -0,0 +1,37 @@
/************************************************/
/* constants used in zone dialogs and functions */
/************************************************/
#ifndef ZONES_H
#define ZONES_H
#ifndef eda_global
#define eda_global extern
#endif
// keys used to store net sort option in config file :
#define ZONE_NET_OUTLINES_HATCH_OPTION_KEY wxT( "Zone_Ouline_Hatch_Opt" )
#define ZONE_NET_SORT_OPTION_KEY wxT( "Zone_NetSort_Opt" )
#define ZONE_NET_FILTER_STRING_KEY wxT( "Zone_Filter_Opt" )
enum zone_cmd {
ZONE_ABORT,
ZONE_OK
};
/************************************************/
/* variables used in zone dialogs and functions */
/************************************************/
eda_global bool g_Zone_45_Only
#ifdef MAIN
= FALSE
#endif
;
eda_global int g_CurrentZone_Layer; // Layer used to create the current zone
eda_global int g_Zone_Hatching; // Option to show the zone area (outlines only, short hatches or full hatches
#endif // ifndef ZONES_H

View File

@ -33,6 +33,8 @@ using namespace std;
#include "protos.h"
#include "zones.h"
bool verbose = false; // false if zone outline diags must not be shown
// Outline creation:
@ -46,25 +48,13 @@ static void Show_Zone_Corner_Or_Outline_While_Move_Mouse( WinEDA_DrawPanel* pane
bool erase );
/* Local variables */
static bool Zone_45_Only = FALSE;
static ZONE_CONTAINER::m_PadInZone s_Zone_Pad_Options = ZONE_CONTAINER::THERMAL_PAD;
static int s_Zone_Layer; // Layer used to create the current zone
static int s_Zone_Hatching; // Option to show the zone area (outlines only, short hatches or full hatches
static int s_NetcodeSelection; // Net code selection for the current zone
static wxPoint s_CornerInitialPosition; // Used to abort a move corner command
static bool s_CornerIsNew; // Used to abort a move corner command (if it is a new corner, it must be deleted)
static bool s_AddCutoutToCurrentZone; // if true, the next outline will be addes to s_CurrentZone
static ZONE_CONTAINER* s_CurrentZone; // if != NULL, these ZONE_CONTAINER params will be used for the next zone
static wxPoint s_CursorLastPosition; // in move zone outline, last cursor position. Used to calculate the move vector
// keys used to store net sort option in config file :
#define ZONE_NET_OUTLINES_HATCH_OPTION_KEY wxT( "Zone_Ouline_Hatch_Opt" )
#define ZONE_NET_SORT_OPTION_KEY wxT( "Zone_NetSort_Opt" )
#define ZONE_NET_FILTER_STRING_KEY wxT( "Zone_Filter_Opt" )
enum zone_cmd {
ZONE_ABORT,
ZONE_OK
};
static int s_NetcodeSelection; // Net code selection for the current zone
static wxPoint s_CornerInitialPosition; // Used to abort a move corner command
static bool s_CornerIsNew; // Used to abort a move corner command (if it is a new corner, it must be deleted)
static bool s_AddCutoutToCurrentZone; // if true, the next outline will be addes to s_CurrentZone
static ZONE_CONTAINER* s_CurrentZone; // if != NULL, these ZONE_CONTAINER params will be used for the next zone
static wxPoint s_CursorLastPosition; // in move zone outline, last cursor position. Used to calculate the move vector
#include "dialog_zones_by_polygon.cpp"
@ -228,15 +218,17 @@ void WinEDA_PcbFrame::Start_Move_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_con
* if IsNewCorner is true, the Abort_Zone_Move_Corner_Or_Outlines will remove this corner, if called
*/
{
/* Show the Net */
if( g_HightLigt_Status && DC )
if( zone_container->IsOnCopperLayer() ) /* Show the Net */
{
Hight_Light( DC ); // Remove old hightlight selection
}
if( g_HightLigt_Status && DC )
{
Hight_Light( DC ); // Remove old hightlight selection
}
g_HightLigth_NetCode = s_NetcodeSelection = zone_container->GetNet();
if( DC )
Hight_Light( DC );
g_HightLigth_NetCode = s_NetcodeSelection = zone_container->GetNet();
if( DC )
Hight_Light( DC );
}
zone_container->m_Flags = IN_EDIT;
DrawPanel->ManageCurseur = Show_Zone_Corner_Or_Outline_While_Move_Mouse;
@ -259,11 +251,11 @@ void WinEDA_PcbFrame::Start_Move_Zone_Drag_Outline_Edge( wxDC* DC,
* Prepares a drag edge for an existing zone outline,
*/
{
zone_container->m_Flags = IS_DRAGGED;
zone_container->m_Flags = IS_DRAGGED;
zone_container->m_CornerSelection = corner_id;
DrawPanel->ManageCurseur = Show_Zone_Corner_Or_Outline_While_Move_Mouse;
DrawPanel->ForceCloseManageCurseur = Abort_Zone_Move_Corner_Or_Outlines;
s_CursorLastPosition = s_CornerInitialPosition = GetScreen()->m_Curseur;
s_CursorLastPosition = s_CornerInitialPosition = GetScreen()->m_Curseur;
s_AddCutoutToCurrentZone = false;
s_CurrentZone = NULL;
}
@ -279,13 +271,16 @@ void WinEDA_PcbFrame::Start_Move_Zone_Outlines( wxDC* DC, ZONE_CONTAINER* zone_c
*/
{
/* Show the Net */
if( g_HightLigt_Status )
if( zone_container->IsOnCopperLayer() ) /* Show the Net */
{
Hight_Light( DC ); // Remove old hightlight selection
}
if( g_HightLigt_Status )
{
Hight_Light( DC ); // Remove old hightlight selection
}
g_HightLigth_NetCode = s_NetcodeSelection = zone_container->GetNet();
Hight_Light( DC );
g_HightLigth_NetCode = s_NetcodeSelection = zone_container->GetNet();
Hight_Light( DC );
}
zone_container->m_Flags = IS_MOVED;
DrawPanel->ManageCurseur = Show_Zone_Corner_Or_Outline_While_Move_Mouse;
@ -321,12 +316,7 @@ void WinEDA_PcbFrame::End_Move_Zone_Corner_Or_Outlines( wxDC* DC, ZONE_CONTAINER
/* Combine zones if possible */
wxBusyCursor dummy;
// int layer = zone_container->GetLayer();
// m_Pcb->RedrawAreasOutlines( DrawPanel, DC, GR_XOR, layer );
m_Pcb->AreaPolygonModified( zone_container, true, verbose );
// m_Pcb->RedrawAreasOutlines( DrawPanel, DC, GR_OR, layer );
DrawPanel->Refresh();
@ -347,9 +337,12 @@ void WinEDA_PcbFrame::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_contain
/*************************************************************************************/
/**
* Function End_Move_Zone_Corner
* Function Remove_Zone_Corner
* Remove the currently selected corner in a zone outline
* the .m_CornerSelection is used as corner selection
* @param DC = Current deice context (can be NULL )
* @param zone_container = the zone that contains the selected corner
* the member .m_CornerSelection is used as selected corner
*/
{
GetScreen()->SetModify();
@ -357,20 +350,32 @@ void WinEDA_PcbFrame::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_contain
if( zone_container->m_Poly->GetNumCorners() <= 3 )
{
DrawPanel->PostDirtyRect( zone_container->GetBoundingBox() );
Delete_Zone_Fill( DC, NULL, zone_container->m_TimeStamp );
if( DC )
{
Delete_Zone_Fill( DC, NULL, zone_container->m_TimeStamp );
zone_container->DrawFilledArea( DrawPanel, DC, GR_XOR );
}
m_Pcb->Delete( zone_container );
return;
}
int layer = zone_container->GetLayer();
m_Pcb->RedrawAreasOutlines( DrawPanel, DC, GR_XOR, layer );
if( DC )
{
m_Pcb->RedrawAreasOutlines( DrawPanel, DC, GR_XOR, layer );
m_Pcb->RedrawFilledAreas( DrawPanel, DC, GR_XOR, layer );
}
zone_container->m_Poly->DeleteCorner( zone_container->m_CornerSelection );
// modify zones outlines according to the new zone_container shape
m_Pcb->AreaPolygonModified( zone_container, true, verbose );
m_Pcb->RedrawAreasOutlines( DrawPanel, DC, GR_OR, layer );
if( DC )
{
m_Pcb->RedrawAreasOutlines( DrawPanel, DC, GR_OR, layer );
m_Pcb->RedrawFilledAreas( DrawPanel, DC, GR_OR, layer );
}
int ii = m_Pcb->GetAreaIndex( zone_container ); // test if zone_container exists
if( ii < 0 )
@ -506,38 +511,50 @@ int WinEDA_PcbFrame::Begin_Zone( wxDC* DC )
zone = m_Pcb->m_CurrentZoneContour;
if( zone->GetNumCorners() == 0 ) /* Start a new contour: init zone params (net and layer) */
{
if( s_CurrentZone == NULL )
if( s_CurrentZone == NULL ) // A new outline is created
{
int diag;
DrawPanel->m_IgnoreMouseEvents = TRUE;
WinEDA_ZoneFrame* frame = new WinEDA_ZoneFrame( this );
int diag = frame->ShowModal();
frame->Destroy();
zone->SetLayer( ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer );
if( zone->IsOnCopperLayer() )
{ // Put a zone on a copper layer
WinEDA_ZoneFrame* frame = new WinEDA_ZoneFrame( this );
diag = frame->ShowModal();
frame->Destroy();
}
else // Put a zone on a non copper layer (technical layer)
{
diag = InstallDialogNonCopperZonesEditor( this, zone );
s_NetcodeSelection = 0; // No net for non copper zones
}
DrawPanel->MouseToCursorSchema();
DrawPanel->m_IgnoreMouseEvents = FALSE;
if( diag == ZONE_ABORT )
return 0;
((PCB_SCREEN*)GetScreen())->m_Active_Layer = s_Zone_Layer; // Set by the dialog frame
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = g_CurrentZone_Layer; // Set by the dialog frame
}
else /* Start a new contour: init zone params (net and layer) from an existing zone */
else /* Start a new contour: init zone params (net and layer) from an existing zone */
{
((PCB_SCREEN*)GetScreen())->m_Active_Layer = s_Zone_Layer = s_CurrentZone->GetLayer();
s_Zone_Hatching = s_CurrentZone->m_Poly->GetHatchStyle();
( (PCB_SCREEN*) GetScreen() )->m_Active_Layer = g_CurrentZone_Layer =
s_CurrentZone->GetLayer();
g_Zone_Hatching = s_CurrentZone->m_Poly->GetHatchStyle();
}
/* Show the Net */
if( g_HightLigt_Status && (g_HightLigth_NetCode != s_NetcodeSelection) )
/* Show the Net for zones on copper layers */
if( g_CurrentZone_Layer < FIRST_NO_COPPER_LAYER )
{
Hight_Light( DC ); // Remove old hightlight selection
if( g_HightLigt_Status && (g_HightLigth_NetCode != s_NetcodeSelection) )
{
Hight_Light( DC ); // Remove old hightlight selection
}
if( s_CurrentZone )
s_NetcodeSelection = s_CurrentZone->GetNet();
g_HightLigth_NetCode = s_NetcodeSelection;
Hight_Light( DC );
}
if( s_CurrentZone )
s_NetcodeSelection = s_CurrentZone->GetNet();
g_HightLigth_NetCode = s_NetcodeSelection;
Hight_Light( DC );
if( !s_AddCutoutToCurrentZone )
s_CurrentZone = NULL; // the zone is used only once
}
@ -546,17 +563,17 @@ int WinEDA_PcbFrame::Begin_Zone( wxDC* DC )
if( zone->GetNumCorners() == 0 )
{
zone->m_Flags = IS_NEW;
zone->SetLayer( s_Zone_Layer );
zone->SetLayer( g_CurrentZone_Layer );
zone->SetNet( s_NetcodeSelection );
zone->m_TimeStamp = GetTimeStamp();
zone->m_PadOption = s_Zone_Pad_Options;
zone->m_ZoneClearance = g_DesignSettings.m_ZoneClearence;
zone->m_GridFillValue = g_GridRoutingSize;
zone->m_Poly->Start( s_Zone_Layer,
GetScreen()->m_Curseur.x, GetScreen()->m_Curseur.y,
s_Zone_Hatching );
zone->m_Poly->Start( g_CurrentZone_Layer,
GetScreen()->m_Curseur.x, GetScreen()->m_Curseur.y,
g_Zone_Hatching );
zone->AppendCorner( GetScreen()->m_Curseur );
if( Drc_On && m_drc->Drc( zone, 0 ) == BAD_DRC )
if( Drc_On && (m_drc->Drc( zone, 0 ) == BAD_DRC) && zone->IsOnCopperLayer() )
{
zone->m_Flags = 0;
zone->RemoveAllContours();
@ -566,7 +583,7 @@ int WinEDA_PcbFrame::Begin_Zone( wxDC* DC )
// WinEDA_PcbFrame::SetCurItem() calls Display_Infos().
GetScreen()->SetCurItem( NULL );
DisplayError( this,
_( "DRC error: this start point is inside or too close an other area" ) );
_( "DRC error: this start point is inside or too close an other area" ) );
return 0;
}
@ -582,7 +599,8 @@ int WinEDA_PcbFrame::Begin_Zone( wxDC* DC )
/* edge in progress : the current corner coordinate was set by Show_New_Edge_While_Move_Mouse */
if( zone->GetCornerPosition( ii - 1 ) != zone->GetCornerPosition( ii ) )
{
if( Drc_On && m_drc->Drc( zone, ii - 1 ) == OK_DRC ) // Ok, we can add a new corner
if( (Drc_On && m_drc->Drc( zone, ii - 1 ) == OK_DRC)
|| !zone->IsOnCopperLayer() ) // Ok, we can add a new corner
{
zone->AppendCorner( GetScreen()->m_Curseur );
SetCurItem( zone ); // calls Display_Infos().
@ -620,14 +638,17 @@ bool WinEDA_PcbFrame::End_Zone( wxDC* DC )
// Validate the current edge:
int icorner = zone->GetNumCorners() - 1;
if( Drc_On && m_drc->Drc( zone, icorner - 1 ) == BAD_DRC ) // we can't validate last edge
return false;
if( Drc_On && m_drc->Drc( zone, icorner ) == BAD_DRC ) // we can't validate the closing edge
if( zone->IsOnCopperLayer() )
{
DisplayError( this,
_( "DRC error: closing this area creates a drc error with an other area" ) );
DrawPanel->MouseToCursorSchema();
return false;
if( Drc_On && m_drc->Drc( zone, icorner - 1 ) == BAD_DRC ) // we can't validate last edge
return false;
if( Drc_On && m_drc->Drc( zone, icorner ) == BAD_DRC ) // we can't validate the closing edge
{
DisplayError( this,
_( "DRC error: closing this area creates a drc error with an other area" ) );
DrawPanel->MouseToCursorSchema();
return false;
}
}
zone->m_Flags = 0;
@ -640,6 +661,7 @@ bool WinEDA_PcbFrame::End_Zone( wxDC* DC )
// Undraw old drawings, because they can have important changes
int layer = zone->GetLayer();
m_Pcb->RedrawAreasOutlines( DrawPanel, DC, GR_XOR, layer );
m_Pcb->RedrawFilledAreas( DrawPanel, DC, GR_XOR, layer );
/* Put edges in list */
if( s_CurrentZone == NULL )
@ -670,6 +692,7 @@ bool WinEDA_PcbFrame::End_Zone( wxDC* DC )
// Redraw the real edge zone :
m_Pcb->RedrawAreasOutlines( DrawPanel, DC, GR_OR, layer );
m_Pcb->RedrawFilledAreas( DrawPanel, DC, GR_OR, layer );
int ii = m_Pcb->GetAreaIndex( zone ); // test if zone_container exists
if( ii < 0 )
@ -707,12 +730,12 @@ static void Show_New_Edge_While_Move_Mouse( WinEDA_DrawPanel* panel, wxDC* DC, b
}
/* Redraw the curent edge in its new position */
if( Zone_45_Only )
if( g_Zone_45_Only )
{
// calculate the new position as allowed
wxPoint StartPoint = zone->GetCornerPosition( icorner - 1 );
Calcule_Coord_Extremite_45( StartPoint.x, StartPoint.y,
&c_pos.x, &c_pos.y );
&c_pos.x, &c_pos.y );
}
zone->SetCornerPosition( icorner, c_pos );
@ -730,11 +753,18 @@ void WinEDA_PcbFrame::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* zone_container
* Edit params (layer, clearance, ...) for a zone outline
*/
{
DrawPanel->m_IgnoreMouseEvents = TRUE;
WinEDA_ZoneFrame* frame = new WinEDA_ZoneFrame( this, zone_container );
int diag;
DrawPanel->m_IgnoreMouseEvents = TRUE;
if( zone_container->GetLayer() < FIRST_NO_COPPER_LAYER )
{ // edit a zone on a copper layer
WinEDA_ZoneFrame* frame = new WinEDA_ZoneFrame( this );
diag = frame->ShowModal();
frame->Destroy();
}
else // edit a zone on a non copper layer (technical layer)
diag = InstallDialogNonCopperZonesEditor( this, zone_container );
int diag = frame->ShowModal();
frame->Destroy();
DrawPanel->MouseToCursorSchema();
DrawPanel->m_IgnoreMouseEvents = FALSE;
@ -748,12 +778,12 @@ void WinEDA_PcbFrame::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* zone_container
edge_zone->Draw( DrawPanel, DC, GR_XOR );
}
zone_container->SetLayer( s_Zone_Layer );
zone_container->SetLayer( g_CurrentZone_Layer );
zone_container->SetNet( s_NetcodeSelection );
EQUIPOT* net = m_Pcb->FindNet( s_NetcodeSelection );
if( net )
zone_container->m_Netname = net->m_Netname;
zone_container->m_Poly->SetHatch( s_Zone_Hatching );
zone_container->m_Poly->SetHatch( g_Zone_Hatching );
zone_container->m_PadOption = s_Zone_Pad_Options;
zone_container->m_ZoneClearance = g_DesignSettings.m_ZoneClearence;
zone_container->m_GridFillValue = g_GridRoutingSize;
@ -782,7 +812,7 @@ void WinEDA_PcbFrame::Delete_Zone_Contour( wxDC* DC, ZONE_CONTAINER* zone_contai
* otherwise, the hole is deleted
*/
{
int ncont = zone_container->m_Poly->GetContour( zone_container->m_CornerSelection );
int ncont = zone_container->m_Poly->GetContour( zone_container->m_CornerSelection );
EDA_Rect dirty = zone_container->GetBoundingBox();
@ -860,7 +890,7 @@ int WinEDA_PcbFrame::Fill_Zone( wxDC* DC, ZONE_CONTAINER* zone_container, bool v
wxBusyCursor dummy; // Shows an hourglass cursor (removed by its destructor)
zone_container->m_GridFillValue = g_GridRoutingSize;
int error_level = zone_container->Fill_Zone( this, DC, verbose );
int error_level = zone_container->Fill_Zone( this, DC, verbose );
GetScreen()->SetModify();

View File

@ -0,0 +1,210 @@
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "pcbnew.h"
#include "zones.h"
#include "dialog_non_copper_zones_properties.h"
/* Local functions */
/* Local variables */
/* Class DialogNonCopperZonesEditor
* Dialog editor for non copper zones properties
* Derived from DialogNonCopperZonesProperties, created by wxFormBuilder
*/
class DialogNonCopperZonesEditor : public DialogNonCopperZonesProperties
{
private:
WinEDA_PcbFrame* m_Parent;
ZONE_CONTAINER* m_Zone_Container;
private:
void OnOkClick( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event );
void InitDialog( wxInitDialogEvent& event );
public:
DialogNonCopperZonesEditor( WinEDA_PcbFrame* parent,
ZONE_CONTAINER* zone_container );
~DialogNonCopperZonesEditor();
};
/*******************************************************************************************/
DialogNonCopperZonesEditor::DialogNonCopperZonesEditor( WinEDA_PcbFrame* parent,
ZONE_CONTAINER* zone_container ) :
DialogNonCopperZonesProperties( parent )
/*******************************************************************************************/
{
m_Parent = parent;
m_Zone_Container = zone_container;
SetFont( *g_DialogFont );
}
/********************************************************/
DialogNonCopperZonesEditor::~DialogNonCopperZonesEditor()
/********************************************************/
{
}
/* install function for DialogNonCopperZonesEditor dialog frame :*/
bool InstallDialogNonCopperZonesEditor(WinEDA_PcbFrame* aParent, ZONE_CONTAINER* aZone)
{
DialogNonCopperZonesEditor* frame = new DialogNonCopperZonesEditor( aParent, aZone );
bool diag = frame->ShowModal();
frame->Destroy();
return diag;
}
/********************************************************************/
void DialogNonCopperZonesEditor::InitDialog( wxInitDialogEvent& event )
/********************************************************************/
{
SetFocus();
SetReturnCode( ZONE_ABORT ); // Will be changed on buttons click
if( g_Zone_45_Only )
m_OrientEdgesOpt->SetSelection( 1 );
switch( g_Zone_Hatching )
{
case CPolyLine::NO_HATCH:
m_OutlineAppearanceCtrl->SetSelection( 0 );
break;
case CPolyLine::DIAGONAL_EDGE:
m_OutlineAppearanceCtrl->SetSelection( 1 );
break;
case CPolyLine::DIAGONAL_FULL:
m_OutlineAppearanceCtrl->SetSelection( 2 );
break;
}
for( int layer_number = FIRST_NO_COPPER_LAYER, ii = 0;
layer_number < LAST_NO_COPPER_LAYER - 1;
layer_number++, ii++ )
{
wxString msg;
msg = m_Parent->m_Pcb->GetLayerName( layer_number ).Trim();
m_LayerSelectionCtrl->InsertItems( 1, &msg, ii );
if( m_Zone_Container )
{
if( m_Zone_Container->GetLayer() == layer_number )
m_LayerSelectionCtrl->SetSelection( ii );
}
else
{
if( ( (PCB_SCREEN*) ( m_Parent->GetScreen() ) )->m_Active_Layer == layer_number )
m_LayerSelectionCtrl->SetSelection( ii );
}
}
/* the size of m_LayerSelectionCtrl has changed, so we must recall SetSizeHints() */
GetSizer()->SetSizeHints(this);
}
/******************************************************************/
void DialogNonCopperZonesEditor::OnOkClick( wxCommandEvent& event )
/******************************************************************/
{
switch( m_OutlineAppearanceCtrl->GetSelection() )
{
case 0:
g_Zone_Hatching = CPolyLine::NO_HATCH;
break;
case 1:
g_Zone_Hatching = CPolyLine::DIAGONAL_EDGE;
break;
case 2:
g_Zone_Hatching = CPolyLine::DIAGONAL_FULL;
break;
}
if( m_Parent->m_Parent->m_EDA_Config )
{
m_Parent->m_Parent->m_EDA_Config->Write( ZONE_NET_OUTLINES_HATCH_OPTION_KEY,
(long) g_Zone_Hatching );
}
if( m_OrientEdgesOpt->GetSelection() == 0 )
g_Zone_45_Only = FALSE;
else
g_Zone_45_Only = TRUE;
/* Get the layer selection for this zone */
int ii = m_LayerSelectionCtrl->GetSelection();
if( ii < 0 )
{
DisplayError( this, _( "Error : you must choose a layer" ) );
return;
}
g_CurrentZone_Layer = ii + FIRST_NO_COPPER_LAYER;
EndModal( ZONE_OK );
}
/**********************************************************************/
void DialogNonCopperZonesEditor::OnCancelClick( wxCommandEvent& event )
/**********************************************************************/
{
EndModal( ZONE_ABORT );
}
/***************************************************/
int ZONE_CONTAINER::BuildFilledPolysListData( void )
/***************************************************/
/** function BuildFilledPolysListData
* Build m_FilledPolysList data from real outlines (m_Poly)
* in order to have drawable (and plottable) filled polygons
* drawable filled polygons are polygons without hole
* @return number of polygons
* Currently useable only for non copper zones
*/
{
/* Currently only for non copper zones */
if ( IsOnCopperLayer() )
return 0;
m_FilledPolysList.clear();
/* convert outlines + holes to outlines without holes (adding extra segments if necessary)
* m_Poly data is expected normalized, i.e. NormalizeAreaOutlines was used after building this zone
*/
m_Poly->MakeKboolPoly( -1, -1, NULL, true );
int count = 0;
while( m_Poly->GetKboolEngine()->StartPolygonGet() )
{
CPolyPt corner(0,0,false);
while( m_Poly->GetKboolEngine()->PolygonHasMorePoints() )
{
corner.x = (int)m_Poly->GetKboolEngine()->GetPolygonXPoint();
corner.y = (int)m_Poly->GetKboolEngine()->GetPolygonYPoint();
corner.end_contour = false;
m_FilledPolysList.push_back(corner);
count ++;
}
corner.end_contour = true;
m_FilledPolysList.pop_back();
m_FilledPolysList.push_back(corner);
m_Poly->GetKboolEngine()->EndPolygonGet();
}
m_Poly->FreeKboolEngine();
return count;
}

View File

@ -328,6 +328,7 @@ int BOARD::AreaPolygonModified( ZONE_CONTAINER* modified_area,
return test;
// now see if we need to clip against other areas
int layer = modified_area->GetLayer();
bool bCheckAllAreas = false;
if( test == 1 )
bCheckAllAreas = true;
@ -336,6 +337,15 @@ int BOARD::AreaPolygonModified( ZONE_CONTAINER* modified_area,
if( bCheckAllAreas )
CombineAllAreasInNet( modified_area->GetNet(), bMessageBoxInt, true );
if ( layer >= FIRST_NO_COPPER_LAYER ) // Refill non copper zones on this layer
{
if( m_ZoneDescriptorList.size() > 0 )
{
for( unsigned ia = 0; ia < m_ZoneDescriptorList.size(); ia++ )
if( m_ZoneDescriptorList[ia]->GetLayer() == layer )
m_ZoneDescriptorList[ia]->BuildFilledPolysListData( );
}
}
return test;
}
@ -878,6 +888,9 @@ int BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_E
for( int ia = 0; ia < GetAreaCount(); ia++ )
{
ZONE_CONTAINER* Area_Ref = GetArea( ia );
if ( ! Area_Ref->IsOnCopperLayer() )
continue;
if( aArea_To_Examine && (aArea_To_Examine != Area_Ref) )
continue;
for( int ia2 = 0; ia2 < GetAreaCount(); ia2++ )
@ -1026,6 +1039,9 @@ int BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_E
bool DRC::doEdgeZoneDrc( ZONE_CONTAINER* aArea, int aCornerIndex )
{
if ( ! aArea->IsOnCopperLayer() ) // Cannot have a Drc error if not on copper layer
return true;
wxString str;
wxPoint start = aArea->GetCornerPosition( aCornerIndex );

View File

@ -250,9 +250,14 @@ int CPolyLine::AddPolygonsToBoolEng( Bool_Engine* aBooleng,
* @param aEnd_contour: ending contour number (-1 = all after aStart_contour)
* combining intersecting contours if possible
* @param arc_array : return corners computed from arcs approximations in arc_array
* @param aConvertHoles = mode for holes when a boolean operation is made
* true: holes are linked into outer contours by double overlapping segments
* false: holes are not linked: in this mode contours are added clockwise
* and polygons added counter clockwise are holes (default)
* @return error: 0 if Ok, 1 if error
*/
int CPolyLine::MakeKboolPoly( int aStart_contour, int aEnd_contour, std::vector<CArc> * arc_array )
int CPolyLine::MakeKboolPoly( int aStart_contour, int aEnd_contour, std::vector<CArc> * arc_array,
bool aConvertHoles )
{
if( m_Kbool_Poly_Engine )
{
@ -493,7 +498,7 @@ int CPolyLine::MakeKboolPoly( int aStart_contour, int aEnd_contour, std::vector<
booleng->Do_Operation( BOOL_OR );
}
// now copy result to m_gpc_poly
// now use result as new polygon (delete the old one if exists)
if( m_Kbool_Poly_Engine )
delete m_Kbool_Poly_Engine;
m_Kbool_Poly_Engine = booleng;

View File

@ -28,7 +28,7 @@
* @param aConvertHoles = mode for holes when a boolean operation is made
* true: holes are linked into outer contours by double overlapping segments
* false: holes are not linked: in this mode contours are added clockwise
* and polygons added counter clockwise are holes
* and polygons added counter clockwise are holes (default)
*/
void ArmBoolEng( Bool_Engine* aBooleng, bool aConvertHoles = false );
@ -199,11 +199,16 @@ public:
* @param aEnd_contour: ending contour number (-1 = all after aStart_contour)
* combining intersecting contours if possible
* @param arc_array : return data on arcs in arc_array
* @param aConvertHoles = mode for holes when a boolean operation is made
* true: holes are linked into outer contours by double overlapping segments
* false: holes are not linked: in this mode contours are added clockwise
* and polygons added counter clockwise are holes (default)
* @return error: 0 if Ok, 1 if error
*/
int MakeKboolPoly( int aStart_contour = -1,
int aEnd_contour = -1,
std::vector<CArc> * arc_array = NULL );
std::vector<CArc> * arc_array = NULL,
bool aConvertHoles = false);
/** Function NormalizeWithKbool
* Use the Kbool Library to clip contours: if outlines are crossing, the self-crossing polygon
@ -217,6 +222,16 @@ public:
* @return number of external contours, or -1 if error
*/
int NormalizeWithKbool( std::vector<CPolyLine*> * aExtraPolyList, bool bRetainArcs );
/** function GetKboolEngine
* @return the current used Kbool Engine (after normalization using kbool)
*/
Bool_Engine* GetKboolEngine( ) { return m_Kbool_Poly_Engine; }
/** function FreeKboolEngine
* delete the current used Kbool Engine (free memory after normalization using kbool)
*/
void FreeKboolEngine( ) { delete m_Kbool_Poly_Engine; m_Kbool_Poly_Engine = NULL; }
private:
int m_layer; // layer to draw on

View File

@ -1,4 +1,4 @@
update=19/9/2008-05:53:18
update=23/9/2008-19:07:03
version=1
last_client=eeschema
[general]
@ -140,5 +140,6 @@ LibName24=display
LibName25=cypress
LibName26=siliconi
LibName27=opto
LibName28=contrib
LibName29=valves
LibName28=atmel
LibName29=contrib
LibName30=valves