本文整理汇总了C++中EDA_DRAW_PANEL_GAL::GetView方法的典型用法代码示例。如果您正苦于以下问题:C++ EDA_DRAW_PANEL_GAL::GetView方法的具体用法?C++ EDA_DRAW_PANEL_GAL::GetView怎么用?C++ EDA_DRAW_PANEL_GAL::GetView使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EDA_DRAW_PANEL_GAL
的用法示例。
在下文中一共展示了EDA_DRAW_PANEL_GAL::GetView方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UseGalCanvas
void PCB_BASE_FRAME::UseGalCanvas()
{
EDA_DRAW_FRAME::UseGalCanvas();
EDA_DRAW_PANEL_GAL* galCanvas = GetGalCanvas();
if( m_toolManager )
{
m_toolManager->SetEnvironment( m_Pcb, GetGalCanvas()->GetView(),
GetGalCanvas()->GetViewControls(), this );
}
SetBoard( m_Pcb );
if( m_toolManager )
m_toolManager->ResetTools( TOOL_BASE::GAL_SWITCH );
// Transfer latest current display options from legacy to GAL canvas:
auto painter = static_cast<KIGFX::PCB_PAINTER*>( galCanvas->GetView()->GetPainter() );
auto settings = painter->GetSettings();
auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
settings->LoadDisplayOptions( displ_opts, ShowPageLimits() );
galCanvas->GetView()->RecacheAllItems();
galCanvas->SetEventDispatcher( m_toolDispatcher );
galCanvas->StartDrawing();
}
示例2: UseGalCanvas
void PCB_BASE_FRAME::UseGalCanvas( bool aEnable )
{
EDA_DRAW_FRAME::UseGalCanvas( aEnable );
EDA_DRAW_PANEL_GAL* galCanvas = GetGalCanvas();
if( m_toolManager )
m_toolManager->SetEnvironment( m_Pcb, GetGalCanvas()->GetView(),
GetGalCanvas()->GetViewControls(), this );
if( aEnable )
{
SetBoard( m_Pcb );
if( m_toolManager )
m_toolManager->ResetTools( TOOL_BASE::GAL_SWITCH );
galCanvas->GetView()->RecacheAllItems();
galCanvas->SetEventDispatcher( m_toolDispatcher );
galCanvas->StartDrawing();
}
else
{
if( m_toolManager )
m_toolManager->ResetTools( TOOL_BASE::GAL_SWITCH );
// Redirect all events to the legacy canvas
galCanvas->SetEventDispatcher( NULL );
}
}
示例3: OnTogglePadDrawMode
void PCB_BASE_FRAME::OnTogglePadDrawMode( wxCommandEvent& aEvent )
{
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions();
displ_opts->m_DisplayPadFill = !displ_opts->m_DisplayPadFill;
EDA_DRAW_PANEL_GAL* gal = GetGalCanvas();
if( gal )
{
// Apply new display options to the GAL canvas
KIGFX::PCB_PAINTER* painter =
static_cast<KIGFX::PCB_PAINTER*> ( gal->GetView()->GetPainter() );
KIGFX::PCB_RENDER_SETTINGS* settings =
static_cast<KIGFX::PCB_RENDER_SETTINGS*> ( painter->GetSettings() );
settings->LoadDisplayOptions( displ_opts );
// Update pads
BOARD* board = GetBoard();
for( MODULE* module = board->m_Modules; module; module = module->Next() )
{
for( D_PAD* pad = module->Pads(); pad; pad = pad->Next() )
pad->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
}
}
m_canvas->Refresh();
}
示例4: OnRenderColorChange
void PCB_LAYER_WIDGET::OnRenderColorChange( int aId, COLOR4D aColor )
{
wxASSERT( aId > GAL_LAYER_ID_START && aId < GAL_LAYER_ID_END );
myframe->Settings().Colors().SetItemColor( static_cast<GAL_LAYER_ID>( aId ), aColor );
EDA_DRAW_PANEL_GAL* galCanvas = myframe->GetGalCanvas();
if( galCanvas && myframe->IsGalCanvasActive() )
{
if( aId == LAYER_GRID )
galCanvas->GetGAL()->SetGridColor( aColor );
KIGFX::VIEW* view = galCanvas->GetView();
view->GetPainter()->GetSettings()->ImportLegacyColors( &myframe->Settings().Colors() );
view->MarkTargetDirty( KIGFX::TARGET_NONCACHED ); // useful to update rastnest
view->UpdateLayerColor( aId );
// plated-through-holes don't have their own color; they use the background color
if( aId == LAYER_PCB_BACKGROUND )
view->UpdateLayerColor( LAYER_PADS_PLATEDHOLES );
galCanvas->ForceRefresh();
}
myframe->ReCreateHToolbar();
myframe->GetCanvas()->Refresh();
}
示例5: OnRenderEnable
void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled )
{
BOARD* brd = myframe->GetBoard();
brd->SetElementVisibility( aId, isEnabled );
EDA_DRAW_PANEL_GAL* galCanvas = myframe->GetGalCanvas();
if( galCanvas )
{
if( aId == GRID_VISIBLE )
{
galCanvas->GetGAL()->SetGridVisibility( myframe->IsGridVisible() );
galCanvas->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
}
else
galCanvas->GetView()->SetLayerVisible( ITEM_GAL_LAYER( aId ), isEnabled );
}
if( galCanvas && myframe->IsGalCanvasActive() )
galCanvas->Refresh();
else
myframe->GetCanvas()->Refresh();
}
示例6: OnRenderEnable
void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled )
{
BOARD* brd = myframe->GetBoard();
wxASSERT( aId > GAL_LAYER_ID_START && aId < GAL_LAYER_ID_END );
if( myframe->IsType( FRAME_PCB ) )
{
// The layer visibility status is saved in the board file so set the board
// modified state so the user has the option to save the changes.
if( brd->IsElementVisible( static_cast<GAL_LAYER_ID>( aId ) ) != isEnabled )
myframe->OnModify();
}
brd->SetElementVisibility( static_cast<GAL_LAYER_ID>( aId ), isEnabled );
EDA_DRAW_PANEL_GAL* galCanvas = myframe->GetGalCanvas();
if( galCanvas && myframe->IsGalCanvasActive() )
{
if( aId == LAYER_GRID )
{
galCanvas->GetGAL()->SetGridVisibility( myframe->IsGridVisible() );
galCanvas->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
}
else if( aId == LAYER_RATSNEST )
{
// don't touch the layers. ratsnest is enabled on per-item basis.
galCanvas->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
galCanvas->GetView()->SetLayerVisible( aId, true );
}
else
galCanvas->GetView()->SetLayerVisible( aId, isEnabled );
galCanvas->Refresh();
}
myframe->GetCanvas()->Refresh();
}
示例7: OnToggleTextDrawMode
void PCB_BASE_FRAME::OnToggleTextDrawMode( wxCommandEvent& aEvent )
{
auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
displ_opts->m_DisplayModTextFill = !displ_opts->m_DisplayModTextFill;
EDA_DRAW_PANEL_GAL* gal = GetGalCanvas();
if( gal )
{
// Apply new display options to the GAL canvas
auto view = static_cast<KIGFX::PCB_VIEW*>( gal->GetView() );
view->UpdateDisplayOptions( displ_opts );
view->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
}
m_canvas->Refresh();
}
示例8: 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();
}
示例9: OnLayerVisible
void PCB_LAYER_WIDGET::OnLayerVisible( LAYER_NUM aLayer, bool isVisible, bool isFinal )
{
BOARD* brd = myframe->GetBoard();
LAYER_MSK visibleLayers = brd->GetVisibleLayers();
if( isVisible )
visibleLayers |= GetLayerMask( aLayer );
else
visibleLayers &= ~GetLayerMask( aLayer );
brd->SetVisibleLayers( visibleLayers );
EDA_DRAW_PANEL_GAL* galCanvas = myframe->GetGalCanvas();
if( galCanvas )
{
KIGFX::VIEW* view = galCanvas->GetView();
view->SetLayerVisible( aLayer, isVisible );
}
if( isFinal )
myframe->GetCanvas()->Refresh();
}
示例10: OnLayerVisible
void PCB_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFinal )
{
BOARD* brd = myframe->GetBoard();
LSET visibleLayers = brd->GetVisibleLayers();
if( visibleLayers.test( aLayer ) != isVisible )
{
visibleLayers.set( aLayer, isVisible );
brd->SetVisibleLayers( visibleLayers );
myframe->OnModify();
EDA_DRAW_PANEL_GAL* galCanvas = myframe->GetGalCanvas();
if( galCanvas )
galCanvas->GetView()->SetLayerVisible( aLayer, isVisible );
}
if( isFinal )
myframe->GetCanvas()->Refresh();
}
示例11: OnTogglePadDrawMode
void PCB_BASE_FRAME::OnTogglePadDrawMode( wxCommandEvent& aEvent )
{
auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
displ_opts->m_DisplayPadFill = !displ_opts->m_DisplayPadFill;
EDA_DRAW_PANEL_GAL* gal = GetGalCanvas();
if( gal )
{
// Apply new display options to the GAL canvas
auto view = static_cast<KIGFX::PCB_VIEW*>( gal->GetView() );
view->UpdateDisplayOptions( displ_opts );
// Update pads
BOARD* board = GetBoard();
for( MODULE* module = board->m_Modules; module; module = module->Next() )
{
for( auto pad : module->Pads() )
view->Update( pad, KIGFX::GEOMETRY );
}
}
m_canvas->Refresh();
}
示例12: Read_EXCELLON_File
bool GERBVIEW_FRAME::Read_EXCELLON_File( const wxString& aFullFileName )
{
wxString msg;
int layerId = GetActiveLayer(); // current layer used in GerbView
GERBER_FILE_IMAGE_LIST* images = GetGerberLayout()->GetImagesList();
auto gerber_layer = images->GetGbrImage( layerId );
auto drill_layer = dynamic_cast<EXCELLON_IMAGE*>( gerber_layer );
if( gerber_layer && !drill_layer )
{
// The active layer contains old gerber data we have to clear
Erase_Current_DrawLayer( false );
}
if( drill_layer == nullptr )
{
drill_layer = new EXCELLON_IMAGE( layerId );
layerId = images->AddGbrImage( drill_layer, layerId );
}
if( layerId < 0 )
{
DisplayError( this, _( "No room to load file" ) );
return false;
}
// Read the Excellon drill file:
bool success = drill_layer->LoadFile( aFullFileName );
if( !success )
{
msg.Printf( _( "File %s not found" ), GetChars( aFullFileName ) );
DisplayError( this, msg );
return false;
}
// Display errors list
if( drill_layer->GetMessages().size() > 0 )
{
HTML_MESSAGE_BOX dlg( this, _( "Error reading EXCELLON drill file" ) );
dlg.ListSet( drill_layer->GetMessages() );
dlg.ShowModal();
}
if( success )
{
EDA_DRAW_PANEL_GAL* canvas = GetGalCanvas();
if( canvas )
{
KIGFX::VIEW* view = canvas->GetView();
for( GERBER_DRAW_ITEM* item = drill_layer->GetItemsList(); item; item = item->Next() )
{
view->Add( (KIGFX::VIEW_ITEM*) item );
}
}
}
return success;
}