本文整理汇总了C++中Selectable::setSelected方法的典型用法代码示例。如果您正苦于以下问题:C++ Selectable::setSelected方法的具体用法?C++ Selectable::setSelected怎么用?C++ Selectable::setSelected使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Selectable
的用法示例。
在下文中一共展示了Selectable::setSelected方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: next
void ScanningControl::next()
{
Scanning *scanning = Scanning::instance();
if (!scanning)
return;
if (!scanning->m_scanning.contains(scanning->m_selected))
return;
QList<Selectable *> *list = scanning->m_scanning.value(scanning->m_selected);
if (list->size() == 0) {
scanning->select(scanning->m_root);
} else {
Selectable *nowSelected = list->at(m_index);
m_index = nowSelected->selected() ? (m_index + 1) % list->size() : 0;
Selectable *nextSelected = list->at(m_index);
nowSelected->setSelected(false);
nextSelected->setSelected(true);
}
}
示例2: entitylist_tree_select
static gboolean entitylist_tree_select(GtkTreeSelection *selection, GtkTreeModel *model, GtkTreePath *path, gboolean path_currently_selected, gpointer data)
{
GtkTreeIter iter;
gtk_tree_model_get_iter(model, &iter, path);
scene::Node* node;
gtk_tree_model_get_pointer(model, &iter, 0, &node);
scene::Instance* instance;
gtk_tree_model_get_pointer(model, &iter, 1, &instance);
Selectable* selectable = Instance_getSelectable(*instance);
if(node == 0)
{
if(path_currently_selected != FALSE)
{
getEntityList().m_selection_disabled = true;
GlobalSelectionSystem().setSelectedAll(false);
getEntityList().m_selection_disabled = false;
}
}
else if(selectable != 0)
{
getEntityList().m_selection_disabled = true;
selectable->setSelected(path_currently_selected == FALSE);
getEntityList().m_selection_disabled = false;
return TRUE;
}
return FALSE;
}
示例3: select
void ScanningControl::select()
{
Scanning *scanning = Scanning::instance();
if (!scanning)
return;
if (!scanning->m_scanning.contains(scanning->m_selected))
return;
QList<Selectable *> *list = scanning->m_scanning.value(scanning->m_selected);
Selectable *selected = list->at(m_index);
selected->setSelected(false);
QList<Selectable *> *listSelected = scanning->m_scanning.value(selected);
if (listSelected->size() == 0) {
qDebug() << "Action from " << selected;
scanning->select(scanning->m_root);
} else {
scanning->select(selected);
}
m_index = 0;
}
示例4: unselectAll
void SelectableGroup::unselectAll()
{
Selectable* selected = this->getSelection();
if(selected != NULL)
selected->setSelected(false);
this->notifySelectionChanged();
}
示例5: deselectCB
void deselectCB(void *data, SoPath *path)
{
ManipMaster *master = static_cast<ManipMaster *>(data);
LabObject *obj;
if (LabObject::isLabObject(path->getTail(), &obj)) {
if (obj->getTypeId() == Selectable::classTypeId) {
Selectable *sel = static_cast<Selectable *>(obj);
sel->setSelected(false);
master->setSelected(NULL);
}
}
}
示例6: SelectPoint
/* greebo: This gets called by SelectObserver if the user just clicks into the scene (without dragging)
* It checks for any possible targets (in the "line of click") and takes the actions according
* to the modifiers that are held down (Alt-Shift, etc.)
*/
void RadiantSelectionSystem::SelectPoint(const View& view,
const Vector2& device_point,
const Vector2& device_epsilon,
SelectionSystem::EModifier modifier,
bool face)
{
ASSERT_MESSAGE(fabs(device_point[0]) <= 1.0f && fabs(device_point[1]) <= 1.0f, "point-selection error");
// If the user is holding the replace modifiers (default: Alt-Shift), deselect the current selection
if (modifier == SelectionSystem::eReplace) {
if (face) {
setSelectedAllComponents(false);
}
else {
deselectAll();
}
}
{
View scissored(view);
// Construct a selection test according to a small box with 2*epsilon edge length
ConstructSelectionTest(scissored, Rectangle::ConstructFromPoint(device_point, device_epsilon));
// Create a new SelectionPool instance and fill it with possible candidates
SelectionVolume volume(scissored);
// The possible candidates are stored in the SelectablesSet
SelectablesList candidates;
if (face)
{
SelectionPool selector;
ComponentSelector selectionTester(selector, volume, eFace);
GlobalSceneGraph().foreachVisibleNodeInVolume(scissored, selectionTester);
// Load them all into the vector
for (SelectionPool::iterator i = selector.begin(); i != selector.end(); ++i)
{
candidates.push_back(i->second);
}
}
else {
testSelectScene(candidates, volume, scissored, Mode(), ComponentMode());
}
// Was the selection test successful (have we found anything to select)?
if (candidates.size() > 0) {
// Yes, now determine how we should interpret the click
switch (modifier) {
// If we are in toggle mode (Shift-Left-Click by default), just toggle the
// selection of the "topmost" item
case SelectionSystem::eToggle: {
Selectable* best = *candidates.begin();
// toggle selection of the object with least depth (=first in the list)
best->setSelected(!best->isSelected());
}
break;
// greebo: eReplace mode gets active as soon as the user holds the replace modifiers down
// and clicks (by default: Alt-Shift). eReplace is only active during the first click
// afterwards we are in cycle mode.
// if cycle mode not enabled, enable it
case SelectionSystem::eReplace: {
// select closest (=first in the list)
(*candidates.begin())->setSelected(true);
}
break;
// select the next object in the list from the one already selected
// greebo: eCycle is set if the user keeps holding the replace modifiers (Alt-Shift)
// and does NOT move the mouse between the clicks, otherwise we fall back into eReplace mode
// Note: The mode is set in SelectObserver::testSelect()
case SelectionSystem::eCycle: {
// Cycle through the selection pool and activate the item right after the currently selected
SelectablesList::iterator i = candidates.begin();
while (i != candidates.end()) {
if ((*i)->isSelected()) {
// unselect the currently selected one
(*i)->setSelected(false);
// check if there is a "next" item in the list, if not: select the first item
++i;
if (i != candidates.end()) {
(*i)->setSelected(true);
}
else {
(*candidates.begin())->setSelected(true);
}
break;
}
++i;
} // while
} // case
break;
default:
break;
} // switch
}
}
//.........这里部分代码省略.........
示例7: testSelect
void TranslateManipulator::testSelect(const render::View& view, const Matrix4& pivot2world) {
_pivot.update(pivot2world, view.GetModelview(), view.GetProjection(), view.GetViewport());
SelectionPool selector;
Vector3 x = _pivot._worldSpace.x().getVector3().getNormalised();
bool show_x = manipulator_show_axis(_pivot, x);
Vector3 y = _pivot._worldSpace.y().getVector3().getNormalised();
bool show_y = manipulator_show_axis(_pivot, y);
Vector3 z = _pivot._worldSpace.z().getVector3().getNormalised();
bool show_z = manipulator_show_axis(_pivot, z);
{
Matrix4 local2view(view.GetViewMatrix().getMultipliedBy(_pivot._viewpointSpace));
{
SelectionIntersection best;
Quad_BestPoint(local2view, eClipCullCW, &_quadScreen.front(), best);
if(best.valid())
{
best = SelectionIntersection(0, 0);
selector.addSelectable(best, &_selectableScreen);
}
}
}
{
Matrix4 local2view(view.GetViewMatrix().getMultipliedBy(_pivot._worldSpace));
if(show_x)
{
SelectionIntersection best;
Line_BestPoint(local2view, &_arrowX.front(), best);
Triangles_BestPoint(local2view, eClipCullCW, &_arrowHeadX._vertices.front(), &*(_arrowHeadX._vertices.end()-1)+1, best);
selector.addSelectable(best, &_selectableX);
}
if(show_y)
{
SelectionIntersection best;
Line_BestPoint(local2view, &_arrowY.front(), best);
Triangles_BestPoint(local2view, eClipCullCW, &_arrowHeadY._vertices.front(), &*(_arrowHeadY._vertices.end()-1)+1, best);
selector.addSelectable(best, &_selectableY);
}
if(show_z)
{
SelectionIntersection best;
Line_BestPoint(local2view, &_arrowZ.front(), best);
Triangles_BestPoint(local2view, eClipCullCW, &_arrowHeadZ._vertices.front(), &*(_arrowHeadZ._vertices.end()-1)+1, best);
selector.addSelectable(best, &_selectableZ);
}
}
// greebo: If any of the above arrows could be selected, select the first in the SelectionPool
if(!selector.failed()) {
(*selector.begin()).second->setSelected(true);
} else {
Selectable* selectable = NULL;
if (registry::getValue<bool>(RKEY_TRANSLATE_CONSTRAINED)) {
// None of the shown arrows (or quad) has been selected, select an axis based on the precedence
Matrix4 local2view(view.GetViewMatrix().getMultipliedBy(_pivot._worldSpace));
// Get the (relative?) distance from the mouse pointer to the manipulator
Vector3 delta = local2view.t().getProjected();
// Get the precedence (which axis has the absolute largest value in it)
bool xGreaterY = (fabs(delta.x()) > fabs(delta.y()));
// The precedence has to be interpreted according to which axes are visible
if (show_z) {
// Either XZ or YZ
if (show_y) {
// YZ
selectable = (xGreaterY) ? &_selectableY : &_selectableZ;
}
else {
// XZ
selectable = (xGreaterY) ? &_selectableX : &_selectableZ;
}
}
else {
// XY
selectable = (xGreaterY) ? &_selectableX : &_selectableY;
}
}
else {
// Don't constrain to axis, choose the freemove translator
selectable = &_selectableScreen;
}
// If everything went ok, there is a selectable available, add it
if (selectable != NULL) {
selector.addSelectable(SelectionIntersection(0,0), selectable);
selectable->setSelected(true);
}
}
//.........这里部分代码省略.........