本文整理汇总了C++中LSET类的典型用法代码示例。如果您正苦于以下问题:C++ LSET类的具体用法?C++ LSET怎么用?C++ LSET使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LSET类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LSET
bool BOARD_PRINTOUT_CONTROLLER::OnPrintPage( int aPage )
{
LSET lset = m_PrintParams.m_PrintMaskLayer;
// compute layer mask from page number if we want one page per layer
if( m_PrintParams.m_OptionPrintPage == 0 ) // One page per layer
{
// This sequence is TBD, call a different
// sequencer if needed, such as Seq(). Could not find documentation on
// page order.
LSEQ seq = lset.UIOrder();
// aPage starts at 1, not 0
if( unsigned( aPage-1 ) < seq.size() )
m_PrintParams.m_PrintMaskLayer = LSET( seq[aPage-1] );
}
if( !m_PrintParams.m_PrintMaskLayer.any() )
return false;
// In Pcbnew we can want the layer EDGE always printed
if( m_PrintParams.m_Flags == 1 )
m_PrintParams.m_PrintMaskLayer.set( Edge_Cuts );
DrawPage();
m_PrintParams.m_PrintMaskLayer = lset;
return true;
}
示例2: GRID_CELL_LAYER_RENDERER
bool DIALOG_SWAP_LAYERS::TransferDataToWindow()
{
LSET enabledCopperLayers = LSET::AllCuMask( m_parent->GetBoard()->GetCopperLayerCount() );
int row = 0;
for( size_t layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
{
if( enabledCopperLayers.test( layer ) )
{
auto attr = new wxGridCellAttr;
attr->SetRenderer( new GRID_CELL_LAYER_RENDERER( m_parent ) );
attr->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_MENU ) );
attr->SetReadOnly();
m_grid->SetAttr( row, 0, attr );
attr = new wxGridCellAttr;
attr->SetRenderer( new GRID_CELL_LAYER_RENDERER( m_parent ) );
attr->SetEditor( new GRID_CELL_LAYER_SELECTOR( m_parent, LSET::AllNonCuMask() ) );
m_grid->SetAttr( row, 1, attr );
m_grid->GetTable()->SetValueAsLong( row, 0, (long) layer );
m_grid->GetTable()->SetValueAsLong( row, 1, (long) layer );
++row;
}
}
return true;
}
示例3: genModuleOnRoutingMatrix
/* Place module on Routing matrix.
*/
void genModuleOnRoutingMatrix( MODULE* Module )
{
int ox, oy, fx, fy;
LSET layerMask;
D_PAD* Pad;
EDA_RECT fpBBox = Module->GetBoundingBox();
fpBBox.Inflate( RoutingMatrix.m_GridRouting / 2 );
ox = fpBBox.GetX();
fx = fpBBox.GetRight();
oy = fpBBox.GetY();
fy = fpBBox.GetBottom();
if( ox < RoutingMatrix.m_BrdBox.GetX() )
ox = RoutingMatrix.m_BrdBox.GetX();
if( ox > RoutingMatrix.m_BrdBox.GetRight() )
ox = RoutingMatrix.m_BrdBox.GetRight();
if( fx < RoutingMatrix.m_BrdBox.GetX() )
fx = RoutingMatrix.m_BrdBox.GetX();
if( fx > RoutingMatrix.m_BrdBox.GetRight() )
fx = RoutingMatrix.m_BrdBox.GetRight();
if( oy < RoutingMatrix.m_BrdBox.GetY() )
oy = RoutingMatrix.m_BrdBox.GetY();
if( oy > RoutingMatrix.m_BrdBox.GetBottom() )
oy = RoutingMatrix.m_BrdBox.GetBottom();
if( fy < RoutingMatrix.m_BrdBox.GetY() )
fy = RoutingMatrix.m_BrdBox.GetY();
if( fy > RoutingMatrix.m_BrdBox.GetBottom() )
fy = RoutingMatrix.m_BrdBox.GetBottom();
if( Module->GetLayer() == F_Cu )
layerMask.set( F_Cu );
if( Module->GetLayer() == B_Cu )
layerMask.set( B_Cu );
TraceFilledRectangle( ox, oy, fx, fy, layerMask,
CELL_is_MODULE, WRITE_OR_CELL );
// Trace pads + clearance areas.
for( Pad = Module->Pads(); Pad != NULL; Pad = Pad->Next() )
{
int margin = (RoutingMatrix.m_GridRouting / 2) + Pad->GetClearance();
::PlacePad( Pad, CELL_is_MODULE, margin, WRITE_OR_CELL );
}
// Trace clearance.
int margin = ( RoutingMatrix.m_GridRouting * Module->GetPadCount() ) / GAIN;
CreateKeepOutRectangle( ox, oy, fx, fy, margin, KEEP_OUT_MARGIN, layerMask );
}
示例4: Clear
// Reload the Layers
void PCB_LAYER_BOX_SELECTOR::Resync()
{
Clear();
// Tray to fix a minimum width fot the BitmapComboBox
int minwidth = 80;
wxClientDC dc( GetParent() ); // The DC for "this" is not always initialized
const int BM_SIZE = 14;
LSET show = LSET::AllLayersMask() & ~m_layerMaskDisable;
LSET activated = getEnabledLayers() & ~m_layerMaskDisable;
wxString layerstatus;
for( LSEQ seq = show.UIOrder(); seq; ++seq )
{
LAYER_ID layerid = *seq;
if( !m_showNotEnabledBrdlayers && !activated[layerid] )
continue;
else if( !activated[layerid] )
layerstatus = wxT( " " ) + _( "(not activated)" );
else
layerstatus.Empty();
wxBitmap layerbmp( BM_SIZE, BM_SIZE );
SetBitmapLayer( layerbmp, layerid );
wxString layername = GetLayerName( layerid ) + layerstatus;
if( m_layerhotkeys && m_hotkeys )
{
int id = layer2hotkey_id( layerid );
if( id != -1 )
layername = AddHotkeyName( layername, m_hotkeys, id, IS_COMMENT );
}
Append( layername, layerbmp, (void*)(intptr_t) layerid );
int w, h;
dc.GetTextExtent ( layername, &w, &h );
minwidth = std::max( minwidth, w );
}
minwidth += BM_SIZE + 35; // Take in account the bitmap size and margins
SetMinSize( wxSize( minwidth, -1 ) );
}
示例5: LayerMaskDescribe
wxString LayerMaskDescribe( const BOARD *aBoard, LSET aMask )
{
// Try to be smart and useful. Check all copper first.
if( aMask[F_Cu] && aMask[B_Cu] )
return _( "All copper layers" );
// Check for copper.
auto layer = aBoard->GetEnabledLayers().AllCuMask() & aMask;
for( int i = 0; i < 2; i++ )
{
for( int bit = PCBNEW_LAYER_ID_START; bit < PCB_LAYER_ID_COUNT; ++bit )
{
if( layer[ bit ] )
{
wxString layerInfo = aBoard->GetLayerName( static_cast<PCB_LAYER_ID>( bit ) );
if( aMask.count() > 1 )
layerInfo << _( " and others" );
return layerInfo;
}
}
// No copper; check for technicals.
layer = aBoard->GetEnabledLayers().AllTechMask() & aMask;
}
// No copper, no technicals: no layer
return _( "no layers" );
}
示例6: compute_pad_access_code
// Compute the access code for a pad. Returns -1 if there is no copper
static int compute_pad_access_code( BOARD *aPcb, LSET aLayerMask )
{
// Non-copper is not interesting here
aLayerMask &= LSET::AllCuMask();
if( !aLayerMask.any() )
return -1;
// Traditional TH pad
if( aLayerMask[F_Cu] && aLayerMask[B_Cu] )
return 0;
// Front SMD pad
if( aLayerMask[F_Cu] )
return 1;
// Back SMD pad
if( aLayerMask[B_Cu] )
return aPcb->GetCopperLayerCount();
// OK, we have an inner-layer only pad (and I have no idea about
// what could be used for); anyway, find the first copper layer
// it's on
for( LAYER_NUM layer = In1_Cu; layer < B_Cu; ++layer )
{
if( aLayerMask[layer] )
return layer + 1;
}
// This shouldn't happen
return -1;
}
示例7: LayerMaskDescribe
wxString LayerMaskDescribe( const BOARD *aBoard, LSET aMask )
{
// Try the single or no- layer case (easy)
PCB_LAYER_ID layer = aMask.ExtractLayer();
switch( (int) layer )
{
case UNSELECTED_LAYER:
return _( "No layers" );
case UNDEFINED_LAYER:
break;
default:
return aBoard->GetLayerName( layer );
}
// Try to be smart and useful, starting with outer copper
// (which are more important than internal ones)
wxString layerInfo;
if( aMask[F_Cu] )
AccumulateDescription( layerInfo, aBoard->GetLayerName( F_Cu ) );
if( aMask[B_Cu] )
AccumulateDescription( layerInfo, aBoard->GetLayerName( B_Cu ) );
if( ( aMask & LSET::InternalCuMask() ).any() )
AccumulateDescription( layerInfo, _("Internal" ) );
if( ( aMask & LSET::AllNonCuMask() ).any() )
AccumulateDescription( layerInfo, _("Non-copper" ) );
return layerInfo;
}
示例8: getUILayerMask
LSET DIALOG_LAYERS_SETUP::getUILayerMask()
{
LSET layerMaskResult;
for( LSEQ seq = dlg_layers(); seq; ++seq )
{
LAYER_ID layer = *seq;
wxCheckBox* ctl = getCheckBox( layer );
if( ctl->GetValue() )
{
layerMaskResult.set( layer );
}
}
return layerMaskResult;
}
示例9: fmt_mask
static std::string fmt_mask( LSET aSet )
{
#if 0
return aSet.FmtHex();
#else
return StrPrintf( "%08x", (unsigned) ( aSet & LSET::AllCuMask() ).to_ulong() );
#endif
}
示例10: sameLayerFunc
bool PCB_SELECTION_CONDITIONS::sameLayerFunc( const SELECTION& aSelection )
{
if( aSelection.Empty() )
return false;
LSET layerSet;
layerSet.set();
for( const auto& i : aSelection )
{
auto item = static_cast<BOARD_ITEM*>( i );
layerSet &= item->GetLayerSet();
if( !layerSet.any() ) // there are no common layers left
return false;
}
return true;
}
示例11: TransferDataFromWindow
bool DIALOG_SWAP_LAYERS::TransferDataFromWindow()
{
if( !m_grid->CommitPendingChanges() )
return false;
LSET enabledCopperLayers = LSET::AllCuMask( m_parent->GetBoard()->GetCopperLayerCount() );
wxGridTableBase* table = m_grid->GetTable();
int row = 0;
for( size_t layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
{
if( enabledCopperLayers.test( layer ) )
m_layerDestinations[ layer ] = (PCB_LAYER_ID) table->GetValueAsLong( row++, 1 );
else
m_layerDestinations[ layer ] = (PCB_LAYER_ID) layer;
}
return true;
}
示例12: GetLayerSet
LSET VIA::GetLayerSet() const
{
if( GetViaType() == VIA_THROUGH )
return LSET::AllCuMask();
// VIA_BLIND_BURIED or VIA_MICRVIA:
LSET layermask;
wxASSERT( m_Layer <= m_BottomLayer );
// LAYER_IDs are numbered from front to back, this is top to bottom.
for( LAYER_NUM id = m_Layer; id <= m_BottomLayer; ++id )
{
layermask.set( id );
}
return layermask;
}
示例13: ReadParam
void ReadParam( wxConfigBase* aConfig ) const override
{
if( !m_Pt_param || !aConfig )
return;
BOARD* board = m_Pt_param;
BOARD_DESIGN_SETTINGS& bds = board->GetDesignSettings();
LSET enabledLayers = bds.GetEnabledLayers();
wxString oldPath = aConfig->GetPath();
wxString layerKeyPrefix = LayerKeyPrefix;
bds.SetCopperLayerCount( aConfig->Read( CopperLayerCountKey, 2 ) );
double thickness = aConfig->ReadDouble( BoardThicknessKey, DEFAULT_BOARD_THICKNESS_MM );
bds.SetBoardThickness( Millimeter2iu( thickness ) );
for( LSEQ seq = LSET::AllLayersMask().Seq(); seq; ++seq )
{
PCB_LAYER_ID layer = *seq;
wxString path = layerKeyPrefix + wxT( "." ) + board->GetStandardLayerName( layer );
wxString layerName;
int layerType;
bool layerEnabled;
aConfig->SetPath( oldPath );
aConfig->SetPath( path );
if( aConfig->Read( LayerNameKey, &layerName ) )
board->SetLayerName( layer, layerName );
if( aConfig->Read( LayerTypeKey, &layerType ) )
board->SetLayerType( layer, (LAYER_T) layerType );
if( aConfig->Read( LayerEnabledKey, &layerEnabled ) )
enabledLayers.set( layer, layerEnabled );
}
board->SetEnabledLayers( enabledLayers );
aConfig->SetPath( oldPath );
}
示例14: OnLayerVisible
void PCB_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFinal )
{
BOARD* brd = myframe->GetBoard();
LSET visibleLayers = brd->GetVisibleLayers();
visibleLayers.set( aLayer, isVisible );
brd->SetVisibleLayers( visibleLayers );
EDA_DRAW_PANEL_GAL* galCanvas = myframe->GetGalCanvas();
if( galCanvas )
{
KIGFX::VIEW* view = galCanvas->GetView();
view->SetLayerVisible( aLayer, isVisible );
view->RecacheAllItems( true );
}
if( isFinal )
myframe->GetCanvas()->Refresh();
}
示例15: LSET
bool BOARD_PRINTOUT_CONTROLLER::OnPrintPage( int aPage )
{
LSET lset = m_PrintParams.m_PrintMaskLayer;
int pageCount = lset.count();
wxString layer;
LAYER_ID extractLayer;
// compute layer mask from page number if we want one page per layer
if( m_PrintParams.m_OptionPrintPage == 0 ) // One page per layer
{
// This sequence is TBD, call a different
// sequencer if needed, such as Seq(). Could not find documentation on
// page order.
LSEQ seq = lset.UIOrder();
// aPage starts at 1, not 0
if( unsigned( aPage-1 ) < seq.size() )
m_PrintParams.m_PrintMaskLayer = LSET( seq[aPage-1] );
}
if( !m_PrintParams.m_PrintMaskLayer.any() )
return false;
extractLayer = m_PrintParams.m_PrintMaskLayer.ExtractLayer();
if( extractLayer == UNDEFINED_LAYER )
layer = _( "Multiple Layers" );
else
layer = LSET::Name( extractLayer );
// In Pcbnew we can want the layer EDGE always printed
if( m_PrintParams.m_Flags == 1 )
m_PrintParams.m_PrintMaskLayer.set( Edge_Cuts );
DrawPage( layer, aPage, pageCount );
m_PrintParams.m_PrintMaskLayer = lset;
return true;
}