Commit af445e70 authored by CHARRAS's avatar CHARRAS

remove the old EDGEZONE class. Cleaning code in polyline.x

parent b62a69fc
...@@ -5,6 +5,13 @@ Started 2007-June-11 ...@@ -5,6 +5,13 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2008-Jan-31 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+pcbnew:
remove the old EDGEZONE class.
A ZONE_CONTAINER class is used instead to handle the creation of a new zone outline
2008-Jan-29 UPDATE Dick Hollenbeck <dick@softplc.com> 2008-Jan-29 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================ ================================================================================
+pcbnew: +pcbnew:
......
...@@ -40,7 +40,7 @@ enum KICAD_T { ...@@ -40,7 +40,7 @@ enum KICAD_T {
TYPEMIRE, TYPEMIRE,
TYPESCREEN, TYPESCREEN,
TYPEBLOCK, TYPEBLOCK,
TYPEEDGEZONE, TYPEZONE_UNUSED,
TYPEZONE_EDGE_CORNER, TYPEZONE_EDGE_CORNER,
TYPEZONE_CONTAINER, TYPEZONE_CONTAINER,
......
...@@ -109,6 +109,9 @@ ...@@ -109,6 +109,9 @@
#define ECO2_LAYER (1 << ECO2_N) #define ECO2_LAYER (1 << ECO2_N)
#define EDGE_LAYER (1 << EDGE_N) #define EDGE_LAYER (1 << EDGE_N)
#define FIRST_NON_COPPER_LAYER ADHESIVE_N_CU
#define LAST_NON_COPPER_LAYER EDGE_N
// extra bits 0xE0000000 // extra bits 0xE0000000
/* masques generaux : */ /* masques generaux : */
#define ALL_LAYERS 0x1FFFFFFF #define ALL_LAYERS 0x1FFFFFFF
......
...@@ -35,7 +35,6 @@ class MODULE; ...@@ -35,7 +35,6 @@ class MODULE;
class TRACK; class TRACK;
class SEGZONE; class SEGZONE;
class SEGVIA; class SEGVIA;
class EDGE_ZONE;
class D_PAD; class D_PAD;
class TEXTE_MODULE; class TEXTE_MODULE;
class MIREPCB; class MIREPCB;
...@@ -268,13 +267,6 @@ public: ...@@ -268,13 +267,6 @@ public:
void Block_Duplicate( wxDC* DC ); void Block_Duplicate( wxDC* DC );
/**
* Function DelLimitesZone
* deletes the limits of a zone.
* @param DC A wxDC to draw onto.
* @param Redraw If true, means redraw the pcb without the zone limits
*/
void DelLimitesZone( wxDC* DC, bool Redraw );
// layerhandling: // layerhandling:
// (See pcbnew/sel_layer.cpp for description of why null_layer parameter is provided) // (See pcbnew/sel_layer.cpp for description of why null_layer parameter is provided)
...@@ -487,14 +479,21 @@ public: ...@@ -487,14 +479,21 @@ public:
*/ */
void Delete_Zone_Fill( wxDC* DC, SEGZONE* Track, long aTimestamp = 0 ); void Delete_Zone_Fill( wxDC* DC, SEGZONE* Track, long aTimestamp = 0 );
EDGE_ZONE* Del_LastSegmEdgeZone( wxDC* DC );
/** Function Delete_LastCreatedCorner
* Used only while creating a new zone outline
* Remove and delete the current outline segment in progress
* @return 0 if no corner in list, or corner number
*/
int Delete_LastCreatedCorner( wxDC* DC);
/** /**
* Function Begin_Zone * Function Begin_Zone
* initiates a zone edge creation process, * initiates a zone edge creation process,
* or terminates the current zone edge and creates a new zone edge stub * or terminates the current zone edge and creates a new zone edge stub
*/ */
EDGE_ZONE* Begin_Zone( wxDC* DC ); int Begin_Zone( wxDC* DC );
/** /**
* Function End_Zone * Function End_Zone
......
...@@ -36,7 +36,7 @@ BOARD::BOARD( EDA_BaseStruct* parent, WinEDA_BasePcbFrame* frame ) : ...@@ -36,7 +36,7 @@ BOARD::BOARD( EDA_BaseStruct* parent, WinEDA_BasePcbFrame* frame ) :
m_Pads = NULL; // pointeur liste d'acces aux pads m_Pads = NULL; // pointeur liste d'acces aux pads
m_Ratsnest = NULL; // pointeur liste rats m_Ratsnest = NULL; // pointeur liste rats
m_LocalRatsnest = NULL; // pointeur liste rats local m_LocalRatsnest = NULL; // pointeur liste rats local
m_CurrentLimitZone = NULL; // pointeur liste des EDEGE_ZONES m_CurrentZoneContour = NULL; // This ZONE_CONTAINER handle the zone contour cuurently in progress
// de determination des contours de zone // de determination des contours de zone
} }
...@@ -61,9 +61,6 @@ BOARD::~BOARD() ...@@ -61,9 +61,6 @@ BOARD::~BOARD()
m_Zone->DeleteStructList(); m_Zone->DeleteStructList();
m_Zone = 0; m_Zone = 0;
m_CurrentLimitZone->DeleteStructList();
m_CurrentLimitZone = 0;
MyFree( m_Pads ); MyFree( m_Pads );
m_Pads = 0; m_Pads = 0;
...@@ -75,6 +72,9 @@ BOARD::~BOARD() ...@@ -75,6 +72,9 @@ BOARD::~BOARD()
DeleteMARKERs(); DeleteMARKERs();
DeleteZONEOutlines(); DeleteZONEOutlines();
delete m_CurrentZoneContour;
m_CurrentZoneContour = NULL;
} }
...@@ -588,9 +588,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData, ...@@ -588,9 +588,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
++p; ++p;
break; break;
case TYPEEDGEZONE: case TYPEZONE_UNUSED: // Unused type
result = IterateForward( m_CurrentLimitZone, inspector, testData, p );
++p;
break; break;
default: // catch EOT or ANY OTHER type here and return. default: // catch EOT or ANY OTHER type here and return.
......
...@@ -45,7 +45,7 @@ public: ...@@ -45,7 +45,7 @@ public:
CHEVELU* m_Ratsnest; // Rastnest list CHEVELU* m_Ratsnest; // Rastnest list
CHEVELU* m_LocalRatsnest; // Rastnest list used while moving a footprint CHEVELU* m_LocalRatsnest; // Rastnest list used while moving a footprint
EDGE_ZONE* m_CurrentLimitZone; /* zone contour currently in progress */ ZONE_CONTAINER* m_CurrentZoneContour; // zone contour currently in progress
BOARD( EDA_BaseStruct* StructFather, WinEDA_BasePcbFrame* frame ); BOARD( EDA_BaseStruct* StructFather, WinEDA_BasePcbFrame* frame );
~BOARD(); ~BOARD();
......
...@@ -89,8 +89,9 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const ...@@ -89,8 +89,9 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
break; break;
case TYPEEDGEMODULE: case TYPEEDGEMODULE:
{
text << _( "Graphic" ) << wxT( " " ); text << _( "Graphic" ) << wxT( " " );
const wxChar* cp; wxString cp;
switch( ( (EDGE_MODULE*) item )->m_Shape ) switch( ( (EDGE_MODULE*) item )->m_Shape )
{ {
...@@ -126,10 +127,12 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const ...@@ -126,10 +127,12 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
cp = wxT( "??EDGE??" ); break; cp = wxT( "??EDGE??" ); break;
} }
text << *cp << _( " of " ) text << cp;
text << wxT( " (" ) << ReturnPcbLayerName( ((EDGE_MODULE*) item )->m_Layer ).Trim() << wxT( ")" );
text << _( " of " )
<< ( (MODULE*) GetParent() )->GetReference(); << ( (MODULE*) GetParent() )->GetReference();
break; break;
}
case TYPETRACK: case TYPETRACK:
// deleting tracks requires all the information we can get to // deleting tracks requires all the information we can get to
// disambiguate all the crap under the cursor! // disambiguate all the crap under the cursor!
...@@ -239,8 +242,8 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const ...@@ -239,8 +242,8 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
; ;
break; break;
case TYPEEDGEZONE: case TYPEZONE_UNUSED:
text << _( "Edge Zone" ) << _( " on " ) << ReturnPcbLayerName( item->GetLayer() ).Trim(); // @todo: extend text text << wxT( "Unused" );
break; break;
default: default:
...@@ -318,8 +321,8 @@ const char** BOARD_ITEM::MenuIcon() const ...@@ -318,8 +321,8 @@ const char** BOARD_ITEM::MenuIcon() const
xpm = add_mires_xpm; xpm = add_mires_xpm;
break; break;
case TYPEEDGEZONE: case TYPEZONE_UNUSED:
xpm = show_mod_edge_xpm; // @todo: pcb edge xpm xpm = 0; // unused
break; break;
default: default:
......
...@@ -298,70 +298,9 @@ void EDGE_MODULE::Display_Infos( WinEDA_DrawFrame* frame ) ...@@ -298,70 +298,9 @@ void EDGE_MODULE::Display_Infos( WinEDA_DrawFrame* frame )
} }
#if 0 // replaced by Save() /*******************************************/
/*****************************************/
int EDGE_MODULE::WriteDescr( FILE* File )
/*****************************************/
/* Write one EDGE_MODULE description
* File must be opened.
*/
{
int NbLigne = 0, ii, * ptr;
switch( m_Shape )
{
case S_SEGMENT:
fprintf( File, "DS %d %d %d %d %d %d\n",
m_Start0.x, m_Start0.y,
m_End0.x, m_End0.y,
m_Width, m_Layer );
NbLigne++;
break;
case S_CIRCLE:
fprintf( File, "DC %d %d %d %d %d %d\n",
m_Start0.x, m_Start0.y,
m_End0.x, m_End0.y,
m_Width, m_Layer );
NbLigne++;
break;
case S_ARC:
fprintf( File, "DA %d %d %d %d %d %d %d\n",
m_Start0.x, m_Start0.y,
m_End0.x, m_End0.y,
m_Angle,
m_Width, m_Layer );
NbLigne++;
break;
case S_POLYGON:
fprintf( File, "DP %d %d %d %d %d %d %d\n",
m_Start0.x, m_Start0.y,
m_End0.x, m_End0.y,
m_PolyCount,
m_Width, m_Layer );
NbLigne++;
for( ii = 0, ptr = m_PolyList; ii < m_PolyCount; ii++ )
{
fprintf( File, "Dl %d %d\n",
*ptr, *(ptr + 1) );
NbLigne++; ptr += 2;
}
break;
default:
DisplayError( NULL, wxT( "Type Edge Module inconnu" ) );
break;
}
return NbLigne;
}
#endif
bool EDGE_MODULE::Save( FILE* aFile ) const bool EDGE_MODULE::Save( FILE* aFile ) const
/*******************************************/
{ {
int ret = -1; int ret = -1;
...@@ -514,12 +453,15 @@ int EDGE_MODULE::ReadDescr( char* Line, FILE* File, ...@@ -514,12 +453,15 @@ int EDGE_MODULE::ReadDescr( char* Line, FILE* File,
break; break;
} }
// Controle d'epaisseur raisonnable: // Check for a reasonnable width:
if( m_Width <= 1 ) if( m_Width <= 1 )
m_Width = 1; m_Width = 1;
if( m_Width > MAX_WIDTH ) if( m_Width > MAX_WIDTH )
m_Width = MAX_WIDTH; m_Width = MAX_WIDTH;
// Check for a reasonnable layer:
if ( (m_Layer < FIRST_NON_COPPER_LAYER) || (m_Layer > LAST_NON_COPPER_LAYER) )
m_Layer = SILKSCREEN_N_CMP;
return error; return error;
} }
......
This diff is collapsed.
...@@ -73,6 +73,19 @@ public: ...@@ -73,6 +73,19 @@ public:
void Draw( WinEDA_DrawPanel* panel, wxDC* DC, void Draw( WinEDA_DrawPanel* panel, wxDC* DC,
const wxPoint& offset, int draw_mode ); const wxPoint& offset, int draw_mode );
/**
* Function DrawWhileCreateOutline
* Draws the zone outline when ir is created.
* The moving edges are in XOR graphic mode, old segment in draw_mode graphic mode (usually GR_OR)
* The closing edge has its owm shape
* @param panel = current Draw Panel
* @param DC = current Device Context
* @param draw_mode = draw mode: OR, XOR ..
*/
void DrawWhileCreateOutline( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode = GR_OR );
int GetNet( void ) const int GetNet( void ) const
{ {
return m_NetCode; return m_NetCode;
...@@ -158,73 +171,36 @@ public: ...@@ -158,73 +171,36 @@ public:
{ {
return wxT( "ZONE_CONTAINER" ); return wxT( "ZONE_CONTAINER" );
} }
};
/** Acces to m_Poly parameters
/*******************/
/* class EDGE_ZONE */
/*******************/
/* Classe used temporary to create a zone outline.
*
* TODO: remove this class and use only the ZONE_CONTAINER::m_Poly
* to create outlines
*/ */
class EDGE_ZONE : public DRAWSEGMENT
{
private:
int m_NetCode;
public: int GetNumCorners(void)
EDGE_ZONE( BOARD * StructFather );
~EDGE_ZONE();
EDGE_ZONE* Next()
{ {
return (EDGE_ZONE*) Pnext; return m_Poly->GetNumCorners();
} }
EDGE_ZONE* Back() void RemoveAllContours(void)
{ {
return (EDGE_ZONE*) Pback; m_Poly->RemoveAllContours();
} }
int GetNet( void ) const wxPoint GetCornerPosition(int aCornerIndex)
{ {
return m_NetCode; return wxPoint(m_Poly->GetX(aCornerIndex), m_Poly->GetY(aCornerIndex));
} }
void SetNet( int anet_code )
void SetCornerPosition(int aCornerIndex, wxPoint new_pos)
{ {
m_NetCode = anet_code; m_Poly->SetX(aCornerIndex, new_pos.x);
m_Poly->SetY(aCornerIndex, new_pos.y);
} }
/** void AppendCorner( wxPoint position )
* Function Display_Infos
* has knowledge about the frame and how and where to put status information
* about this object into the frame's message panel.
* Is virtual from EDA_BaseStruct.
* @param frame A WinEDA_BasePcbFrame in which to print status information.
*/
void Display_Infos( WinEDA_DrawFrame* frame );
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @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" ); m_Poly->AppendCorner( position.x, position.y );
} }
}; };
#endif // #ifndef CLASS_ZONE_H #endif // #ifndef CLASS_ZONE_H
...@@ -157,22 +157,23 @@ int DRC::Drc( TRACK* aRefSegm, TRACK* aList ) ...@@ -157,22 +157,23 @@ int DRC::Drc( TRACK* aRefSegm, TRACK* aList )
} }
/*********************************************/ /**************************************************************/
int DRC::Drc( const EDGE_ZONE* aEdge ) int DRC::Drc( ZONE_CONTAINER * aArea, int CornerIndex )
/*********************************************/ /*************************************************************/
/** /**
* Function Drc * Function Drc
* tests the current EDGE_ZONE segment and returns the result and displays the error * tests the outline segment starting at CornerIndex and returns the result and displays the error
* in the status panel only if one exists. * in the status panel only if one exists.
* Test Edge inside other areas * Test Edge inside other areas
* Test Edge too close other areas * Test Edge too close other areas
* @param aEdge The current segment to test. * @param aEdge The areaparent which contains the corner.
* @param CornerIndex The starting point of the segment to test.
* @return int - BAD_DRC (1) if DRC error or OK_DRC (0) if OK * @return int - BAD_DRC (1) if DRC error or OK_DRC (0) if OK
*/ */
{ {
updatePointers(); updatePointers();
if( ! doEdgeZoneDrc( aEdge ) ) if( ! doEdgeZoneDrc( aArea, CornerIndex ) )
{ {
wxASSERT( m_currentMarker ); wxASSERT( m_currentMarker );
m_currentMarker->Display_Infos( m_mainWindow ); m_currentMarker->Display_Infos( m_mainWindow );
...@@ -461,9 +462,10 @@ MARKER* DRC::fillMarker( ZONE_CONTAINER * aArea, int aErrorCode, MARKER* fillMe ...@@ -461,9 +462,10 @@ MARKER* DRC::fillMarker( ZONE_CONTAINER * aArea, int aErrorCode, MARKER* fillMe
return fillMe; return fillMe;
} }
MARKER* DRC::fillMarker( const EDGE_ZONE * aEdge, const wxPoint & aPos, int aErrorCode, MARKER* fillMe )
MARKER* DRC::fillMarker( const ZONE_CONTAINER * aArea, const wxPoint & aPos, int aErrorCode, MARKER* fillMe )
{ {
wxString textA = aEdge->MenuText( m_pcb ); wxString textA = aArea->MenuText( m_pcb );
wxPoint posA = aPos; wxPoint posA = aPos;
......
...@@ -373,7 +373,7 @@ private: ...@@ -373,7 +373,7 @@ private:
* @param fillMe A MARKER* which is to be filled in, or NULL if one is to * @param fillMe A MARKER* which is to be filled in, or NULL if one is to
* first be allocated, then filled. * first be allocated, then filled.
*/ */
MARKER* fillMarker( const EDGE_ZONE * aEdge, const wxPoint & aPos, int aErrorCode, MARKER* fillMe ); MARKER* fillMarker( const ZONE_CONTAINER * aArea, const wxPoint & aPos, int aErrorCode, MARKER* fillMe );
//-----<categorical group tests>----------------------------------------- //-----<categorical group tests>-----------------------------------------
...@@ -413,14 +413,15 @@ private: ...@@ -413,14 +413,15 @@ private:
/** /**
* Function doEdgeZoneDrc * Function doEdgeZoneDrc
* tests the current EDGE_ZONE segment: * tests a segment in ZONE_CONTAINER * aArea:
* Test Edge inside other areas * Test Edge inside other areas
* Test Edge too close other areas * Test Edge too close other areas
* @param aEdge The current segment to test. * @param aArea The current area.
* @param aCornerIndex The first corner of the segment to test.
* @return bool - false if DRC error or true if OK * @return bool - false if DRC error or true if OK
*/ */
bool doEdgeZoneDrc( const EDGE_ZONE* aEdge ); bool doEdgeZoneDrc( ZONE_CONTAINER * aArea, int aCornerIndex );
//-----<single tests>---------------------------------------------- //-----<single tests>----------------------------------------------
...@@ -496,14 +497,15 @@ public: ...@@ -496,14 +497,15 @@ public:
/** /**
* Function Drc * Function Drc
* tests the current EDGE_ZONE segment and returns the result and displays the error * tests the outline segment starting at CornerIndex and returns the result and displays the error
* in the status panel only if one exists. * in the status panel only if one exists.
* Test Edge inside other areas * Test Edge inside other areas
* Test Edge too close other areas * Test Edge too close other areas
* @param aEdge The current segment to test. * @param aEdge The areaparent which contains the corner.
* @param CornerIndex The starting point of the segment to test.
* @return int - BAD_DRC (1) if DRC error or OK_DRC (0) if OK * @return int - BAD_DRC (1) if DRC error or OK_DRC (0) if OK
*/ */
int Drc( const EDGE_ZONE* aEdge ); int Drc( ZONE_CONTAINER * aArea, int CornerIndex );
/** /**
* Function DrcBlind * Function DrcBlind
......
...@@ -267,7 +267,6 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -267,7 +267,6 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
SetToolID( id, wxCURSOR_PENCIL, _( "Add Zones" ) ); SetToolID( id, wxCURSOR_PENCIL, _( "Add Zones" ) );
if( !DisplayOpt.DisplayZones ) if( !DisplayOpt.DisplayZones )
DisplayInfo( this, _( "Warning: Display Zone is OFF!!!" ) ); DisplayInfo( this, _( "Warning: Display Zone is OFF!!!" ) );
DelLimitesZone( &dc, TRUE );
if( !g_HightLigt_Status && (g_HightLigth_NetCode > 0 ) ) if( !g_HightLigt_Status && (g_HightLigth_NetCode > 0 ) )
Hight_Light( &dc ); Hight_Light( &dc );
break; break;
...@@ -821,7 +820,8 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -821,7 +820,8 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
if( GetCurItem() && (GetCurItem()->m_Flags & IS_NEW) ) if( GetCurItem() && (GetCurItem()->m_Flags & IS_NEW) )
{ {
SetCurItem( Del_LastSegmEdgeZone( &dc ) ); if ( Delete_LastCreatedCorner( &dc ) == 0) // No more segment in outline,
SetCurItem(NULL);
} }
break; break;
......
...@@ -145,8 +145,6 @@ bool WinEDA_BasePcbFrame::Clear_Pcb( bool query ) ...@@ -145,8 +145,6 @@ bool WinEDA_BasePcbFrame::Clear_Pcb( bool query )
m_Pcb->m_Zone = NULL; m_Pcb->m_Zone = NULL;
m_Pcb->m_NbSegmZone = 0; m_Pcb->m_NbSegmZone = 0;
DelLimitesZone( NULL, FALSE );
m_Pcb->DeleteMARKERs(); m_Pcb->DeleteMARKERs();
m_Pcb->DeleteZONEOutlines(); m_Pcb->DeleteZONEOutlines();
...@@ -222,7 +220,6 @@ void WinEDA_PcbFrame::Erase_Zones( bool query ) ...@@ -222,7 +220,6 @@ void WinEDA_PcbFrame::Erase_Zones( bool query )
m_Pcb->m_NbSegmZone = 0; m_Pcb->m_NbSegmZone = 0;
} }
DelLimitesZone( NULL, FALSE );
m_Pcb->DeleteZONEOutlines(); m_Pcb->DeleteZONEOutlines();
GetScreen()->SetModify(); GetScreen()->SetModify();
......
...@@ -39,6 +39,9 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -39,6 +39,9 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
switch( DrawStruct->Type() ) switch( DrawStruct->Type() )
{ {
case TYPEZONE_CONTAINER: case TYPEZONE_CONTAINER:
if ( (DrawStruct->m_Flags & IS_NEW) )
Begin_Zone( DC );
else
End_Move_Zone_Corner_Or_Outlines( DC, (ZONE_CONTAINER *) DrawStruct ); End_Move_Zone_Corner_Or_Outlines( DC, (ZONE_CONTAINER *) DrawStruct );
exit = true; exit = true;
break; break;
...@@ -220,13 +223,19 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -220,13 +223,19 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
case ID_PCB_ZONES_BUTT: case ID_PCB_ZONES_BUTT:
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{ {
GetScreen()->SetCurItem( DrawStruct = Begin_Zone( DC ) ); if ( Begin_Zone( DC ) )
{
DrawStruct = m_Pcb->m_CurrentZoneContour;
GetScreen()->SetCurItem( DrawStruct );
}
} }
else if( DrawStruct else if( DrawStruct
&& (DrawStruct->Type() == TYPEEDGEZONE) && (DrawStruct->Type() == TYPEZONE_CONTAINER)
&& (DrawStruct->m_Flags & IS_NEW) ) && (DrawStruct->m_Flags & IS_NEW) )
{ {
GetScreen()->SetCurItem( DrawStruct = Begin_Zone( DC ) ); Begin_Zone( DC );
DrawStruct = m_Pcb->m_CurrentZoneContour;
GetScreen()->SetCurItem( DrawStruct );
} }
else else
DisplayError( this, wxT( "Edit: zone internal error" ) ); DisplayError( this, wxT( "Edit: zone internal error" ) );
......
...@@ -277,20 +277,18 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) ...@@ -277,20 +277,18 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
case TYPEZONE: // Item used to fill a zone case TYPEZONE: // Item used to fill a zone
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_ZONE, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_ZONE,
_( "Delete Zone" ), delete_xpm ); _( "Delete Zone Filling" ), delete_xpm );
break; break;
case TYPEEDGEZONE: // Graphic Item used to create a new zone outline case TYPEZONE_CONTAINER: // Item used to handle a zone area (outlines, holes ...)
if( flags & IS_NEW ) if( flags & IS_NEW )
{ {
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_STOP_CURRENT_EDGE_ZONE, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_STOP_CURRENT_EDGE_ZONE,
_( "End edge zone" ), apply_xpm ); _( "Close Zone Outline" ), apply_xpm );
}
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_ZONE_LAST_CREATED_CORNER, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_ZONE_LAST_CREATED_CORNER,
_( "Delete Current Edge" ), delete_xpm ); _( "Delete Last Corner" ), delete_xpm );
break; }
else
case TYPEZONE_CONTAINER: // Item used to handle a zone area (outlines, holes ...)
createPopUpMenuForZones( (ZONE_CONTAINER*) item, aPopMenu ); createPopUpMenuForZones( (ZONE_CONTAINER*) item, aPopMenu );
break; break;
......
...@@ -176,18 +176,10 @@ void WinEDA_PcbFrame::Trace_Pcb( wxDC* DC, int mode ) ...@@ -176,18 +176,10 @@ void WinEDA_PcbFrame::Trace_Pcb( wxDC* DC, int mode )
if( g_HightLigt_Status ) if( g_HightLigt_Status )
DrawHightLight( DC, g_HightLigth_NetCode ); DrawHightLight( DC, g_HightLigth_NetCode );
EDGE_ZONE* segment;
for( segment = m_Pcb->m_CurrentLimitZone; segment; segment = segment->Next() )
{
if( segment->m_Flags & IS_MOVED )
continue;
Trace_DrawSegmentPcb( DrawPanel, DC, segment, mode );
}
for( unsigned ii = 0; ii < m_Pcb->m_ZoneDescriptorList.size(); ii++ ) for( unsigned ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
{ {
ZONE_CONTAINER* edge_zone = m_Pcb->m_ZoneDescriptorList[ii]; ZONE_CONTAINER* edge_zone = m_Pcb->GetArea(ii);
edge_zone->Draw( DrawPanel, DC, wxPoint(0,0), mode); edge_zone->Draw( DrawPanel, DC, wxPoint(0,0), mode);
} }
......
...@@ -196,7 +196,12 @@ int ZONE_CONTAINER::Fill_Zone( WinEDA_PcbFrame* frame, wxDC* DC, bool verbose ) ...@@ -196,7 +196,12 @@ int ZONE_CONTAINER::Fill_Zone( WinEDA_PcbFrame* frame, wxDC* DC, bool verbose )
if( cells_count == 0 ) if( cells_count == 0 )
{ {
if( verbose ) if( verbose )
DisplayError( frame, _( "No pads or starting point found to fill this zone outline" ) ); {
msg = _( "No pads or starting point found to fill this zone outline" );
msg << wxT("\n");
msg << MenuText( frame->m_Pcb );
DisplayError( frame, msg );
}
error_level = 2; error_level = 2;
goto end_of_zone_fill; goto end_of_zone_fill;
} }
......
This diff is collapsed.
...@@ -65,8 +65,7 @@ ZONE_CONTAINER* BOARD::InsertArea( int netcode, int iarea, int layer, int x, int ...@@ -65,8 +65,7 @@ ZONE_CONTAINER* BOARD::InsertArea( int netcode, int iarea, int layer, int x, int
else else
m_ZoneDescriptorList.push_back( new_area ); m_ZoneDescriptorList.push_back( new_area );
new_area->m_Poly->Start( layer, 1, 10 * NM_PER_MIL, x, y, new_area->m_Poly->Start( layer, x, y, hatch );
hatch );
return new_area; return new_area;
} }
...@@ -744,7 +743,7 @@ int BOARD::CombineAreas( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area_to_combi ...@@ -744,7 +743,7 @@ int BOARD::CombineAreas( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area_to_combi
if( i==0 ) if( i==0 )
{ {
area_ref->m_Poly->Start( area_ref->GetLayer( area_ref->m_Poly->Start( area_ref->GetLayer(
), 0, 0, x, y, area_ref->m_Poly->GetHatchStyle() ); ), x, y, area_ref->m_Poly->GetHatchStyle() );
} }
else else
area_ref->m_Poly->AppendCorner( x, y ); area_ref->m_Poly->AppendCorner( x, y );
...@@ -997,38 +996,60 @@ int BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_E ...@@ -997,38 +996,60 @@ int BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_E
/** /**
* Function doEdgeZoneDrc * Function doEdgeZoneDrc
* tests the current EDGE_ZONE segment and returns the result and displays the error * tests a segment in ZONE_CONTAINER * aArea:
* in the status panel only if one exists.
* Test Edge inside other areas * Test Edge inside other areas
* Test Edge too close other areas * Test Edge too close other areas
* @param aEdge The current segment to test. * @param aArea The current area.
* @param aCornerIndex The first corner of the segment to test.
* @return bool - false if DRC error or true if OK * @return bool - false if DRC error or true if OK
*/ */
bool DRC::doEdgeZoneDrc( const EDGE_ZONE* aEdge ) bool DRC::doEdgeZoneDrc( ZONE_CONTAINER * aArea, int aCornerIndex )
{ {
wxString str; wxString str;
wxPoint start = aArea->GetCornerPosition(aCornerIndex);
wxPoint end;
// Search the end point of the edge starting at aCornerIndex
if( aArea->m_Poly->corner[aCornerIndex].end_contour == FALSE &&
aCornerIndex < (aArea->GetNumCorners() - 1) )
{
end = aArea->GetCornerPosition(aCornerIndex+1);
}
else // aCornerIndex is the last corner of an outline.
// the corresponding end point of the segment is the first corner of the outline
{
int ii = aCornerIndex-1;
end = aArea->GetCornerPosition(ii);
while ( ii >= 0 )
{
if ( aArea->m_Poly->corner[ii].end_contour )
break;
end = aArea->GetCornerPosition(ii);
ii--;
}
}
// iterate through all areas // iterate through all areas
for( int ia2 = 0; ia2 < m_pcb->GetAreaCount(); ia2++ ) for( int ia2 = 0; ia2 < m_pcb->GetAreaCount(); ia2++ )
{ {
ZONE_CONTAINER* Area_To_Test = m_pcb->GetArea( ia2 ); ZONE_CONTAINER* Area_To_Test = m_pcb->GetArea( ia2 );
// test for same layer // test for same layer
if( Area_To_Test->GetLayer() != aEdge->GetLayer() ) if( Area_To_Test->GetLayer() != aArea->GetLayer() )
continue; continue;
// Test for same net // Test for same net
if( (aEdge->GetNet() == Area_To_Test->GetNet()) && (aEdge->GetNet() > 0) ) if( (aArea->GetNet() == Area_To_Test->GetNet()) && (aArea->GetNet() > 0) )
continue; continue;
// test for ending line inside Area_To_Test // test for ending line inside Area_To_Test
int x = aEdge->m_End.x; int x = end.x;
int y = aEdge->m_End.y; int y = end.y;
if( Area_To_Test->m_Poly->TestPointInside( x, y ) ) if( Area_To_Test->m_Poly->TestPointInside( x, y ) )
{ {
// COPPERAREA_COPPERAREA error: corner inside copper area // COPPERAREA_COPPERAREA error: corner inside copper area
m_currentMarker = fillMarker( aEdge, wxPoint( x, y ), m_currentMarker = fillMarker( aArea, wxPoint( x, y ),
COPPERAREA_INSIDE_COPPERAREA, COPPERAREA_INSIDE_COPPERAREA,
m_currentMarker ); m_currentMarker );
return false; return false;
...@@ -1036,10 +1057,10 @@ bool DRC::doEdgeZoneDrc( const EDGE_ZONE* aEdge ) ...@@ -1036,10 +1057,10 @@ bool DRC::doEdgeZoneDrc( const EDGE_ZONE* aEdge )
// now test spacing between areas // now test spacing between areas
int astyle = CPolyLine::STRAIGHT; int astyle = CPolyLine::STRAIGHT;
int ax1 = aEdge->m_Start.x; int ax1 = start.x;
int ay1 = aEdge->m_Start.y; int ay1 = start.y;
int ax2 = aEdge->m_End.x; int ax2 = end.x;
int ay2 = aEdge->m_End.y; int ay2 = end.y;
for( int icont2 = 0; icont2 < Area_To_Test->m_Poly->GetNumContours(); icont2++ ) for( int icont2 = 0; icont2 < Area_To_Test->m_Poly->GetNumContours(); icont2++ )
{ {
int ic_start2 = Area_To_Test->m_Poly->GetContourStart( icont2 ); int ic_start2 = Area_To_Test->m_Poly->GetContourStart( icont2 );
...@@ -1070,7 +1091,7 @@ bool DRC::doEdgeZoneDrc( const EDGE_ZONE* aEdge ) ...@@ -1070,7 +1091,7 @@ bool DRC::doEdgeZoneDrc( const EDGE_ZONE* aEdge )
if( d < g_DesignSettings.m_ZoneClearence ) if( d < g_DesignSettings.m_ZoneClearence )
{ {
// COPPERAREA_COPPERAREA error : edge intersect or too close // COPPERAREA_COPPERAREA error : edge intersect or too close
m_currentMarker = fillMarker( aEdge, wxPoint( x, y ), m_currentMarker = fillMarker( aArea, wxPoint( x, y ),
COPPERAREA_CLOSE_TO_COPPERAREA, COPPERAREA_CLOSE_TO_COPPERAREA,
m_currentMarker ); m_currentMarker );
return false; return false;
......
...@@ -22,7 +22,7 @@ using namespace std; ...@@ -22,7 +22,7 @@ using namespace std;
CPolyLine::CPolyLine() CPolyLine::CPolyLine()
{ {
m_HatchStyle = 0; m_HatchStyle = 0;
m_sel_box = 0; m_Width = 0;
utility = 0; utility = 0;
m_gpc_poly = new gpc_polygon; m_gpc_poly = new gpc_polygon;
m_gpc_poly->num_contours = 0; m_gpc_poly->num_contours = 0;
...@@ -72,7 +72,7 @@ int CPolyLine::NormalizeWithGpc( std::vector<CPolyLine*> * pa, bool bRetainArcs ...@@ -72,7 +72,7 @@ int CPolyLine::NormalizeWithGpc( std::vector<CPolyLine*> * pa, bool bRetainArcs
int x = to_int(((m_gpc_poly->contour)[ic].vertex)[i].x); int x = to_int(((m_gpc_poly->contour)[ic].vertex)[i].x);
int y = to_int(((m_gpc_poly->contour)[ic].vertex)[i].y); int y = to_int(((m_gpc_poly->contour)[ic].vertex)[i].y);
if( i==0 ) if( i==0 )
Start( m_layer, m_Width, m_sel_box, x, y, m_HatchStyle ); Start( m_layer, x, y, m_HatchStyle );
else else
AppendCorner( x, y, STRAIGHT, FALSE ); AppendCorner( x, y, STRAIGHT, FALSE );
} }
...@@ -89,7 +89,7 @@ int CPolyLine::NormalizeWithGpc( std::vector<CPolyLine*> * pa, bool bRetainArcs ...@@ -89,7 +89,7 @@ int CPolyLine::NormalizeWithGpc( std::vector<CPolyLine*> * pa, bool bRetainArcs
int x = to_int(((m_gpc_poly->contour)[ic].vertex)[i].x); int x = to_int(((m_gpc_poly->contour)[ic].vertex)[i].x);
int y = to_int(((m_gpc_poly->contour)[ic].vertex)[i].y); int y = to_int(((m_gpc_poly->contour)[ic].vertex)[i].y);
if( i==0 ) if( i==0 )
poly->Start( m_layer, m_Width, m_sel_box, x, y, m_HatchStyle ); poly->Start( m_layer, x, y, m_HatchStyle );
else else
poly->AppendCorner( x, y, STRAIGHT, FALSE ); poly->AppendCorner( x, y, STRAIGHT, FALSE );
} }
...@@ -199,10 +199,7 @@ void CPolyLine::ClipPhpPolygon( int php_op, CPolyLine * poly ) ...@@ -199,10 +199,7 @@ void CPolyLine::ClipPhpPolygon( int php_op, CPolyLine * poly )
do do
{ {
vertex * v = p->getFirst(); vertex * v = p->getFirst();
Start( m_layer, m_Width, m_sel_box, Start( m_layer, to_int(v->X()*DENOM), to_int(v->Y()*DENOM), m_HatchStyle );
to_int(v->X()*DENOM),
to_int(v->Y()*DENOM),
m_HatchStyle );
do do
{ {
vertex * n = v->Next(); vertex * n = v->Next();
...@@ -606,12 +603,9 @@ int CPolyLine::RestoreArcs( std::vector<CArc> * arc_array, std::vector<CPolyLine ...@@ -606,12 +603,9 @@ int CPolyLine::RestoreArcs( std::vector<CArc> * arc_array, std::vector<CPolyLine
// id.i = index to area // id.i = index to area
// ptr = pointer to net // ptr = pointer to net
// //
void CPolyLine::Start( int layer, int w, int sel_box, int x, int y, void CPolyLine::Start( int layer, int x, int y, int hatch )
int hatch )
{ {
m_layer = layer; m_layer = layer;
m_Width = w;
m_sel_box = sel_box;
m_HatchStyle = hatch; m_HatchStyle = hatch;
CPolyPt poly_pt( x, y ); CPolyPt poly_pt( x, y );
poly_pt.end_contour = FALSE; poly_pt.end_contour = FALSE;
...@@ -1002,7 +996,7 @@ void CPolyLine::Hatch() ...@@ -1002,7 +996,7 @@ void CPolyLine::Hatch()
int layer = m_layer; int layer = m_layer;
// if( /*m_dlist && */GetClosed() ) if( GetClosed() ) // If not closed, the poly is beeing created and not finalised. Not not hatch
{ {
enum { enum {
MAXPTS = 100, MAXPTS = 100,
...@@ -1082,7 +1076,7 @@ void CPolyLine::Hatch() ...@@ -1082,7 +1076,7 @@ void CPolyLine::Hatch()
{ {
double x, y, x2, y2; double x, y, x2, y2;
int ok; int ok;
if( corner[ic].end_contour ) if( corner[ic].end_contour || (ic == (int)(corner.size()-1)) )
{ {
ok = FindLineSegmentIntersection( a, slope, ok = FindLineSegmentIntersection( a, slope,
corner[ic].x, corner[ic].y, corner[ic].x, corner[ic].y,
...@@ -1396,7 +1390,7 @@ CPolyLine * CPolyLine::MakePolylineForPad( int type, int x, int y, int w, int l, ...@@ -1396,7 +1390,7 @@ CPolyLine * CPolyLine::MakePolylineForPad( int type, int x, int y, int w, int l,
} }
if( type == PAD_ROUND ) if( type == PAD_ROUND )
{ {
poly->Start( 0, 0, 0, x-dx, y, 0 ); poly->Start( 0, x-dx, y, 0 );
poly->AppendCorner( x, y+dy, ARC_CW, 0 ); poly->AppendCorner( x, y+dy, ARC_CW, 0 );
poly->AppendCorner( x+dx, y, ARC_CW, 0 ); poly->AppendCorner( x+dx, y, ARC_CW, 0 );
poly->AppendCorner( x, y-dy, ARC_CW, 0 ); poly->AppendCorner( x, y-dy, ARC_CW, 0 );
......
...@@ -69,8 +69,7 @@ public: ...@@ -69,8 +69,7 @@ public:
~CPolyLine(); ~CPolyLine();
// functions for modifying polyline // functions for modifying polyline
void Start( int layer, int w, int sel_box, int x, int y, void Start( int layer, int x, int y, int hatch );
int hatch );
void AppendCorner( int x, int y, int style = STRAIGHT, bool bDraw=TRUE ); void AppendCorner( int x, int y, int style = STRAIGHT, bool bDraw=TRUE );
void InsertCorner( int ic, int x, int y ); void InsertCorner( int ic, int x, int y );
void DeleteCorner( int ic, bool bDraw=TRUE ); void DeleteCorner( int ic, bool bDraw=TRUE );
...@@ -138,8 +137,7 @@ public: ...@@ -138,8 +137,7 @@ public:
private: private:
int m_layer; // layer to draw on int m_layer; // layer to draw on
int m_Width; // line width int m_Width; // lines width when drawing. Provided but not really used
int m_sel_box; // corner selection box width/2
int utility; int utility;
public: public:
std::vector <CPolyPt> corner; // array of points for corners std::vector <CPolyPt> corner; // array of points for corners
......
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