本文整理汇总了C++中SelectionList类的典型用法代码示例。如果您正苦于以下问题:C++ SelectionList类的具体用法?C++ SelectionList怎么用?C++ SelectionList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SelectionList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NumToStr
///////////////
// SetPrompt //
///////////////
void
PlayerPrompt::SetPrompt( uint playerNum, std::string prompt, SelectionList selections, HotKeyList hotKeys )
{
GameUtilities::IGraphicsProvider::TextInfo textInfo;
textInfo.contents = "Player " + NumToStr( playerNum ) + ": " + prompt;
textInfo.fontSize = 1;
textInfo.position.x = 100;
textInfo.position.y = 720;
textInfo.argb[0] = 255;
textInfo.argb[1] = 155;
textInfo.argb[2] = 155;
textInfo.argb[3] = 155;
ServProvider()->GetGraphicsProvider()->SetText( m_promptID, "prompt", textInfo );
std::string selectionStr;
uint hotKeyCounter = 0;
for( SelectionList::iterator selectionItemItr = selections.begin();
selectionItemItr != selections.end(); ++selectionItemItr )
{
std::stringstream s;
s << hotKeys[hotKeyCounter++];
selectionStr += s.str() + " - " + *selectionItemItr + " ";
}
textInfo.contents = selectionStr;
textInfo.position.y = 760;
textInfo.argb[1] = 255;
textInfo.argb[2] = 255;
textInfo.argb[3] = 255;
ServProvider()->GetGraphicsProvider()->SetText( m_promptID, "selections", textInfo );
}
示例2: dialog
void
AnimationFrame::OnCmd_FollowMarcher(wxCommandEvent& event)
{
wxTextEntryDialog dialog(this,
wxT("Please enter a marcher to follow (or -1 to stop following)\n"),
wxT("Follow Marcher"),
wxT(""),
wxOK | wxCANCEL);
if (dialog.ShowModal() == wxID_OK)
{
wxString value = dialog.GetValue();
auto& labels = mAnimationView->GetShow()->GetPointLabels();
auto which = std::find(labels.begin(), labels.end(), value);
if (which == labels.end())
{
wxString upper_value = value.Upper();
which = std::find(labels.begin(), labels.end(), upper_value);
}
if (which == labels.end())
{
wxMessageDialog dialog(this, wxT("Could not find marcher"), wxT("Could not find marcher ") + value, wxOK);
dialog.ShowModal();
return;
}
if (mOmniViewCanvas)
{
mOmniViewCanvas->OnCmd_FollowMarcher(std::distance(labels.begin(), which));
}
SelectionList sl;
sl.insert(std::distance(labels.begin(), which));
mAnimationView->SetSelection(sl);
}
Refresh();
}
示例3: onMouseClick
void ListElementWidget::onMouseClick(void)
{
SelectionList *list = dynamic_cast<SelectionList*>(parent);
if(list)
{
list->childWasClicked(this);
}
}
示例4: OnSelectionChanged
void WorkspacePanel::OnSelectionChanged(wxTreeEvent& event)
{
SelectionList list;
wxTreeItemId id = event.GetItem();
if(isProject(id)) list.push_back(getProject(id));
else if(isMaterial(id)) list.push_back(getMaterial(id));
else if(isTechnique(id)) list.push_back(getTechnique(id));
else if(isPass(id)) list.push_back(getPass(id));
// else its the workspace so just leave the list empty as if nothing were selected
SelectionService::getSingletonPtr()->setSelection(list);
}
示例5: DrawSheetPoints
void DrawSheetPoints(wxDC& dc, const CalChartConfiguration& config, CC_coord origin, const SelectionList& selection_list, unsigned short numberPoints, const std::vector<std::string>& labels, const CC_sheet& sheet, unsigned ref, CalChartColors unselectedColor, CalChartColors selectedColor, CalChartColors unselectedTextColor, CalChartColors selectedTextColor)
{
SaveAndRestore_Font orig_font(dc);
wxFont *pointLabelFont = wxTheFontList->FindOrCreateFont((int)Float2Coord(config.Get_DotRatio() * config.Get_NumRatio()), wxSWISS, wxNORMAL, wxNORMAL);
dc.SetFont(*pointLabelFont);
dc.SetTextForeground(config.Get_CalChartBrushAndPen(COLOR_POINT_TEXT).first.GetColour());
for (size_t i = 0; i < numberPoints; i++)
{
wxBrush fillBrush;
if (selection_list.count(i))
{
auto brushAndPen = config.Get_CalChartBrushAndPen(selectedColor);
fillBrush = brushAndPen.first;
dc.SetBrush(brushAndPen.first);
dc.SetPen(brushAndPen.second);
dc.SetTextForeground(config.Get_CalChartBrushAndPen(selectedTextColor).second.GetColour());
}
else
{
auto brushAndPen = config.Get_CalChartBrushAndPen(unselectedColor);
fillBrush = brushAndPen.first;
dc.SetBrush(brushAndPen.first);
dc.SetPen(brushAndPen.second);
dc.SetTextForeground(config.Get_CalChartBrushAndPen(unselectedTextColor).second.GetColour());
}
DrawPoint(dc, config, sheet.GetPoint(i), ref, origin, labels.at(i));
}
}
示例6: unTag_action
void TimeTaggerDialog::unTag_action() {
if (this==NULL)
return;
SelectionList listForRemoval;
int i=findSelection(0,SELECTION_OUTSIDE);
if (i>=0) {
while (i>=0) {
listForRemoval.append(Selection(tags[i].first,tags[i].second));
tags.removeAt(i);
i--;
i=findSelection(i+1,SELECTION_OUTSIDE);
}
} else {
QTextCursor c=text->textCursor();
int start=c.selectionStart();
int end=c.selectionEnd();
int i=findSelection(0,SELECTION_OUTSIDEOVERLAP);
if (i>=0) {
listForRemoval.append(Selection(start,end-1));
}
while (i>=0) {
if (tags[i].first>=start) {
tags[i].first=end;
} else {
tags[i].second=start-1;
}
if (tags[i].first==tags[i].second) {
tags.removeAt(i);
i--;
}
i=findSelection(i+1,SELECTION_OUTSIDEOVERLAP);
}
}
QTextCursor c=text->textCursor();
for (int i=0;i<listForRemoval.size();i++) {
c.setPosition(listForRemoval[i].first,QTextCursor::MoveAnchor);
c.setPosition(listForRemoval[i].second+1,QTextCursor::KeepAnchor);
text->setTextCursor(c);
text->setTextBackgroundColor(Qt::white);
text->setTextColor(Qt::black);
text->setTextCursor(c);
}
c.clearSelection();
text->setTextCursor(c);
}
示例7: overLapNamesFinished
void AbstractTwoLevelAgreement::overLapNamesFinished(const SelectionList & tagWords, const SelectionList & outputWords,int &numWords) {
if (tagWords.size()==0 && outputWords.size()==0 )
return;
bool underComputation=(&numWords==&underNumWords);
int countCommon=commonWords(text,tagWords,outputWords); //not working correctly on maximal boundaries
int countCorrect=countWords(text,tagWords);
int countDetected=countWords(text,outputWords);
assert (countCorrect!=0);
assert (countDetected!=0);
numWords+=countCorrect;
double recall=(double)countCommon/countCorrect * countCorrect,
precision=(double)countCommon/countDetected *countCorrect;
if (countDetected==0)
precision=0;
if (underComputation) {
underBoundaryRecallList.append(recall);
underBoundaryPrecisionList.append(precision);
} else {
boundaryRecallList.append(recall);
boundaryPrecisionList.append(precision);
}
}
示例8:
void
Angle::checkSelections(const SelectionList &sel1,
const SelectionList &sel2) const
{
if (natoms2_ > 0 && sel1.size() != sel2.size())
{
GMX_THROW(InconsistentInputError(
"-group1 and -group2 should specify the same number of selections"));
}
for (size_t g = 0; g < sel1.size(); ++g)
{
int na1 = sel1[g].posCount();
int na2 = (natoms2_ > 0) ? sel2[g].posCount() : 0;
if (natoms1_ > 1 && na1 % natoms1_ != 0)
{
GMX_THROW(InconsistentInputError(formatString(
"Number of positions in selection %d in the first group not divisible by %d",
static_cast<int>(g + 1), natoms1_)));
}
if (natoms2_ > 1 && na2 % natoms2_ != 0)
{
GMX_THROW(InconsistentInputError(formatString(
"Number of positions in selection %d in the second group not divisible by %d",
static_cast<int>(g + 1), natoms2_)));
}
if (natoms1_ > 0 && natoms2_ > 1 && na1 / natoms1_ != na2 / natoms2_)
{
GMX_THROW(InconsistentInputError(
"Number of vectors defined by the two groups are not the same"));
}
if (g2type_[0] == 's' && sel2[g].posCount() != 1)
{
GMX_THROW(InconsistentInputError(
"The second group should contain a single position with -g2 sphnorm"));
}
}
}
示例9:
SelectionList
TrajectoryAnalysisModuleData::parallelSelections(const SelectionList &selections)
{
// TODO: Consider an implementation that does not allocate memory every time.
SelectionList newSelections;
newSelections.reserve(selections.size());
SelectionList::const_iterator i = selections.begin();
for (; i != selections.end(); ++i)
{
newSelections.push_back(parallelSelection(*i));
}
return newSelections;
}
示例10: selectionChanged
void PropertiesPanel::selectionChanged(EventArgs& args)
{
SelectionEventArgs sea = dynamic_cast<SelectionEventArgs&>(args);
SelectionList selection = sea.getSelection();
if(!selection.empty())
{
boost::any sel = selection.front();
if(sel.type() == typeid(Project))
{
}
else if(sel.type() == typeid(MaterialController*))
{
MaterialController* mc = any_cast<MaterialController*>(sel);
MaterialPageIndexMap::iterator it = mMaterialPageIndexMap.find(mc);
if(it != mMaterialPageIndexMap.end())
{
int index = mMaterialPageIndexMap[mc];
mPropertyGrid->SelectPage(index);
}
else
{
MaterialPropertyGridPage* page = new MaterialPropertyGridPage(mc);
int index = mPropertyGrid->AddPage(wxEmptyString, wxPG_NULL_BITMAP, page);
page->populate();
mMaterialPageIndexMap[mc] = index;
mPropertyGrid->SelectPage(index);
}
}
else if(sel.type() == typeid(TechniqueController*))
{
TechniqueController* tc = any_cast<TechniqueController*>(sel);
TechniquePageIndexMap::iterator it = mTechniquePageIndexMap.find(tc);
if(it != mTechniquePageIndexMap.end())
{
int index = mTechniquePageIndexMap[tc];
mPropertyGrid->SelectPage(index);
}
else
{
TechniquePropertyGridPage* page = new TechniquePropertyGridPage(tc);
int index = mPropertyGrid->AddPage(wxEmptyString, wxPG_NULL_BITMAP, page);
page->populate();
mTechniquePageIndexMap[tc] = index;
mPropertyGrid->SelectPage(index);
}
}
else if(sel.type() == typeid(PassController*))
{
PassController* pc = any_cast<PassController*>(sel);
PassPageIndexMap::iterator it = mPassPageIndexMap.find(pc);
if(it != mPassPageIndexMap.end())
{
int index = mPassPageIndexMap[pc];
mPropertyGrid->SelectPage(index);
}
else
{
PassPropertyGridPage* page = new PassPropertyGridPage(pc);
int index = mPropertyGrid->AddPage(wxEmptyString, wxPG_NULL_BITMAP, page);
page->populate();
mPassPageIndexMap[pc] = index;
mPropertyGrid->SelectPage(index);
}
}
mPropertyGrid->Refresh();
}
}
示例11: assert
void AbstractTwoLevelAgreement::overLapMainFinished(int i,int j,const SelectionList & tagNames, const SelectionList & outputNames,int &numNames) {
bool underComputation=(&numNames==&underNumNames);
assert(underComputation || (i<0 && j<0 )); //if in max-boundary, i and j have no significance
QSet<int> visitedTags;
int allCommonCount;
int countCommon=commonNames(tagNames,outputNames,visitedTags,allCommonCount);
int countCorrect=tagNames.size();
int countDetected=outputNames.size();
assert (countCommon<=countDetected);
if (countCorrect>0) {
numNames+=countCorrect;
double recall=(double)countCommon/countCorrect * countCorrect,
precision=(double)countCommon/countDetected *countCorrect;
if (countDetected==0)
precision=0;
if (underComputation) {
underNameRecallList.append(recall);
underNamePrecisionList.append(precision);
} else {
nameRecallList.append(recall);
namePrecisionList.append(precision);
}
int k=0,h=0;
QList<int> common_k,common_h;
SelectionList tagWords, outputWords;
while (k<tagNames.size() && h<outputNames.size()) {
int start1=tagNames[k].first,end1=tagNames[k].second,
start2=outputNames[h].first,end2=outputNames[h].second;
if (overLaps(start1,end1,start2,end2) && start1!=end2) {
bool foundK=common_k.contains(k), foundH=common_h.contains(h);
if (underComputation)
startNamesOverLap(i,j,k,h,countCommon);
if (!foundK /*&& !foundJ*/) {//so that merged parts will not be double counted
common_k.append(k);
tagWords.append(tagNames[k]);
if (foundH) { //new correctnode that matches detected
if (underComputation)
anotherTagOverLapPreviousOutputName(i,j,k,h);
}
}
if (!foundH) {//common_i and common_j now are not same size, bc recall and precision need different treatment for overlap
common_h.append(h);
outputWords.append(outputNames[h]);
if (foundK) { //new detectednode that matches correct
if (underComputation)
anotherOutputOverLapPreviousTagName(i,j,k,h);
}
}
if (!foundK && !foundH) {
if (underComputation)
firstNameOverLap(i,j,k,h);
}
//[underboundary computations
SelectionList singleTagWords, singleOutputWords;
singleTagWords.append(tagNames[k]);
singleOutputWords.append(outputNames[h]);
overLapNamesFinished(singleTagWords,singleOutputWords,underNumWords);
//]
int process=0;
if (end1<=end2 ) {
k++;
process++;
}
if (end2<=end1) {
h++;
process++;
}
if (process==2) {
//[max-boundary computations
overLapNamesFinished(tagWords,outputWords,numWords);
//]
tagWords.clear();
outputWords.clear();
}
} else if (before(start1,end1,start2,end2)) {
if (underComputation)
beforeMovingToNextTagName(i,j,k,h);
//[max-boundary computations
overLapNamesFinished(tagWords,outputWords,numWords);
//]
tagWords.clear();
outputWords.clear();
k++;
} else if (after(start1,end1,start2,end2) ) {
if (underComputation)
beforeMovingToNextOutputName(i,j,k,h);
//[max-boundary computations
overLapNamesFinished(tagWords,outputWords,numWords);
//]
tagWords.clear();
outputWords.clear();
h++;
}
}
if (tagWords.size()>0 || outputWords.size()>0) {
//[max-boundary computations
overLapNamesFinished(tagWords,outputWords,numWords);
//]
tagWords.clear();
outputWords.clear();
//.........这里部分代码省略.........
示例12: main
int main(int argc,char** argv)
{
osgViewer::Viewer viewer;
osg::Camera* camera = createMasterCamera( 50, 50, 640, 480 );
viewer.setCamera(camera);
viewer.addEventHandler(new PickNode);
osg::ref_ptr<osg::Group> root = new osg::Group;
viewer.setSceneData(root.get());
osgDragger::ShowBound::Instence()->setNodeMask(~0x1);
root->addChild(osgDragger::ShowBound::Instence()->getRoot());
osg::ref_ptr<osg::MatrixTransform> scene = new osg::MatrixTransform;
root->addChild(scene.get());
scene->setNodeMask(0x1);
osg::ref_ptr<osg::Camera> hudCamera = 0;
osg::ref_ptr<osgDragger::HudCamera> _hudCamera;
osgViewer::Viewer::Windows windows;
viewer.getWindows(windows);
if (windows.size() != 0)
{
hudCamera = createHUD(windows[0]);
hudCamera->addChild(CustomDraggerManager::Instence()->getRoot());
viewer.addSlave(hudCamera.get(), false);
_hudCamera = new osgDragger::HudCamera(hudCamera.get(), 60, 60);//左下角坐标系
}
else
{
CustomDraggerManager::Instence()->getRoot()->getOrCreateStateSet()->setAttributeAndModes(new osgDragger::ClearDepth);
CustomDraggerManager::Instence()->getRoot()->getOrCreateStateSet()->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
CustomDraggerManager::Instence()->getRoot()->getOrCreateStateSet()->setMode(GL_NORMALIZE, osg::StateAttribute::ON);
root->addChild(CustomDraggerManager::Instence()->getRoot());
_hudCamera = new osgDragger::HudCamera(camera, 60, 60);//左下角坐标系
}
osgDragger::MoveDragger* move = new osgDragger::MoveDragger;
move->setName("move");
move->setIntersectionMask(0x2);
move->setIntersectionCamera(hudCamera.get());
move->setupDefaultGeometry();
move->setHandleEvents(true);
CustomDraggerManager::Instence()->addDragger(move, true);
CustomDraggerManager::Instence()->setIntersectionMask(0x2);
osgDragger::RotateDragger* rotate = new osgDragger::RotateDragger;
rotate->setName("rotate");
rotate->setIntersectionMask(0x2);
rotate->setIntersectionCamera(hudCamera.get());
rotate->setupDefaultGeometry();
rotate->setHandleEvents(true);
CustomDraggerManager::Instence()->addDragger(rotate, false);
CustomDraggerManager::Instence()->setIntersectionMask(0x2);
osg::ref_ptr<osg::Geode> geode = new osg::Geode;
geode->addDrawable(new osg::ShapeDrawable(new osg::Box(osg::Vec3(), 5.0f)));
SelectionList sl;
{
osg::ref_ptr<osg::MatrixTransform> mt = new osg::MatrixTransform;
mt->setName("mt");
mt->addChild(geode.get());
sl.push_back(mt.get());
scene->addChild(mt.get());
}
{
osg::ref_ptr<osg::MatrixTransform> mt = new osg::MatrixTransform;
mt->setName("mt");
mt->setMatrix(osg::Matrix::translate(osg::Vec3(20,0,0)));
mt->addChild(geode.get());
scene->addChild(mt.get());
}
CustomDraggerManager::Instence()->setSelections(sl);
viewer.setCameraManipulator(new osgGA::TrackballManipulator);
while (!viewer.done())
{
viewer.frame();
}
return 0;
}
示例13: fprintf
void
AnalysisTemplate::writeOutput()
{
// We print out the average of the mean distances for each group.
for (size_t g = 0; g < sel_.size(); ++g)
{
fprintf(stderr, "Average mean distance for '%s': %.3f nm\n",
sel_[g].name(), avem_->average(0, g));
}
}
示例14: fprintf
void
SelectionTester::printSelections()
{
fprintf(stderr, "\nSelections:\n");
for (size_t g = 0; g < selections_.size(); ++g)
{
selections_[g].printDebugInfo(stderr, nmaxind_);
}
fprintf(stderr, "\n");
}
示例15: plotm
void
AnalysisTemplate::initAnalysis(const TrajectoryAnalysisSettings &settings,
const TopologyInformation & /*top*/)
{
nb_.setCutoff(cutoff_);
data_.setColumnCount(0, sel_.size());
avem_.reset(new AnalysisDataAverageModule());
data_.addModule(avem_);
if (!fnDist_.empty())
{
AnalysisDataPlotModulePointer plotm(
new AnalysisDataPlotModule(settings.plotSettings()));
plotm->setFileName(fnDist_);
plotm->setTitle("Average distance");
plotm->setXAxisIsTime();
plotm->setYLabel("Distance (nm)");
data_.addModule(plotm);
}
}