本文整理汇总了C++中SELECTION类的典型用法代码示例。如果您正苦于以下问题:C++ SELECTION类的具体用法?C++ SELECTION怎么用?C++ SELECTION使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SELECTION类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: makeSelection
bool EDIT_TOOL::makeSelection( const SELECTION& aSelection )
{
if( aSelection.Empty() ) // Try to find an item that could be modified
m_toolMgr->RunAction( COMMON_ACTIONS::selectionSingle, true );
return !aSelection.Empty();
}
开发者ID:LDavis4559,项目名称:kicad-source-mirror,代码行数:7,代码来源:edit_tool.cpp
示例2: sameNetFunc
bool SELECTION_CONDITIONS::sameNetFunc( const SELECTION& aSelection )
{
if( aSelection.Empty() )
return false;
int netcode = -1;
for( int i = 0; i < aSelection.Size(); ++i )
{
const BOARD_CONNECTED_ITEM* item =
dynamic_cast<const BOARD_CONNECTED_ITEM*>( aSelection.Item<EDA_ITEM>( i ) );
if( !item )
return false;
if( netcode < 0 )
{
netcode = item->GetNetCode();
if( netcode == NETINFO_LIST::UNCONNECTED )
return false;
}
else if( netcode != item->GetNetCode() )
{
return false;
}
}
return true;
}
开发者ID:morio,项目名称:kicad-source-mirror,代码行数:30,代码来源:selection_conditions.cpp
示例3: onlyTypeFunc
bool SELECTION_CONDITIONS::onlyTypeFunc( const SELECTION& aSelection, KICAD_T aType )
{
if( aSelection.Empty() )
return false;
for( int i = 0; i < aSelection.Size(); ++i )
{
if( aSelection.Item<EDA_ITEM>( i )->Type() != aType )
return false;
}
return true;
}
开发者ID:morio,项目名称:kicad-source-mirror,代码行数:13,代码来源:selection_conditions.cpp
示例4: OnlyConnectedItems
bool SELECTION_CONDITIONS::OnlyConnectedItems( const SELECTION& aSelection )
{
if( aSelection.Empty() )
return false;
for( int i = 0; i < aSelection.Size(); ++i )
{
KICAD_T type = aSelection.Item<EDA_ITEM>( i )->Type();
if( type != PCB_PAD_T && type != PCB_VIA_T && type != PCB_TRACE_T && type != PCB_ZONE_T )
return false;
}
return true;
}
开发者ID:morio,项目名称:kicad-source-mirror,代码行数:15,代码来源:selection_conditions.cpp
示例5: hoverSelection
bool EDIT_TOOL::hoverSelection( const SELECTION& aSelection, bool aSanitize )
{
if( aSelection.Empty() ) // Try to find an item that could be modified
{
m_toolMgr->RunAction( COMMON_ACTIONS::selectionCursor, true );
if( m_selectionTool->CheckLock() == SELECTION_LOCKED )
{
m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true );
return false;
}
}
if( aSanitize )
m_selectionTool->SanitizeSelection();
if( aSelection.Empty() ) // TODO is it necessary?
m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true );
return !aSelection.Empty();
}
开发者ID:OpenEE,项目名称:micad,代码行数:21,代码来源:edit_tool.cpp
示例6: addCornerCondition
bool POINT_EDITOR::addCornerCondition( const SELECTION& aSelection )
{
if( aSelection.Size() != 1 )
return false;
BOARD_ITEM* item = aSelection.Item<BOARD_ITEM>( 0 );
// Works only for zones and line segments
return item->Type() == PCB_ZONE_AREA_T ||
( ( item->Type() == PCB_LINE_T || item->Type() == PCB_MODULE_EDGE_T ) &&
static_cast<DRAWSEGMENT*>( item )->GetShape() == S_SEGMENT );
}
开发者ID:BTR1,项目名称:kicad-source-mirror,代码行数:12,代码来源:point_editor.cpp
示例7: sameLayerFunc
bool SELECTION_CONDITIONS::sameLayerFunc( const SELECTION& aSelection )
{
if( aSelection.Empty() )
return false;
LSET layerSet;
layerSet.set();
for( int i = 0; i < aSelection.Size(); ++i )
{
const BOARD_ITEM* item = dynamic_cast<const BOARD_ITEM*>( aSelection.Item<EDA_ITEM>( i ) );
if( !item )
return false;
layerSet &= item->GetLayerSet();
if( !layerSet.any() ) // there are no common layers left
return false;
}
return true;
}
开发者ID:morio,项目名称:kicad-source-mirror,代码行数:23,代码来源:selection_conditions.cpp
示例8: onlyTypesFunc
bool SELECTION_CONDITIONS::onlyTypesFunc( const SELECTION& aSelection, const std::vector<KICAD_T>& aTypes )
{
if( aSelection.Empty() )
return false;
for( int i = 0; i < aSelection.Size(); ++i )
{
bool valid = false;
for( std::vector<KICAD_T>::const_iterator it = aTypes.begin(); it != aTypes.end(); ++it )
{
if( aSelection.Item<EDA_ITEM>( i )->Type() == *it )
{
valid = true;
break;
}
}
if( !valid )
return false;
}
return true;
}
开发者ID:morio,项目名称:kicad-source-mirror,代码行数:24,代码来源:selection_conditions.cpp
示例9: OnlyConnectedItems
bool PCB_SELECTION_CONDITIONS::OnlyConnectedItems( const SELECTION& aSelection )
{
if( aSelection.Empty() )
return false;
for( const auto &item : aSelection )
{
auto type = item->Type();
if( type != PCB_PAD_T && type != PCB_VIA_T && type != PCB_TRACE_T && type != PCB_ZONE_AREA_T )
return false;
}
return true;
}
开发者ID:KiCad,项目名称:kicad-source-mirror,代码行数:15,代码来源:pcb_selection_conditions.cpp
示例10: getModificationPoint
wxPoint EDIT_TOOL::getModificationPoint( const SELECTION& aSelection )
{
if( aSelection.Size() == 1 )
{
return aSelection.Item<BOARD_ITEM>( 0 )->GetPosition() - m_offset;
}
else
{
// If EDIT_TOOL is not currently active then it means that the cursor position is not
// updated, so we have to fetch the latest value
if( m_toolMgr->GetCurrentToolId() != m_toolId )
m_cursor = getViewControls()->GetCursorPosition();
return wxPoint( m_cursor.x, m_cursor.y );
}
}
开发者ID:OpenEE,项目名称:micad,代码行数:16,代码来源:edit_tool.cpp
示例11: sameNetFunc
bool PCB_SELECTION_CONDITIONS::sameNetFunc( const SELECTION& aSelection, bool aAllowUnconnected )
{
if( aSelection.Empty() )
return false;
int netcode = -1; // -1 stands for 'net code is not yet determined'
for( const auto& aitem : aSelection )
{
int current_netcode = -1;
const BOARD_CONNECTED_ITEM* item =
dynamic_cast<const BOARD_CONNECTED_ITEM*>( aitem );
if( item )
{
current_netcode = item->GetNetCode();
}
else
{
if( !aAllowUnconnected )
return false;
else
// if it is not a BOARD_CONNECTED_ITEM, treat it as if there was no net assigned
current_netcode = 0;
}
assert( current_netcode >= 0 );
if( netcode < 0 )
{
netcode = current_netcode;
if( netcode == NETINFO_LIST::UNCONNECTED && !aAllowUnconnected )
return false;
}
else if( netcode != current_netcode )
{
return false;
}
}
return true;
}
开发者ID:KiCad,项目名称:kicad-source-mirror,代码行数:44,代码来源:pcb_selection_conditions.cpp
示例12: 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;
}
开发者ID:KiCad,项目名称:kicad-source-mirror,代码行数:19,代码来源:pcb_selection_conditions.cpp
示例13: ZoneMerge
int PCB_EDITOR_CONTROL::ZoneMerge( const TOOL_EVENT& aEvent )
{
SELECTION selection = m_toolMgr->GetTool<SELECTION_TOOL>()->GetSelection();
BOARD* board = getModel<BOARD>();
RN_DATA* ratsnest = board->GetRatsnest();
KIGFX::VIEW* view = getView();
if( selection.Size() < 2 )
return 0;
PICKED_ITEMS_LIST changes;
int netcode = -1;
// Loop through all combinations
for( int ia1 = 0; ia1 < selection.Size() - 1; ++ia1 )
{
ZONE_CONTAINER* curr_area = dynamic_cast<ZONE_CONTAINER*>( selection.Item<EDA_ITEM>( ia1 ) );
if( !curr_area )
continue;
netcode = curr_area->GetNetCode();
EDA_RECT b1 = curr_area->Outline()->GetBoundingBox();
bool mod_ia1 = false;
for( int ia2 = selection.Size() - 1; ia2 > ia1; --ia2 )
{
ZONE_CONTAINER* area2 = dynamic_cast<ZONE_CONTAINER*>( selection.Item<EDA_ITEM>( ia2 ) );
if( !area2 )
continue;
if( area2->GetNetCode() != netcode )
continue;
if( curr_area->GetPriority() != area2->GetPriority() )
continue;
if( curr_area->GetIsKeepout() != area2->GetIsKeepout() )
continue;
if( curr_area->GetLayer() != area2->GetLayer() )
continue;
EDA_RECT b2 = area2->Outline()->GetBoundingBox();
if( b1.Intersects( b2 ) )
{
EDA_ITEM* backup = curr_area->Clone();
bool ret = board->TestAreaIntersection( curr_area, area2 );
if( ret && board->CombineAreas( &changes, curr_area, area2 ) )
{
mod_ia1 = true;
selection.items.RemovePicker( ia2 );
ITEM_PICKER picker( curr_area, UR_CHANGED );
picker.SetLink( backup );
changes.PushItem( picker );
}
else
{
delete backup;
}
}
}
if( mod_ia1 )
--ia1; // if modified, we need to check it again
}
m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true );
m_frame->SaveCopyInUndoList( changes, UR_UNSPECIFIED );
for( unsigned i = 0; i < changes.GetCount(); ++i )
{
ITEM_PICKER picker = changes.GetItemWrapper( i );
BOARD_ITEM* item = static_cast<BOARD_ITEM*>( picker.GetItem() );
if( picker.GetStatus() == UR_DELETED )
{
view->Remove( item );
ratsnest->Remove( item );
}
else if( picker.GetStatus() == UR_CHANGED )
{
item->ViewUpdate( KIGFX::VIEW_ITEM::ALL );
m_toolMgr->RunAction( COMMON_ACTIONS::selectItem, true, item );
}
}
return 0;
}
开发者ID:grtwall,项目名称:kicad-source-mirror,代码行数:94,代码来源:pcb_editor_control.cpp
示例14: Activate
void PCB_TOOL::doInteractiveItemPlacement( INTERACTIVE_PLACER_BASE* aPlacer,
const wxString& aCommitMessage,
int aOptions )
{
using namespace std::placeholders;
std::unique_ptr<BOARD_ITEM> newItem;
Activate();
BOARD_COMMIT commit( frame() );
GetManager()->RunAction( PCB_ACTIONS::selectionClear, true );
// do not capture or auto-pan until we start placing an item
controls()->ShowCursor( true );
controls()->SetSnapping( true );
// Add a VIEW_GROUP that serves as a preview for the new item
SELECTION preview;
view()->Add( &preview );
aPlacer->m_board = board();
aPlacer->m_frame = frame();
if( aOptions & IPO_SINGLE_CLICK )
{
VECTOR2I cursorPos = controls()->GetCursorPosition();
newItem = aPlacer->CreateItem();
newItem->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
preview.Add( newItem.get() );
}
// Main loop: keep receiving events
while( OPT_TOOL_EVENT evt = Wait() )
{
VECTOR2I cursorPos = controls()->GetCursorPosition();
if( TOOL_EVT_UTILS::IsCancelInteractive( *evt ) )
{
if( newItem )
{
// Delete the old item and have another try
newItem = nullptr;
preview.Clear();
if( aOptions & IPO_SINGLE_CLICK )
break;
controls()->SetAutoPan( false );
controls()->CaptureCursor( false );
controls()->ShowCursor( true );
}
else
{
break;
}
if( evt->IsActivate() ) // now finish unconditionally
break;
}
else if( evt->IsClick( BUT_LEFT ) )
{
if( !newItem )
{
// create the item if possible
newItem = aPlacer->CreateItem();
// no item created, so wait for another click
if( !newItem )
continue;
controls()->CaptureCursor( true );
controls()->SetAutoPan( true );
newItem->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
preview.Add( newItem.get() );
if( newItem->Type() == PCB_MODULE_T )
{
auto module = dyn_cast<MODULE*>( newItem.get() );
// modules have more drawable parts
module->RunOnChildren( std::bind( &KIGFX::VIEW_GROUP::Add, &preview, _1 ) );
}
}
else
{
newItem->ClearFlags();
preview.Remove( newItem.get() );
aPlacer->PlaceItem( newItem.get() );
if( newItem->Type() == PCB_MODULE_T )
{
auto module = dyn_cast<MODULE*>( newItem.get() );
//.........这里部分代码省略.........
开发者ID:cpavlina,项目名称:kicad,代码行数:101,代码来源:pcb_tool.cpp
示例15: NotEmpty
bool SELECTION_CONDITIONS::NotEmpty( const SELECTION& aSelection )
{
return !aSelection.Empty();
}
开发者ID:morio,项目名称:kicad-source-mirror,代码行数:4,代码来源:selection_conditions.cpp
示例16: lessThanFunc
bool SELECTION_CONDITIONS::lessThanFunc( const SELECTION& aSelection, int aNumber )
{
return aSelection.Size() < aNumber;
}
开发者ID:morio,项目名称:kicad-source-mirror,代码行数:4,代码来源:selection_conditions.cpp
示例17: countFunc
bool SELECTION_CONDITIONS::countFunc( const SELECTION& aSelection, int aNumber )
{
return aSelection.Size() == aNumber;
}
开发者ID:morio,项目名称:kicad-source-mirror,代码行数:4,代码来源:selection_conditions.cpp
示例18: exitTASEditor
bool exitTASEditor()
{
if (!askToSaveProject()) return false;
// destroy window
taseditorWindow.exit();
disableGeneralKeyboardInput();
// release memory
editor.free();
pianoRoll.free();
markersManager.free();
greenzone.free();
bookmarks.free();
branches.free();
popupDisplay.free();
history.free();
playback.stopSeeking();
selection.free();
// restore "eoptions"
eoptions = saved_eoptions;
// restore autosaves
EnableAutosave = saved_EnableAutosave;
DoPriority();
// restore frame_display
frame_display = saved_frame_display;
UpdateCheckedMenuItems();
// switch off TAS Editor mode
movieMode = MOVIEMODE_INACTIVE;
FCEU_DispMessage("TAS Editor disengaged", 0);
FCEUMOV_CreateCleanMovie();
return true;
}
开发者ID:Plombo,项目名称:fceux,代码行数:33,代码来源:taseditor.cpp
示例19: handleInputColumnSetUsingPattern
bool EDITOR::handleInputColumnSetUsingPattern(int joy, int button)
{
if (joy < 0 || joy >= joysticksPerFrame[getInputType(currMovieData)]) return false;
RowsSelection* current_selection = selection.getCopyOfCurrentRowsSelection();
if (current_selection->size() == 0) return false;
RowsSelection::iterator current_selection_begin(current_selection->begin());
RowsSelection::iterator current_selection_end(current_selection->end());
int pattern_offset = 0, current_pattern = taseditorConfig.currentPattern;
for(RowsSelection::iterator it(current_selection_begin); it != current_selection_end; it++)
{
// skip lag frames
if (taseditorConfig.autofirePatternSkipsLag && greenzone.lagLog.getLagInfoAtFrame(*it) == LAGGED_YES)
continue;
currMovieData.records[*it].setBitValue(joy, button, patterns[current_pattern][pattern_offset] != 0);
pattern_offset++;
if (pattern_offset >= (int)patterns[current_pattern].size())
pattern_offset -= patterns[current_pattern].size();
}
int first_changes = history.registerChanges(MODTYPE_PATTERN, *current_selection_begin, *current_selection->rbegin(), 0, patternsNames[current_pattern].c_str());
if (first_changes >= 0)
{
greenzone.invalidateAndUpdatePlayback(first_changes);
return true;
} else
return false;
}
开发者ID:CharlexH,项目名称:Provenance,代码行数:28,代码来源:editor.cpp
示例20: setMarkers
void EDITOR::setMarkers()
{
RowsSelection* current_selection = selection.getCopyOfCurrentRowsSelection();
if (current_selection->size())
{
RowsSelection::iterator current_selection_begin(current_selection->begin());
RowsSelection::iterator current_selection_end(current_selection->end());
bool changes_made = false;
for(RowsSelection::iterator it(current_selection_begin); it != current_selection_end; it++)
{
if (!markersManager.getMarkerAtFrame(*it))
{
if (markersManager.setMarkerAtFrame(*it))
{
changes_made = true;
pianoRoll.redrawRow(*it);
}
}
}
if (changes_made)
{
selection.mustFindCurrentMarker = playback.mustFindCurrentMarker = true;
history.registerMarkersChange(MODTYPE_MARKER_SET, *current_selection_begin, *current_selection->rbegin());
}
}
}
开发者ID:CharlexH,项目名称:Provenance,代码行数:26,代码来源:editor.cpp
注:本文中的SELECTION类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论