Commit 6c3235c1 authored by CHARRAS's avatar CHARRAS

first DRC control about zone outlines. Needs improvements, but works

parent 8d90da0a
......@@ -259,6 +259,21 @@ public:
return NULL;
}
/**
* Function GetAreaIndex
* returns the Area Index for the given Zone Container.
* @param aArea :The ZONE_CONTAINER to find.
* @return an Area Index in m_ZoneDescriptorList or -1 if non found.
*/
int GetAreaIndex( const ZONE_CONTAINER* aArea) const
{
for( int ii = 0; ii < GetAreaCount(); ii++ ) // Search for aArea in list
{
if ( aArea == GetArea( ii ) ) // Found !
return ii;
}
return -1;
}
/**
* Function GetAreaCount
......@@ -385,6 +400,16 @@ public:
*/
int CombineAreas( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area_to_combine );
/**
* Function Test_Drc_Areas_Outlines_To_Areas_Outlines
* Test Areas outlines for DRC:
* Test areas inside other areas
* Test areas too close
* @param aArea_To_Examine: area to compare with other areas. if NULL: all areas are compared tp all others
* @param aCreate_Markers: if true create DRC markers. False: do not creates anything
* @return errors count
*/
int Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_Examine,bool aCreate_Markers );
};
#endif // #ifndef CLASS_BOARD_H
......@@ -65,6 +65,10 @@ wxString DRC_ITEM::GetErrorText() const
return wxString( _("Pad near pad") );
case DRCE_VIA_HOLE_BIGGER:
return wxString( _("Via hole > diameter"));
case COPPERAREA_INSIDE_COPPERAREA:
return wxString( _("Copper area inside copper area"));
case COPPERAREA_CLOSE_TO_COPPERAREA:
return wxString( _("Copper areas intersect or too close"));
default:
return wxString( wxT("PROGRAM BUG, PLEASE LEAVE THE ROOM.") );
......
......@@ -113,7 +113,7 @@ void MARKER::Display_Infos( WinEDA_DrawFrame* frame )
wxString errorTxt;
errorTxt << _("ErrType") << wxT("(") << rpt.GetErrorCode() << wxT(")- ") << rpt.GetErrorText() << wxT(":");
errorTxt << _("ErrType") << wxT("(") << rpt.GetErrorCode() << wxT(")- ") << rpt.GetErrorText() << wxT(":");
text_pos = 5;
Affiche_1_Parametre( frame, text_pos, errorTxt, wxEmptyString, RED );
......@@ -124,8 +124,8 @@ void MARKER::Display_Infos( WinEDA_DrawFrame* frame )
wxString txtB;
txtB << DRC_ITEM::ShowCoord( rpt.GetPointB() ) << wxT(": ") << rpt.GetTextB();
text_pos = 20; // @todo pick a better color here
Affiche_1_Parametre( frame, text_pos, txtA, txtB, BLACK );
text_pos = 25;
Affiche_1_Parametre( frame, text_pos, txtA, txtB, DARKBROWN );
}
......
......@@ -35,7 +35,7 @@
const KICAD_T GENERAL_COLLECTOR::AllBoardItems[] = {
// there are some restrictions on the order of items in the general case.
// all items in m_Drawings for instance should be contiguous.
// *** all items in a same list (shown here) must be contigous ****
// *** all items in a same list (shown here) must be contiguous ****
TYPEMARKER, // in m_markers
TYPETEXTE, // in m_Drawings
TYPEDRAWSEGMENT, // in m_Drawings
......
......@@ -290,6 +290,10 @@ void WinEDA_ZoneFrame::CreateControls()
if ( m_Zone_Container )
s_Zone_Hatching = m_Zone_Container->m_Poly->GetHatchStyle();
else
s_Zone_Hatching = m_Parent->m_Parent->m_EDA_Config->Read( ZONE_NET_OUTLINES_HATCH_OPTION_KEY,
(long) CPolyLine::DIAGONAL_EDGE );
switch( s_Zone_Hatching )
{
case CPolyLine::NO_HATCH:
......@@ -461,6 +465,11 @@ bool WinEDA_ZoneFrame::AcceptOptions(bool aPromptForErrors)
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);
}
switch( m_GridCtrl->GetSelection() )
{
case 0:
......
......@@ -285,6 +285,10 @@ void DRC::testUnconnected()
void DRC::testZones()
{
// Test copper areas outlines, and create markers when needed
m_pcb->Test_Drc_Areas_Outlines_To_Areas_Outlines( NULL, true );
TRACK* zoneSeg;
/* this was for display purposes, don't know that we need it anymore
......@@ -293,7 +297,7 @@ void DRC::testZones()
++m_pcb->m_NbSegmZone;
*/
for( zoneSeg = m_pcb->m_Zone; zoneSeg && zoneSeg->Next(); zoneSeg=zoneSeg->Next() )
for( zoneSeg = m_pcb->m_Zone; zoneSeg && zoneSeg->Next(); zoneSeg=zoneSeg->Next() )
{
// Test zoneSeg with other zone segments and with all pads
if( !doTrackDrc( zoneSeg, zoneSeg->Next() ) )
......
......@@ -54,7 +54,8 @@
#define DRCE_ENDS_PROBLEM5 18 ///< track ends are too close
#define DRCE_PAD_NEAR_PAD1 19 ///< pad too close to pad
#define DRCE_VIA_HOLE_BIGGER 20 ///< via's hole is bigger than its diameter
#define COPPERAREA_INSIDE_COPPERAREA 21 ///< copper area outlines intersect
#define COPPERAREA_CLOSE_TO_COPPERAREA 22 ///< copper area outlines are too close
/**
* Class DRC_ITEM
......
/////////////////////////////////////////////////////////////////////////////
// Name: zones_by_polygon.cpp
// Licence: GNU License
// Licence: GPL License
/////////////////////////////////////////////////////////////////////////////
#if defined (__GNUG__) && !defined (NO_GCC_PRAGMA)
......@@ -35,7 +34,7 @@ using namespace std;
/* Local functions */
// Outile creation:
// Outline creation:
static void Abort_Zone_Create_Outline( WinEDA_DrawPanel* Panel, wxDC* DC );
static void Show_New_Zone_Edge_While_Move_Mouse( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
......@@ -54,7 +53,8 @@ static bool s_CornerIsNew; // Used to abort
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
// key used to store net sort option in config file :
// 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" )
......@@ -297,6 +297,8 @@ void WinEDA_PcbFrame::End_Move_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_conta
SetCurItem( NULL ); // This outine can be deleted when merging outlines
/* Combine zones if possible */
wxBusyCursor dummy;
int layer = zone_container->GetLayer();
for( int ii = 0; ii < m_Pcb->GetAreaCount(); ii++ )
......@@ -313,6 +315,14 @@ void WinEDA_PcbFrame::End_Move_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_conta
if( layer == edge_zone->GetLayer() )
edge_zone->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR );
}
int ii = m_Pcb->GetAreaIndex(zone_container); // test if zone_container exists
if ( ii < 0 ) zone_container = NULL; // was removed by combining zones
int error_count = m_Pcb->Test_Drc_Areas_Outlines_To_Areas_Outlines(zone_container, true);
if ( error_count )
{
DisplayError(this, _("Area: DRC outline error"));
}
}
......@@ -325,6 +335,8 @@ void WinEDA_PcbFrame::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER * zone_contai
* the .m_CornerSelection is used as corner selection
*/
{
GetScreen()->SetModify();
if ( zone_container->m_Poly->GetNumCorners() <= 3 )
{
Delete_Zone_Fill( DC, NULL, zone_container->m_TimeStamp );
......@@ -357,6 +369,14 @@ void WinEDA_PcbFrame::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER * zone_contai
edge_zone->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR );
}
}
int ii = m_Pcb->GetAreaIndex(zone_container); // test if zone_container exists
if ( ii < 0 ) zone_container = NULL; // was removed by combining zones
int error_count = m_Pcb->Test_Drc_Areas_Outlines_To_Areas_Outlines(zone_container, true);
if ( error_count )
{
DisplayError(this, _("Area: DRC outline error"));
}
}
......@@ -639,6 +659,14 @@ void WinEDA_PcbFrame::End_Zone( wxDC* DC )
edge_zone->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR );
}
int ii = m_Pcb->GetAreaIndex(new_zone_container); // test if zone_container exists
if ( ii < 0 ) new_zone_container = NULL; // was removed by combining zones
int error_count = m_Pcb->Test_Drc_Areas_Outlines_To_Areas_Outlines(new_zone_container, true);
if ( error_count )
{
DisplayError(this, _("Area: DRC outline error"));
}
GetScreen()->SetModify();
}
......
This diff is collapsed.
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