more about zones.
This commit is contained in:
parent
0120f07d54
commit
638ab25498
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
COMMON_GLOBL wxString g_BuildVersion
|
COMMON_GLOBL wxString g_BuildVersion
|
||||||
#ifdef EDA_BASE
|
#ifdef EDA_BASE
|
||||||
(wxT("(2008-01-01)"))
|
(wxT("(2008-01-06)"))
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
|
@ -688,6 +688,31 @@ EQUIPOT* BOARD::FindNet( int anetcode ) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function FindNet overlayed
|
||||||
|
* searches for a net with the given name.
|
||||||
|
* @param aNetname A Netname to search for.
|
||||||
|
* @return EQUIPOT* - the net or NULL if not found.
|
||||||
|
*/
|
||||||
|
EQUIPOT* BOARD::FindNet( const wxString & aNetname ) const
|
||||||
|
{
|
||||||
|
// the first valid netcode is 1.
|
||||||
|
// zero is reserved for "no connection" and is not used.
|
||||||
|
if( ! aNetname.IsEmpty() )
|
||||||
|
{
|
||||||
|
for( EQUIPOT* net = m_Equipots; net; net=net->Next() )
|
||||||
|
{
|
||||||
|
if( net->m_Netname == aNetname )
|
||||||
|
return net;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Two sort functions used in BOARD::ReturnSortedNetnamesList */
|
/* Two sort functions used in BOARD::ReturnSortedNetnamesList */
|
||||||
// Sort nets by name
|
// Sort nets by name
|
||||||
int s_SortByNames(const void * ptr1, const void * ptr2)
|
int s_SortByNames(const void * ptr1, const void * ptr2)
|
||||||
|
|
|
@ -177,6 +177,14 @@ public:
|
||||||
*/
|
*/
|
||||||
EQUIPOT* FindNet( int aNetcode ) const;
|
EQUIPOT* FindNet( int aNetcode ) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function FindNet overlayed
|
||||||
|
* searches for a net with the given name.
|
||||||
|
* @param aNetname A Netname to search for.
|
||||||
|
* @return EQUIPOT* - the net or NULL if not found.
|
||||||
|
*/
|
||||||
|
EQUIPOT* FindNet( const wxString & aNetname ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function ReturnSortedNetnamesList
|
* Function ReturnSortedNetnamesList
|
||||||
* searches for a net with the given netcode.
|
* searches for a net with the given netcode.
|
||||||
|
@ -223,7 +231,21 @@ public:
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*************************/
|
||||||
/* Copper Areas handling */
|
/* Copper Areas handling */
|
||||||
|
/*************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function SetAreasNetCodesFromNetNames
|
||||||
|
* Set the .m_NetCode member of all copper areas, according to the area Net Name
|
||||||
|
* The SetNetCodesFromNetNames is an equivalent to net name, for fas comparisons.
|
||||||
|
* However the Netcode is an arbitrary equyivalence, it must be set after each netlist read
|
||||||
|
* or net change
|
||||||
|
* Must be called after pad netcodes are calculated
|
||||||
|
* @return : error count
|
||||||
|
*/
|
||||||
|
int SetAreasNetCodesFromNetNames(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetArea
|
* Function GetArea
|
||||||
* returns the Area (Zone Container) at a given index.
|
* returns the Area (Zone Container) at a given index.
|
||||||
|
|
|
@ -161,11 +161,19 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
|
||||||
TimeStampText.Printf( wxT( "(%8.8X)" ), item->m_TimeStamp );
|
TimeStampText.Printf( wxT( "(%8.8X)" ), item->m_TimeStamp );
|
||||||
text << TimeStampText;
|
text << TimeStampText;
|
||||||
}
|
}
|
||||||
|
if ( ((ZONE_CONTAINER*) item)->GetNet() >= 0 )
|
||||||
|
{
|
||||||
net = aPcb->FindNet( ( (ZONE_CONTAINER*) item )->GetNet() );
|
net = aPcb->FindNet( ( (ZONE_CONTAINER*) item )->GetNet() );
|
||||||
if( net )
|
if( net )
|
||||||
{
|
{
|
||||||
text << wxT( " [" ) << net->m_Netname << wxT( "]" );
|
text << wxT( " [" ) << net->m_Netname << wxT( "]" );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else // A netcode < 0 is an error flag (Netname not found or area not initialised)
|
||||||
|
{
|
||||||
|
text << wxT( " [" ) << ( (ZONE_CONTAINER*) item )->m_Netname << wxT( "]" );
|
||||||
|
text << wxT(" <") << _("Not Found") << wxT(">");
|
||||||
|
}
|
||||||
text << _( " on " ) << ReturnPcbLayerName( item->GetLayer() ).Trim();
|
text << _( " on " ) << ReturnPcbLayerName( item->GetLayer() ).Trim();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -67,11 +67,19 @@ ZONE_CONTAINER::~ZONE_CONTAINER()
|
||||||
/*******************************************/
|
/*******************************************/
|
||||||
void ZONE_CONTAINER::SetNet( int anet_code )
|
void ZONE_CONTAINER::SetNet( int anet_code )
|
||||||
/*******************************************/
|
/*******************************************/
|
||||||
|
/**
|
||||||
|
* Set the netcode and the netname
|
||||||
|
* if netcode >= 0, set the netname
|
||||||
|
* if netcode < 0: keep old netname (used to set an necode error flag)
|
||||||
|
*/
|
||||||
{
|
{
|
||||||
m_NetCode = anet_code;
|
m_NetCode = anet_code;
|
||||||
|
|
||||||
|
if ( anet_code < 0 ) return;
|
||||||
|
|
||||||
if ( m_Parent )
|
if ( m_Parent )
|
||||||
{
|
{
|
||||||
EQUIPOT* net = ((BOARD*) m_Parent)->FindNet( g_HightLigth_NetCode );
|
EQUIPOT* net = ((BOARD*) m_Parent)->FindNet( anet_code );
|
||||||
if( net )
|
if( net )
|
||||||
m_Netname = net->m_Netname;
|
m_Netname = net->m_Netname;
|
||||||
else m_Netname.Empty();
|
else m_Netname.Empty();
|
||||||
|
@ -446,12 +454,22 @@ void ZONE_CONTAINER::Display_Infos( WinEDA_DrawFrame* frame )
|
||||||
Affiche_1_Parametre( frame, text_pos, _( "Type" ), msg, DARKCYAN );
|
Affiche_1_Parametre( frame, text_pos, _( "Type" ), msg, DARKCYAN );
|
||||||
|
|
||||||
text_pos += 15;
|
text_pos += 15;
|
||||||
|
|
||||||
|
if ( GetNet() >= 0 )
|
||||||
|
{
|
||||||
EQUIPOT* equipot = ( (WinEDA_PcbFrame*) frame )->m_Pcb->FindNet( GetNet() );
|
EQUIPOT* equipot = ( (WinEDA_PcbFrame*) frame )->m_Pcb->FindNet( GetNet() );
|
||||||
|
|
||||||
if( equipot )
|
if( equipot )
|
||||||
msg = equipot->m_Netname;
|
msg = equipot->m_Netname;
|
||||||
else
|
else
|
||||||
msg = wxT( "<noname>" );
|
msg = wxT( "<noname>" );
|
||||||
|
}
|
||||||
|
else // a netcode <à 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 );
|
||||||
|
|
||||||
|
|
|
@ -819,7 +819,7 @@ int WinEDA_PcbFrame::ReadPcbFile( wxDC* DC, FILE* File, bool Append )
|
||||||
{
|
{
|
||||||
ZONE_CONTAINER * zone_descr = new ZONE_CONTAINER(m_Pcb);
|
ZONE_CONTAINER * zone_descr = new ZONE_CONTAINER(m_Pcb);
|
||||||
zone_descr->ReadDescr( File, &LineNum );
|
zone_descr->ReadDescr( File, &LineNum );
|
||||||
m_Pcb->m_ZoneDescriptorList.push_back(zone_descr);
|
m_Pcb->Add(zone_descr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( strnicmp( Line, "$MODULE", 7 ) == 0 )
|
if( strnicmp( Line, "$MODULE", 7 ) == 0 )
|
||||||
|
|
|
@ -956,6 +956,8 @@ void WinEDA_BasePcbFrame::recalcule_pad_net_code()
|
||||||
|
|
||||||
MyFree( BufPtEquipot );
|
MyFree( BufPtEquipot );
|
||||||
m_Pcb->m_Status_Pcb |= NET_CODES_OK;
|
m_Pcb->m_Status_Pcb |= NET_CODES_OK;
|
||||||
|
|
||||||
|
m_Pcb->SetAreasNetCodesFromNetNames();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -878,3 +878,34 @@ int WinEDA_PcbFrame::Fill_All_Zones( wxDC* DC, bool verbose )
|
||||||
DrawPanel->Refresh( true );
|
DrawPanel->Refresh( true );
|
||||||
return error_level;
|
return error_level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function SetAreasNetCodesFromNetNames
|
||||||
|
* Set the .m_NetCode member of all copper areas, according to the area Net Name
|
||||||
|
* The SetNetCodesFromNetNames is an equivalent to net name, for fas comparisons.
|
||||||
|
* However the Netcode is an arbitrary equyivalence, it must be set after each netlist read
|
||||||
|
* or net change
|
||||||
|
* Must be called after pad netcodes are calculated
|
||||||
|
* @return : error count
|
||||||
|
*/
|
||||||
|
int BOARD::SetAreasNetCodesFromNetNames(void)
|
||||||
|
{
|
||||||
|
int error_count = 0;
|
||||||
|
|
||||||
|
for ( int ii = 0; ii < GetAreaCount(); ii++ )
|
||||||
|
{
|
||||||
|
const EQUIPOT* net = FindNet( GetArea(ii)->m_Netname );
|
||||||
|
if ( net )
|
||||||
|
{
|
||||||
|
GetArea(ii)->SetNet(net->GetNet());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
error_count++;
|
||||||
|
GetArea(ii)->SetNet(-1); //keep Net Name ane set m_NetCode to -1 : error flag
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return error_count;
|
||||||
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// PolyLine.cpp ... implementation of CPolyLine class from FreePCB.
|
// PolyLine.cpp ... implementation of CPolyLine class from FreePCB.
|
||||||
//
|
//
|
||||||
// Adaptation for kicad
|
// implementation for kicad
|
||||||
//
|
//
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -879,11 +879,6 @@ int CPolyLine::GetNumSides()
|
||||||
return corner.size()-1;
|
return corner.size()-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CPolyLine::GetW()
|
|
||||||
{
|
|
||||||
return m_Width;
|
|
||||||
}
|
|
||||||
|
|
||||||
int CPolyLine::GetNumContours()
|
int CPolyLine::GetNumContours()
|
||||||
{
|
{
|
||||||
int ncont = 0;
|
int ncont = 0;
|
||||||
|
@ -1011,7 +1006,6 @@ void CPolyLine::Hatch()
|
||||||
{
|
{
|
||||||
enum {
|
enum {
|
||||||
MAXPTS = 100,
|
MAXPTS = 100,
|
||||||
MAXLINES = 1000
|
|
||||||
};
|
};
|
||||||
int xx[MAXPTS], yy[MAXPTS];
|
int xx[MAXPTS], yy[MAXPTS];
|
||||||
|
|
||||||
|
|
|
@ -63,10 +63,8 @@ class CPolyLine
|
||||||
public:
|
public:
|
||||||
enum { STRAIGHT, ARC_CW, ARC_CCW }; // side styles
|
enum { STRAIGHT, ARC_CW, ARC_CCW }; // side styles
|
||||||
enum { NO_HATCH, DIAGONAL_FULL, DIAGONAL_EDGE }; // hatch styles
|
enum { NO_HATCH, DIAGONAL_FULL, DIAGONAL_EDGE }; // hatch styles
|
||||||
enum { DEF_SIZE = 50, DEF_ADD = 50 }; // number of array elements to add at a time
|
|
||||||
|
|
||||||
// constructors/destructor
|
// constructors/destructor
|
||||||
// CPolyLine( CDisplayList * dl = NULL );
|
|
||||||
CPolyLine();
|
CPolyLine();
|
||||||
~CPolyLine();
|
~CPolyLine();
|
||||||
|
|
||||||
|
@ -82,16 +80,9 @@ public:
|
||||||
void RemoveAllContours( void );
|
void RemoveAllContours( void );
|
||||||
|
|
||||||
// drawing functions
|
// drawing functions
|
||||||
/* void HighlightSide( int is );
|
void Undraw();
|
||||||
void HighlightCorner( int ic );
|
|
||||||
void StartDraggingToInsertCorner( CDC * pDC, int ic, int x, int y);
|
|
||||||
void StartDraggingToMoveCorner( CDC * pDC, int ic, int x, int y);
|
|
||||||
void CancelDraggingToInsertCorner( int ic );
|
|
||||||
void CancelDraggingToMoveCorner( int ic );
|
|
||||||
*/ void Undraw();
|
|
||||||
void Draw( );
|
void Draw( );
|
||||||
void Hatch();
|
void Hatch();
|
||||||
// void MakeVisible( bool visible = TRUE );
|
|
||||||
void MoveOrigin( int x_off, int y_off );
|
void MoveOrigin( int x_off, int y_off );
|
||||||
|
|
||||||
// misc. functions
|
// misc. functions
|
||||||
|
@ -121,15 +112,12 @@ public:
|
||||||
int GetEndContour( int ic );
|
int GetEndContour( int ic );
|
||||||
int GetUtility( int ic ){ return corner[ic].utility; };
|
int GetUtility( int ic ){ return corner[ic].utility; };
|
||||||
void SetUtility( int ic, int utility ){ corner[ic].utility = utility; };
|
void SetUtility( int ic, int utility ){ corner[ic].utility = utility; };
|
||||||
int GetW();
|
|
||||||
int GetSideStyle( int is );
|
int GetSideStyle( int is );
|
||||||
int GetHatchStyle(){ return m_HatchStyle; }
|
int GetHatchStyle(){ return m_HatchStyle; }
|
||||||
void SetHatch( int hatch ){ Undraw(); m_HatchStyle = hatch; Draw(); };
|
void SetHatch( int hatch ){ Undraw(); m_HatchStyle = hatch; Draw(); };
|
||||||
void SetX( int ic, int x );
|
void SetX( int ic, int x );
|
||||||
void SetY( int ic, int y );
|
void SetY( int ic, int y );
|
||||||
void SetEndContour( int ic, bool end_contour );
|
void SetEndContour( int ic, bool end_contour );
|
||||||
// void SetLayer( int layer );
|
|
||||||
void SetW( int w );
|
|
||||||
void SetSideStyle( int is, int style );
|
void SetSideStyle( int is, int style );
|
||||||
|
|
||||||
// GPC functions
|
// GPC functions
|
||||||
|
@ -150,7 +138,6 @@ public:
|
||||||
void ClipPhpPolygon( int php_op, CPolyLine * poly );
|
void ClipPhpPolygon( int php_op, CPolyLine * poly );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// CDisplayList * m_dlist; // display list
|
|
||||||
int m_layer; // layer to draw on
|
int m_layer; // layer to draw on
|
||||||
int m_Width; // line width
|
int m_Width; // line width
|
||||||
int m_sel_box; // corner selection box width/2
|
int m_sel_box; // corner selection box width/2
|
||||||
|
@ -158,11 +145,6 @@ private:
|
||||||
public:
|
public:
|
||||||
std::vector <CPolyPt> corner; // array of points for corners
|
std::vector <CPolyPt> corner; // array of points for corners
|
||||||
std::vector <int> side_style; // array of styles for sides
|
std::vector <int> side_style; // array of styles for sides
|
||||||
private:
|
|
||||||
// std::vector <dl_element*> dl_side; // graphic elements
|
|
||||||
// std::vector <dl_element*> dl_side_sel;
|
|
||||||
// std::vector <dl_element*> dl_corner_sel;
|
|
||||||
public:
|
|
||||||
int m_HatchStyle; // hatch style, see enum above
|
int m_HatchStyle; // hatch style, see enum above
|
||||||
std::vector <CSegment> m_HatchLines; // hatch lines
|
std::vector <CSegment> m_HatchLines; // hatch lines
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -30,20 +30,6 @@
|
||||||
#define CDC wxDC
|
#define CDC wxDC
|
||||||
class wxDC;
|
class wxDC;
|
||||||
|
|
||||||
#if 0
|
|
||||||
class dl_element;
|
|
||||||
class CDisplayList {
|
|
||||||
public:
|
|
||||||
void Set_visible(void*, int) {};
|
|
||||||
int Get_x(void) { return 0;};
|
|
||||||
int Get_y(void) { return 0;};
|
|
||||||
void StopDragging(void) {};
|
|
||||||
void CancelHighLight(void) {};
|
|
||||||
void StartDraggingLineVertex(...) {};
|
|
||||||
void Add() {};
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
class CRect {
|
class CRect {
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in New Issue