本文整理汇总了C++中Selectable类的典型用法代码示例。如果您正苦于以下问题:C++ Selectable类的具体用法?C++ Selectable怎么用?C++ Selectable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Selectable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
}
示例3: post
void post( const scene::Path& path, scene::Instance& instance ) const {
Selectable *selectable = Instance_getSelectable( instance );
if ( selectable && selectable->isSelected() ) {
Entity* entity = Node_getEntity( path.top() );
if ( entity == 0 && Node_isPrimitive( path.top() ) ) {
NodeSmartReference child( path.top().get() );
NodeSmartReference parent( path.parent().get() );
if ( path.size() >= 3 && parent != worldspawn ) {
NodeSmartReference parentparent( path[path.size() - 3].get() );
Node_getTraversable( parent )->erase( child );
Node_getTraversable( group )->insert( child );
if ( Node_getTraversable( parent )->empty() ) {
//deleteme.push(DeletionPair(parentparent, parent));
Node_getTraversable( parentparent )->erase( parent );
}
}
else
{
Node_getTraversable( parent )->erase( child );
Node_getTraversable( group )->insert( child );
}
}
}
}
示例4: rayIntersection
Selectable* SelectableWorld::rayIntersection(vec3 startPoint,
vec3 endPoint)
{
vec3 direction = endPoint - startPoint;
float distance = glm::length(direction);
Selectable* closest = NULL;
for (SelectableList::const_iterator it = world.begin();
it != world.end();
it++)
{
Selectable* sel = (*it);
vec3 pos = sel->getPosition();
float rayDistance = pointToRayDistance(sel->getPosition(), startPoint, direction);
if (rayDistance == -1)
continue;
if (rayDistance < (*it)->getRadius()) // hit!
{
float newDist = glm::length(startPoint - (*it)->getPosition());
if (newDist < distance)
{
closest = *it;
distance = newDist;
}
}
}
return closest;
}
示例5: onComponentSelection
// greebo: This should be called "onComponentSelectionChanged", as it is a similar function of the above one
// Updates the internal list of component nodes if the component selection gets changed
void RadiantSelectionSystem::onComponentSelection(const scene::INodePtr& node, const Selectable& selectable) {
int delta = selectable.isSelected() ? +1 : -1;
_countComponent += delta;
_sigSelectionChanged(selectable);
_selectionInfo.totalCount += delta;
_selectionInfo.componentCount += delta;
// If the instance got selected, add it to the list, otherwise remove it
if (selectable.isSelected()) {
_componentSelection.append(node);
}
else {
_componentSelection.erase(node);
}
// Notify observers, TRUE => this is a component selection change
notifyObservers(node, true);
// Check if the number of selected components in the list matches the value of the selection counter
ASSERT_MESSAGE(_componentSelection.size() == _countComponent, "component selection-tracking error");
// Schedule an idle callback
requestIdleCallback();
_requestWorkZoneRecalculation = true;
_requestSceneGraphChange = true;
}
示例6: while
bool MainLoopImpl::waitNext()
{
std::size_t timeout = _timerQueue.processTimers();
// check all selectables that did not require waiting
while( true )
{
Pt::System::MutexLock lock(_mutex);
if( _avail.empty() )
break;
timeout = 0;
Selectable* s = _avail.back();
_avail.pop_back();
lock.unlock();
s->run();
}
bool isActive = true;
if( _selector.waitForWake(timeout) )
isActive = _eventQueue.processEvents(*_event);
return isActive;
}
示例7: 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;
}
示例8: unselectAll
void SelectableGroup::unselectAll()
{
Selectable* selected = this->getSelection();
if(selected != NULL)
selected->setSelected(false);
this->notifySelectionChanged();
}
示例9: getUserPosition
Selection ViewpointCursor::getCursor(const SelectableList& selectables) {
Selectable* closestObject = NULL;
Selection closestIntersection;
if (updatePending) {
closestIntersection.distance = std::numeric_limits<float>::max();
glm::vec3 p = getUserPosition();
glm::vec3 d = getCursorDirection();
// First up, see if we intersect one of the objects.
for (SelectableList::const_iterator it = selectables.begin(); it < selectables.end(); ++it) {
Selectable* s = *it;
Selection i = s->intersect(p, d);
if (i.distance > 0 && i.distance < closestIntersection.distance)
{
closestObject = s;
closestIntersection = i;
}
}
updatePending = false;
// Return the closest object, if there was one.
if (closestObject != NULL) {
cursorPlaced = true;
cursor3D = closestIntersection.pos;
cursorNormal = closestIntersection.normal;
closestIntersection.rotationMatrix = getCursorRotation();
closestIntersection.object = closestObject;
}
// intersect with magic plane so at least the cursor appears...
else {
glm::vec3 userDirection = getViewDirection();
Plane plane(p + userDirection*planeDistance, userDirection);
Plane::Intersection ip = plane.intersect(p, d);
if (ip.intersects) {
cursorPlaced = true;
cursor3D = ip.intersectionPoint;
cursorNormal = userDirection*-1.0f;
cursorPlaced = true;
closestIntersection.pos = cursor3D;
closestIntersection.normal = cursorNormal;
closestIntersection.rotationMatrix = getCursorRotation();
closestIntersection.object = NULL;
}
}
}
return closestIntersection;
}
示例10:
Buffer<Selectable *> UnixSelectorImpl::getSelected()
{
AdvancedBuffer<Selectable *> result;
for (int i = 0, j = selectableList.size() ; i < j ; i++) {
Selectable *currentSelectable = selectableList[i];
UnixSelectableImpl *currentImpl = static_cast<UnixSelectableImpl *>(currentSelectable->getSelectableImpl());
if (FD_ISSET(currentImpl->getFd(), &readfds))
result.add(currentSelectable);
}
result.flush();
return result;
}
示例11: 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);
}
}
}
示例12: Instance_getSelectable
bool PlaneSelectableSelectPlanes::pre(const scene::Path& path, scene::Instance& instance) const {
if(path.top().get().visible())
{
Selectable* selectable = Instance_getSelectable(instance);
if(selectable != 0 && selectable->isSelected())
{
PlaneSelectable* planeSelectable = Instance_getPlaneSelectable(instance);
if(planeSelectable != 0)
{
planeSelectable->selectPlanes(_selector, _test, _selectedPlaneCallback);
}
}
}
return true;
}
示例13: onSelectedChanged
// This is called if the selection changes, so that the local list of selected instances can be updated
void RadiantSelectionSystem::onSelectedChanged(scene::Instance& instance, const Selectable& selectable) {
// Cache the selection state
bool isSelected = selectable.isSelected();
_countPrimitive += (isSelected) ? +1 : -1;
_selectionChangedCallbacks(selectable); // legacy
_selectionInfo.totalCount += (isSelected) ? +1 : -1;
if (Instance_getBrush(instance) != NULL) {
_selectionInfo.brushCount += (isSelected) ? +1 : -1;
}
else {
_selectionInfo.entityCount += (isSelected) ? +1 : -1;
}
// If the selectable is selected, add it to the local selection list, otherwise remove it
if (isSelected) {
_selection.append(instance);
}
else {
_selection.erase(instance);
}
// Notify observers, FALSE = primitive selection change
notifyObservers(instance, false);
// Check if the number of selected primitives in the list matches the value of the selection counter
ASSERT_MESSAGE(_selection.size() == _countPrimitive, "selection-tracking error");
// Schedule an idle callback
requestIdleCallback();
_requestWorkZoneRecalculation = true;
}
示例14: selectedChanged
void FaceInstance::selectedChanged (const Selectable& selectable)
{
if (selectable.isSelected()) {
g_SelectedFaceInstances.insert(*this);
} else {
g_SelectedFaceInstances.erase(*this);
}
m_selectionChanged(selectable);
}
示例15: changed
void SelectorImpl::changed( Selectable& s )
{
if( s.avail() )
{
_avail.insert(&s);
}
else
{
_avail.erase(&s);
}
}