本文整理汇总了C++中SCH_MARKER类的典型用法代码示例。如果您正苦于以下问题:C++ SCH_MARKER类的具体用法?C++ SCH_MARKER怎么用?C++ SCH_MARKER使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SCH_MARKER类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DeleteAllMarkers
void SCH_SCREENS::DeleteAllMarkers( int aMarkerType )
{
SCH_ITEM* item;
SCH_ITEM* nextItem;
SCH_MARKER* marker;
SCH_SCREEN* screen;
for( screen = GetFirst(); screen; screen = GetNext() )
{
for( item = screen->GetDrawItems(); item; item = nextItem )
{
nextItem = item->Next();
if( item->Type() != SCH_MARKER_T )
continue;
marker = (SCH_MARKER*) item;
if( marker->GetMarkerType() != aMarkerType )
continue;
screen->DeleteItem( marker );
}
}
}
示例2: GetMarkerCount
int SCH_SCREENS::GetMarkerCount( int aMarkerType )
{
SCH_ITEM* item;
SCH_ITEM* nextItem;
SCH_MARKER* marker;
SCH_SCREEN* screen;
int count = 0;
for( screen = GetFirst(); screen; screen = GetNext() )
{
for( item = screen->GetDrawItems(); item; item = nextItem )
{
nextItem = item->Next();
if( item->Type() != SCH_MARKER_T )
continue;
marker = (SCH_MARKER*) item;
if( (aMarkerType != -1) && (marker->GetMarkerType() != aMarkerType) )
continue;
count++;
}
}
return count;
}
示例3: DisplayERC_MarkersList
void DIALOG_ERC::DisplayERC_MarkersList()
{
SCH_SHEET_LIST sheetList;
m_MarkersList->ClearList();
SCH_SHEET_PATH* sheet = sheetList.GetFirst();
for( ; sheet != NULL; sheet = sheetList.GetNext() )
{
SCH_ITEM* item = sheet->LastDrawList();
for( ; item != NULL; item = item->Next() )
{
if( item->Type() != SCH_MARKER_T )
continue;
SCH_MARKER* Marker = (SCH_MARKER*) item;
if( Marker->GetMarkerType() != MARKER_BASE::MARKER_ERC )
continue;
// Add marker without refresh the displayed list:
m_MarkersList->AppendToList( Marker, false );
}
}
m_MarkersList->Refresh();
}
示例4: DisplayERC_MarkersList
void DIALOG_ERC::DisplayERC_MarkersList()
{
SCH_SHEET_LIST sheetList;
m_MarkersList->ClearList();
SCH_SHEET_PATH* sheet = sheetList.GetFirst();
for( ; sheet != NULL; sheet = sheetList.GetNext() )
{
SCH_ITEM* item = sheet->LastDrawList();
for( ; item != NULL; item = item->Next() )
{
if( item->Type() != SCH_MARKER_T )
continue;
SCH_MARKER* marker = (SCH_MARKER*) item;
if( marker->GetMarkerType() != MARKER_BASE::MARKER_ERC )
continue;
m_MarkersList->AppendToList( marker );
}
}
m_MarkersList->DisplayList();
}
示例5: sheetList
void DIALOG_ERC::DisplayERC_MarkersList()
{
SCH_SHEET_LIST sheetList( g_RootSheet);
m_MarkersList->ClearList();
for( unsigned i = 0; i < sheetList.size(); i++ )
{
SCH_ITEM* item = sheetList[i].LastDrawList();
for( ; item != NULL; item = item->Next() )
{
if( item->Type() != SCH_MARKER_T )
continue;
SCH_MARKER* marker = (SCH_MARKER*) item;
if( marker->GetMarkerType() != MARKER_BASE::MARKER_ERC )
continue;
m_MarkersList->AppendToList( marker );
}
}
m_MarkersList->DisplayList();
}
示例6: GetMarkerCount
int SCH_SCREENS::GetMarkerCount( enum MARKER_BASE::TYPEMARKER aMarkerType,
enum MARKER_BASE::MARKER_SEVERITY aSeverity )
{
int count = 0;
for( SCH_SCREEN* screen = GetFirst(); screen; screen = GetNext() )
{
for( SCH_ITEM* item = screen->GetDrawItems(); item; item = item->Next() )
{
if( item->Type() != SCH_MARKER_T )
continue;
SCH_MARKER* marker = (SCH_MARKER*) item;
if( ( aMarkerType != MARKER_BASE::MARKER_UNSPEC ) &&
( marker->GetMarkerType() != aMarkerType ) )
continue;
if( aSeverity == MARKER_BASE::MARKER_SEVERITY_UNSPEC ||
aSeverity == marker->GetErrorLevel() )
count++;
}
}
return count;
}
示例7: WriteDiagnosticERC
bool WriteDiagnosticERC( const wxString& aFullFileName )
{
wxString msg;
wxFFile file( aFullFileName, wxT( "wt" ) );
if( !file.IsOpened() )
return false;
msg = _( "ERC report" );
msg << wxT(" (") << DateAndTime() << wxT( ", " )
<< _( "Encoding UTF8" ) << wxT( " )\n" );
int err_count = 0;
int warn_count = 0;
int total_count = 0;
SCH_SHEET_LIST sheetList;
SCH_SHEET_PATH* sheet;
for( sheet = sheetList.GetFirst(); sheet != NULL; sheet = sheetList.GetNext() )
{
msg << wxString::Format( _( "\n***** Sheet %s\n" ),
GetChars( sheet->PathHumanReadable() ) );
for( SCH_ITEM* item = sheet->LastDrawList(); item != NULL; item = item->Next() )
{
if( item->Type() != SCH_MARKER_T )
continue;
SCH_MARKER* marker = (SCH_MARKER*) item;
if( marker->GetMarkerType() != MARKER_BASE::MARKER_ERC )
continue;
total_count++;
if( marker->GetErrorLevel() == MARKER_BASE::MARKER_SEVERITY_ERROR )
err_count++;
if( marker->GetErrorLevel() == MARKER_BASE::MARKER_SEVERITY_WARNING )
warn_count++;
msg << marker->GetReporter().ShowReport();
}
}
msg << wxString::Format( _( "\n ** ERC messages: %d Errors %d Warnings %d\n" ),
total_count, err_count, warn_count );
// Currently: write report unsing UTF8 (as usual in Kicad).
// TODO: see if we can use the current encoding page (mainly for Windows users),
// Or other format (HTML?)
file.Write( msg );
// wxFFile dtor will close the file.
return true;
}
示例8: TestDuplicateSheetNames
int TestDuplicateSheetNames( bool aCreateMarker )
{
SCH_SCREEN* screen;
SCH_ITEM* item;
SCH_ITEM* test_item;
int err_count = 0;
SCH_SCREENS screenList; // Created the list of screen
for( screen = screenList.GetFirst(); screen != NULL; screen = screenList.GetNext() )
{
for( item = screen->GetDrawItems(); item != NULL; item = item->Next() )
{
// search for a sheet;
if( item->Type() != SCH_SHEET_T )
continue;
for( test_item = item->Next(); test_item != NULL; test_item = test_item->Next() )
{
if( test_item->Type() != SCH_SHEET_T )
continue;
// We have found a second sheet: compare names
// we are using case insensitive comparison to avoid mistakes between
// similar names like Mysheet and mysheet
if( ( (SCH_SHEET*) item )->GetName().CmpNoCase(
( ( SCH_SHEET* ) test_item )->GetName() ) == 0 )
{
if( aCreateMarker )
{
/* Create a new marker type ERC error*/
SCH_MARKER* marker = new SCH_MARKER();
marker->SetTimeStamp( GetNewTimeStamp() );
marker->SetData( ERCE_DUPLICATE_SHEET_NAME,
( (SCH_SHEET*) test_item )->GetPosition(),
_( "Duplicate sheet name" ),
( (SCH_SHEET*) test_item )->GetPosition() );
marker->SetMarkerType( MARKER_BASE::MARKER_ERC );
marker->SetErrorLevel( MARKER_BASE::MARKER_SEVERITY_ERROR );
screen->Append( marker );
}
err_count++;
}
}
}
}
return err_count;
}
示例9: WriteDiagnosticERC
bool WriteDiagnosticERC( const wxString& aFullFileName )
{
SCH_ITEM* item;
SCH_MARKER* marker;
static FILE* file;
SCH_SHEET_PATH* sheet;
wxString msg;
int count = 0;
if( ( file = wxFopen( aFullFileName, wxT( "wt" ) ) ) == NULL )
return false;
msg = _( "ERC report" );
fprintf( file, "%s (%s)\n", TO_UTF8( msg ), TO_UTF8( DateAndTime() ) );
SCH_SHEET_LIST sheetList;
for( sheet = sheetList.GetFirst(); sheet != NULL; sheet = sheetList.GetNext() )
{
msg.Printf( _( "\n***** Sheet %s\n" ), GetChars( sheet->PathHumanReadable() ) );
fprintf( file, "%s", TO_UTF8( msg ) );
for( item = sheet->LastDrawList(); item != NULL; item = item->Next() )
{
if( item->Type() != SCH_MARKER_T )
continue;
marker = (SCH_MARKER*) item;
if( marker->GetMarkerType() != MARK_ERC )
continue;
if( marker->GetMarkerType() == ERR )
count++;
msg = marker->GetReporter().ShowReport();
fprintf( file, "%s", TO_UTF8( msg ) );
}
}
msg.Printf( _( "\n >> Errors ERC: %d\n" ), count );
fprintf( file, "%s", TO_UTF8( msg ) );
fclose( file );
return true;
}
示例10: SimilarLabelsDiagnose
// Helper function: creates a marker for similar labels ERC warning
static void SimilarLabelsDiagnose( NETLIST_OBJECT* aItemA, NETLIST_OBJECT* aItemB )
{
// Create new marker for ERC.
SCH_MARKER* marker = new SCH_MARKER();
marker->SetTimeStamp( GetNewTimeStamp() );
marker->SetMarkerType( MARKER_BASE::MARKER_ERC );
marker->SetErrorLevel( MARKER_BASE::MARKER_SEVERITY_WARNING );
SCH_SCREEN* screen = aItemA->m_SheetPath.LastScreen();
screen->Append( marker );
wxString fmt = aItemA->IsLabelGlobal() ?
_( "Global label \"%s\" (sheet \"%s\") looks like:" ) :
_( "Local label \"%s\" (sheet \"%s\") looks like:" );
wxString msg;
msg.Printf( fmt, GetChars( aItemA->m_Label ), GetChars( aItemA->m_SheetPath.PathHumanReadable() ) );
marker->SetData( aItemA->IsLabelGlobal() && aItemB->IsLabelGlobal() ?
ERCE_SIMILAR_GLBL_LABELS : ERCE_SIMILAR_LABELS,
aItemA->m_Start, msg, aItemA->m_Start );
fmt = aItemB->IsLabelGlobal() ? _( "Global label \"%s\" (sheet \"%s\")" ) :
_( "Local label \"%s\" (sheet \"%s\")" );
msg.Printf( fmt, GetChars( aItemB->m_Label ), GetChars( aItemB->m_SheetPath.PathHumanReadable() ) );
marker->SetAuxiliaryData( msg, aItemB->m_Start );
}
示例11: Diagnose
void Diagnose( NETLIST_OBJECT* aNetItemRef, NETLIST_OBJECT* aNetItemTst,
int aMinConn, int aDiag )
{
SCH_MARKER* marker = NULL;
SCH_SCREEN* screen;
int ii, jj;
if( aDiag == OK )
return;
/* Create new marker for ERC error. */
marker = new SCH_MARKER();
marker->SetTimeStamp( GetNewTimeStamp() );
marker->SetMarkerType( MARK_ERC );
marker->SetErrorLevel( WAR );
screen = aNetItemRef->m_SheetPath.LastScreen();
screen->Append( marker );
wxString msg;
if( aMinConn < 0 )
{
if( (aNetItemRef->m_Type == NET_HIERLABEL)
|| (aNetItemRef->m_Type == NET_HIERBUSLABELMEMBER) )
{
msg.Printf( _( "Hierarchical label %s is not connected to a sheet label." ),
GetChars( aNetItemRef->m_Label ) );
}
else
{
msg.Printf( _( "Sheet label %s is not connected to a hierarchical label." ),
GetChars( aNetItemRef->m_Label ) );
}
marker->SetData( ERCE_HIERACHICAL_LABEL,
aNetItemRef->m_Start,
msg,
aNetItemRef->m_Start );
return;
}
ii = aNetItemRef->m_ElectricalType;
wxString string_pinnum, cmp_ref;
char ascii_buf[5];
ascii_buf[4] = 0;
memcpy( ascii_buf, &aNetItemRef->m_PinNum, 4 );
string_pinnum = FROM_UTF8( ascii_buf );
cmp_ref = wxT( "?" );
if( aNetItemRef->m_Type == NET_PIN && aNetItemRef->m_Link )
cmp_ref = aNetItemRef->GetComponentParent()->GetRef( &aNetItemRef->m_SheetPath );
if( aNetItemTst == NULL )
{
if( aMinConn == NOC ) /* Only 1 element in the net. */
{
msg.Printf( _( "Pin %s (%s) of component %s is unconnected." ),
GetChars( string_pinnum ), MsgPinElectricType[ii], GetChars( cmp_ref ) );
marker->SetData( ERCE_PIN_NOT_CONNECTED,
aNetItemRef->m_Start,
msg,
aNetItemRef->m_Start );
return;
}
if( aMinConn == NOD ) /* Nothing driving the net. */
{
if( aNetItemRef->m_Type == NET_PIN && aNetItemRef->m_Link )
cmp_ref = aNetItemRef->GetComponentParent()->GetRef(
&aNetItemRef->m_SheetPath );
msg.Printf( _( "Pin %s (%s) of component %s is not driven (Net %d)." ),
GetChars( string_pinnum ), MsgPinElectricType[ii], GetChars( cmp_ref ),
aNetItemRef->GetNet() );
marker->SetData( ERCE_PIN_NOT_DRIVEN,
aNetItemRef->m_Start,
msg,
aNetItemRef->m_Start );
return;
}
if( aDiag == UNC )
{
msg.Printf( _( "More than 1 pin connected to an UnConnect symbol." ) );
marker->SetData( ERCE_NOCONNECT_CONNECTED,
aNetItemRef->m_Start,
msg,
aNetItemRef->m_Start );
return;
}
}
if( aNetItemTst ) /* Error between 2 pins */
{
jj = aNetItemTst->m_ElectricalType;
int errortype = ERCE_PIN_TO_PIN_WARNING;
//.........这里部分代码省略.........
示例12: Diagnose
void Diagnose( NETLIST_OBJECT* aNetItemRef, NETLIST_OBJECT* aNetItemTst,
int aMinConn, int aDiag )
{
SCH_MARKER* marker = NULL;
SCH_SCREEN* screen;
ELECTRICAL_PINTYPE ii, jj;
if( aDiag == OK || aMinConn < 1 )
return;
/* Create new marker for ERC error. */
marker = new SCH_MARKER();
marker->SetTimeStamp( GetNewTimeStamp() );
marker->SetMarkerType( MARKER_BASE::MARKER_ERC );
marker->SetErrorLevel( MARKER_BASE::MARKER_SEVERITY_WARNING );
screen = aNetItemRef->m_SheetPath.LastScreen();
screen->Append( marker );
wxString msg;
ii = aNetItemRef->m_ElectricalPinType;
wxString cmp_ref( "?" );
if( aNetItemRef->m_Type == NET_PIN && aNetItemRef->m_Link )
cmp_ref = aNetItemRef->GetComponentParent()->GetRef( &aNetItemRef->m_SheetPath );
if( aNetItemTst == NULL )
{
if( aMinConn == NOD ) /* Nothing driving the net. */
{
if( aNetItemRef->m_Type == NET_PIN && aNetItemRef->m_Link )
cmp_ref = aNetItemRef->GetComponentParent()->GetRef(
&aNetItemRef->m_SheetPath );
msg.Printf( _( "Pin %s (%s) of component %s is not driven (Net %d)." ),
aNetItemRef->m_PinNum,
GetChars( GetText( ii ) ),
GetChars( cmp_ref ),
aNetItemRef->GetNet() );
marker->SetData( ERCE_PIN_NOT_DRIVEN,
aNetItemRef->m_Start,
msg,
aNetItemRef->m_Start );
return;
}
}
if( aNetItemTst ) /* Error between 2 pins */
{
jj = aNetItemTst->m_ElectricalPinType;
int errortype = ERCE_PIN_TO_PIN_WARNING;
if( aDiag == ERR )
{
marker->SetErrorLevel( MARKER_BASE::MARKER_SEVERITY_ERROR );
errortype = ERCE_PIN_TO_PIN_ERROR;
}
wxString alt_cmp( "?" );
if( aNetItemTst->m_Type == NET_PIN && aNetItemTst->m_Link )
alt_cmp = aNetItemTst->GetComponentParent()->GetRef( &aNetItemTst->m_SheetPath );
msg.Printf( _( "Pin %s (%s) of component %s is connected to " ),
aNetItemRef->m_PinNum,
GetChars( GetText( ii ) ),
GetChars( cmp_ref ) );
marker->SetData( errortype, aNetItemRef->m_Start, msg, aNetItemRef->m_Start );
msg.Printf( _( "pin %s (%s) of component %s (net %d)." ),
aNetItemTst->m_PinNum,
GetChars( GetText( jj ) ),
GetChars( alt_cmp ),
aNetItemRef->GetNet() );
marker->SetAuxiliaryData( msg, aNetItemTst->m_Start );
}
}
示例13: TestMultiunitFootprints
int TestMultiunitFootprints( SCH_SHEET_LIST& aSheetList )
{
int errors = 0;
std::map<wxString, LIB_ID> footprints;
SCH_MULTI_UNIT_REFERENCE_MAP refMap;
aSheetList.GetMultiUnitComponents( refMap, true );
for( auto& component : refMap )
{
auto& refList = component.second;
if( refList.GetCount() == 0 )
{
wxFAIL; // it should not happen
continue;
}
// Reference footprint
wxString fp;
wxString unitName;
for( unsigned i = 0; i < component.second.GetCount(); ++i )
{
SCH_COMPONENT* cmp = refList.GetItem( i ).GetComp();
SCH_SHEET_PATH sheetPath = refList.GetItem( i ).GetSheetPath();
fp = cmp->GetField( FOOTPRINT )->GetText();
if( !fp.IsEmpty() )
{
unitName = cmp->GetRef( &sheetPath )
+ LIB_PART::SubReference( cmp->GetUnit(), false );
break;
}
}
for( unsigned i = 0; i < component.second.GetCount(); ++i )
{
SCH_REFERENCE& ref = refList.GetItem( i );
SCH_COMPONENT* unit = ref.GetComp();
SCH_SHEET_PATH sheetPath = refList.GetItem( i ).GetSheetPath();
const wxString curFp = unit->GetField( FOOTPRINT )->GetText();
if( !curFp.IsEmpty() && fp != curFp )
{
wxString curUnitName = unit->GetRef( &sheetPath )
+ LIB_PART::SubReference( unit->GetUnit(), false );
wxString msg = wxString::Format( _( "Unit %s has '%s' assigned, "
"whereas unit %s has '%s' assigned" ),
unitName,
fp,
curUnitName,
curFp );
wxPoint pos = unit->GetPosition();
SCH_MARKER* marker = new SCH_MARKER();
marker->SetTimeStamp( GetNewTimeStamp() );
marker->SetData( ERCE_DIFFERENT_UNIT_FP, pos, msg, pos );
marker->SetMarkerType( MARKER_BASE::MARKER_ERC );
marker->SetErrorLevel( MARKER_BASE::MARKER_SEVERITY_WARNING );
ref.GetSheetPath().LastScreen()->Append( marker );
++errors;
}
}
}
return errors;
}