The Selection class The selection singleton keeps track of the selection state of the whole application. More...
#include <Selection.h>
Classes | |
struct | SelObj |
Public Types | |
enum | VisibleState { VisHide = 0 , VisShow = 1 , VisToggle = -1 } |
Visible state used by setVisible() More... | |
Public Types inherited from Base::Subject< const SelectionChanges & > | |
typedef const SelectionChanges & | MessageType |
typedef Observer< const SelectionChanges & > | ObserverType |
typedef Subject< const SelectionChanges & > | SubjectType |
Public Member Functions | |
bool | addSelection (const char *pDocName, const char *pObjectName=nullptr, const char *pSubName=nullptr, float x=0, float y=0, float z=0, const std::vector< SelObj > *pickedList=nullptr, bool clearPreSelect=true) |
Add to selection. More... | |
bool | addSelection (const SelectionObject &, bool clearPreSelect=true) |
Add to selection. More... | |
bool | addSelection2 (const char *pDocName, const char *pObjectName=nullptr, const char *pSubName=nullptr, float x=0, float y=0, float z=0, const std::vector< SelObj > *pickedList=nullptr) |
void | addSelectionGate (Gui::SelectionGate *gate, ResolveMode resolve=ResolveMode::OldStyleElement) |
add a SelectionGate to control what is selectable More... | |
bool | addSelections (const char *pDocName, const char *pObjectName, const std::vector< std::string > &pSubNames) |
Add to selection with several sub-elements. More... | |
void | clearCompleteSelection (bool clearPreSelect=true) |
Clear the selection of all documents. More... | |
void | clearSelection (const char *pDocName=nullptr, bool clearPreSelect=true) |
Clear the selection of document pDocName. If the document name is not given the selection of the active document is cleared. More... | |
unsigned int | countObjectsOfType (const Base::Type &typeId=App::DocumentObject::getClassTypeId(), const char *pDocName=nullptr, ResolveMode resolve=ResolveMode::OldStyleElement) const |
Returns the number of selected objects with a special object type It's the convenient way to check if the right objects are selected to perform an operation (GuiCommand). More... | |
unsigned int | countObjectsOfType (const char *typeName, const char *pDocName=nullptr, ResolveMode resolve=ResolveMode::OldStyleElement) const |
Does basically the same as the method above unless that it accepts a string literal as first argument. More... | |
int | disableCommandLog () |
int | enableCommandLog (bool silent=false) |
int | getAsPropertyLinkSubList (App::PropertyLinkSubList &prop) const |
getAsPropertyLinkSubList fills PropertyLinkSubList with current selection. More... | |
std::vector< SelObj > | getCompleteSelection (ResolveMode resolve=ResolveMode::OldStyleElement) const |
Returns a vector of all selection objects of all documents. More... | |
std::vector< App::DocumentObject * > | getObjectsOfType (const Base::Type &typeId, const char *pDocName=nullptr, ResolveMode resolve=ResolveMode::OldStyleElement) const |
Returns a vector of objects of type TypeName selected for the given document name pDocName. More... | |
template<typename T > | |
std::vector< T * > | getObjectsOfType (const char *pDocName=nullptr, ResolveMode resolve=ResolveMode::OldStyleElement) const |
A convenience template-based method that returns an array with the correct types already. More... | |
std::vector< App::DocumentObject * > | getObjectsOfType (const char *typeName, const char *pDocName=nullptr, ResolveMode resolve=ResolveMode::OldStyleElement) const |
Does basically the same as the method above unless that it accepts a string literal as first argument. More... | |
const SelectionChanges & | getPreselection (void) const |
returns the present preselection More... | |
const char * | getSelectedElement (App::DocumentObject *, const char *pSubName) const |
std::vector< SelObj > | getSelection (const char *pDocName=nullptr, ResolveMode resolve=ResolveMode::OldStyleElement, bool single=false) const |
Returns a vector of selection objects. More... | |
std::vector< Gui::SelectionObject > | getSelectionEx (const char *pDocName=nullptr, Base::Type typeId=App::DocumentObject::getClassTypeId(), ResolveMode resolve=ResolveMode::OldStyleElement, bool single=false) const |
Returns a vector of selection objects. More... | |
bool | hasPreselection () const |
Check if there is any pre-selection. More... | |
bool | hasSelection () const |
Check if there is any selection. More... | |
bool | hasSelection (const char *doc, ResolveMode resolve=ResolveMode::OldStyleElement) const |
Check if there is any selection within a given document. More... | |
bool | hasSubSelection (const char *doc=nullptr, bool subElement=false) const |
Check if there is any sub-element selection. More... | |
bool | isSelected (App::DocumentObject *, const char *pSubName=nullptr, ResolveMode resolve=ResolveMode::OldStyleElement) const |
Check if selected. More... | |
bool | isSelected (const char *pDocName, const char *pObjectName=nullptr, const char *pSubName=nullptr, ResolveMode resolve=ResolveMode::OldStyleElement) const |
Check if selected. More... | |
void | rmvPreselect (bool signal=false) |
remove the present preselection More... | |
void | rmvSelection (const char *pDocName, const char *pObjectName=nullptr, const char *pSubName=nullptr, const std::vector< SelObj > *pickedList=nullptr) |
Remove from selection (for internal use) More... | |
void | rmvSelectionGate (void) |
remove the active SelectionGate More... | |
int | setPreselect (const char *pDocName, const char *pObjectName, const char *pSubName, float x=0, float y=0, float z=0, SelectionChanges::MsgSource signal=SelectionChanges::MsgSource::Any) |
set the preselected object (mostly by the 3D view) More... | |
void | setPreselectCoord (float x, float y, float z) |
sets different coords for the preselection More... | |
void | setSelection (const char *pDocName, const std::vector< App::DocumentObject * > &) |
Set the selection for a document. More... | |
void | setVisible (VisibleState visible) |
Set selection object visibility. More... | |
unsigned int | size (void) const |
Size of selected entities for all documents. More... | |
bool | updateSelection (bool show, const char *pDocName, const char *pObjectName=nullptr, const char *pSubName=nullptr) |
Update a selection. More... | |
Selection stack functions | |
Selection stack is for storing selection history so that the user can go back and forward to previous selections. | |
int | selStackBackSize () const |
Return the current selection stack size. More... | |
int | selStackForwardSize () const |
Return the current forward selection stack size. More... | |
std::vector< Gui::SelectionObject > | selStackGet (const char *pDocName=nullptr, ResolveMode resolve=ResolveMode::OldStyleElement, int index=0) const |
Obtain selected objects from stack. More... | |
void | selStackGoBack (int count=1) |
Go back selection history. More... | |
void | selStackGoForward (int count=1) |
Go forward selection history. More... | |
void | selStackPush (bool clearForward=true, bool overwrite=false) |
Save the current selection on to the stack. More... | |
Public Member Functions inherited from Base::Subject< const SelectionChanges & > | |
void | Attach (Observer< const SelectionChanges & > *ToObserv) |
Attach an Observer Attach an Observer to the list of Observers which get called when Notify is called. More... | |
void | ClearObserver () |
Clears the list of all registered observers. More... | |
void | Detach (Observer< const SelectionChanges & > *ToObserv) |
Detach an Observer Detach an Observer from the list of Observers which get called when Notify is called. More... | |
Observer< const SelectionChanges & > * | Get (const char *Name) |
Get an Observer by name Get a observer by name if the observer reimplements the Name() mthode. More... | |
void | Notify (const SelectionChanges & rcReason) |
Notify all Observers Send a message to all Observers attached to this subject. More... | |
Subject () | |
A constructor. More... | |
virtual | ~Subject () |
A destructor. More... | |
Public Attributes | |
boost::signals2::signal< void(const SelectionChanges &msg)> | signalSelectionChanged |
signal on new object More... | |
boost::signals2::signal< void(const SelectionChanges &msg)> | signalSelectionChanged2 |
signal on selection change with resolved object More... | |
boost::signals2::signal< void(const SelectionChanges &msg)> | signalSelectionChanged3 |
signal on selection change with resolved object and sub element map More... | |
Picked list functions | |
Picked list stores all selected geometry elements that intersects the 3D pick point. The list population is done by SoFCUnifiedSelection through addSelection() with the pickedList argument. | |
typedef std::set< App::SubObjectT > | SelStackItem |
class | SelectionFilter |
static PyMethodDef | Methods [] |
SelectionChanges | CurrentPreselection |
std::deque< SelectionChanges > | NotificationQueue |
bool | Notifying = false |
std::string | DocName |
std::string | FeatName |
std::string | SubName |
float | hx |
float | hy |
float | hz |
Gui::SelectionGate * | ActiveGate |
ResolveMode | gateResolve |
int | logDisabled = 0 |
bool | logHasSelection = false |
bool | needPickedList () const |
Check whether picked list is enabled. More... | |
void | enablePickedList (bool) |
Turn on or off picked list. More... | |
bool | hasPickedList () const |
Check if there is any selection inside picked list. More... | |
std::vector< SelectionSingleton::SelObj > | getPickedList (const char *pDocName) const |
Return select objects inside picked list. More... | |
std::vector< Gui::SelectionObject > | getPickedListEx (const char *pDocName=nullptr, Base::Type typeId=App::DocumentObject::getClassTypeId()) const |
Return selected object inside picked list grouped by top level parents. More... | |
static SelectionSingleton & | instance (void) |
static void | destruct (void) |
static PyObject * | sAddSelection (PyObject *self, PyObject *args) |
static PyObject * | sUpdateSelection (PyObject *self, PyObject *args) |
static PyObject * | sRemoveSelection (PyObject *self, PyObject *args) |
static PyObject * | sClearSelection (PyObject *self, PyObject *args) |
static PyObject * | sIsSelected (PyObject *self, PyObject *args) |
static PyObject * | sCountObjectsOfType (PyObject *self, PyObject *args) |
static PyObject * | sGetSelection (PyObject *self, PyObject *args) |
static PyObject * | sSetPreselection (PyObject *self, PyObject *args, PyObject *kwd) |
static PyObject * | sGetPreselection (PyObject *self, PyObject *args) |
static PyObject * | sRemPreselection (PyObject *self, PyObject *args) |
static PyObject * | sGetCompleteSelection (PyObject *self, PyObject *args) |
static PyObject * | sGetSelectionEx (PyObject *self, PyObject *args) |
static PyObject * | sGetSelectionObject (PyObject *self, PyObject *args) |
static PyObject * | sAddSelObserver (PyObject *self, PyObject *args) |
static PyObject * | sRemSelObserver (PyObject *self, PyObject *args) |
static PyObject * | sAddSelectionGate (PyObject *self, PyObject *args) |
static PyObject * | sRemoveSelectionGate (PyObject *self, PyObject *args) |
static PyObject * | sGetPickedList (PyObject *self, PyObject *args) |
static PyObject * | sEnablePickedList (PyObject *self, PyObject *args) |
static PyObject * | sPreselect (PyObject *self, PyObject *args) |
static PyObject * | sSetVisible (PyObject *self, PyObject *args) |
static PyObject * | sPushSelStack (PyObject *self, PyObject *args) |
static PyObject * | sHasSelection (PyObject *self, PyObject *args) |
static PyObject * | sHasSubSelection (PyObject *self, PyObject *args) |
static PyObject * | sGetSelectionFromStack (PyObject *self, PyObject *args) |
static App::DocumentObject * | getObjectOfType (_SelObj &sel, Base::Type type, ResolveMode resolve, const char **subelement=nullptr) |
SelectionSingleton () | |
Construction. More... | |
virtual | ~SelectionSingleton () |
Destruction. More... | |
void | slotDeletedObject (const App::DocumentObject &) |
Observer message from the App doc. More... | |
App::Document * | getDocument (const char *pDocName=nullptr) const |
helper to retrieve document by name More... | |
void | slotSelectionChanged (const SelectionChanges &msg) |
void | notify (SelectionChanges &&Chng) |
void | notify (const SelectionChanges &Chng) |
int | checkSelection (const char *pDocName, const char *pObjectName, const char *pSubName, ResolveMode resolve, _SelObj &sel, const std::list< _SelObj > *selList=nullptr) const |
std::vector< Gui::SelectionObject > | getObjectList (const char *pDocName, Base::Type typeId, std::list< _SelObj > &objs, ResolveMode resolve, bool single=false) const |
The Selection class The selection singleton keeps track of the selection state of the whole application.
It gets messages from all entities which can alter the selection (e.g. tree view and 3D-view) and sends messages to entities which need to keep track on the selection state.
The selection consists mainly out of following information per selected object:
Also the preselection is managed. That means you can add a filter to prevent selection of unwanted objects or subelements.
|
protected |
Visible state used by setVisible()
Enumerator | |
---|---|
VisHide | Hide the selection. |
VisShow | Show the selection. |
VisToggle | Toggle visibility of the selection. |
|
protected |
Construction.
A constructor.
A more elaborate description of the constructor.
References ActiveGate, draftgeoutils.faces::bind(), gateResolve, App::GetApplication(), hx, hy, hz, Gui::OldStyleElement, App::Application::signalDeletedObject, signalSelectionChanged, slotDeletedObject(), and slotSelectionChanged().
Referenced by instance().
|
protectedvirtual |
Destruction.
A destructor.
A more elaborate description of the destructor.
bool SelectionSingleton::addSelection | ( | const char * | pDocName, |
const char * | pObjectName = nullptr , |
||
const char * | pSubName = nullptr , |
||
float | x = 0 , |
||
float | y = 0 , |
||
float | z = 0 , |
||
const std::vector< SelObj > * | pickedList = nullptr , |
||
bool | clearPreSelect = true |
||
) |
Add to selection.
References Gui::Application::activeDocument(), ActiveGate, Gui::SelectionChanges::AddSelection, Gui::SelectionGate::allow(), checkSelection(), gateResolve, Gui::Document::getActiveView(), Base::Persistence::getClassTypeId(), Gui::getMainWindow(), getObjectOfType(), Gui::Application::Instance, isSelected(), logDisabled, draftfunctions.move::move(), Gui::NoResolve, Gui::SelectionGate::notAllowedReason, notify(), Gui::SelectionChanges::pDocName, Gui::SelectionChanges::PickedListChanged, Gui::SelectionChanges::pObjectName, Gui::SelectionChanges::pSubName, rmvPreselect(), Gui::MDIView::setOverrideCursor(), Gui::MainWindow::showMessage(), draftguitools.gui_setstyle::translate, and Gui::MainWindow::updateActions().
Referenced by StdCmdLinkMakeGroup::activated(), StdCmdLinkMake::activated(), StdCmdLinkMakeRelative::activated(), StdCmdLinkSelectLinked::activated(), PartGui::FaceColors::Private::addFacesToSelection(), addSelection(), Gui::DAG::Model::contextMenuEvent(), Gui::Dialog::DlgPropertyLink::detachObserver(), Gui::TreeWidget::dropEvent(), Gui::SoFCSelection::handleEvent(), Gui::TreeWidget::itemSearch(), Gui::DAG::Model::mousePressEvent(), PartDesignGui::TaskFeaturePick::onDoubleClick(), PartDesignGui::TaskFeaturePick::onItemSelectionChanged(), Gui::TreeWidget::onSelectDependents(), Gui::ElementColors::Private::onSelectionChanged(), DrawSketchHandlerGenConstraint::releaseButton(), DrawSketchHandlerCoincident::releaseButton(), SketcherGui::DrawSketchHandlerFillet::releaseButton(), sAddSelection(), Gui::PropertyEditor::LinkSelection::select(), PartGui::TaskMeasureLinear::selection1Slot(), PartGui::TaskMeasureAngular::selection1Slot(), PartGui::TaskMeasureLinear::selection2Slot(), PartGui::TaskMeasureAngular::selection2Slot(), selStackGoBack(), selStackGoForward(), TechDrawGui::ViewProviderViewPart::setEdit(), PartDesignGui::ViewProviderSubShapeBinder::setEdit(), PartDesignGui::TaskDressUpParameters::setSelection(), FemGui::TaskFemConstraint::setSelection(), TechDrawGui::MDIViewPage::setTreeToSceneSelect(), PartDesignGui::ViewProvider::unsetEdit(), and SketcherGui::ViewProviderSketch::unsetEdit().
bool SelectionSingleton::addSelection | ( | const SelectionObject & | obj, |
bool | clearPreSelect = true |
||
) |
Add to selection.
References addSelection(), Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.
bool Gui::SelectionSingleton::addSelection2 | ( | const char * | pDocName, |
const char * | pObjectName = nullptr , |
||
const char * | pSubName = nullptr , |
||
float | x = 0 , |
||
float | y = 0 , |
||
float | z = 0 , |
||
const std::vector< SelObj > * | pickedList = nullptr |
||
) |
void SelectionSingleton::addSelectionGate | ( | Gui::SelectionGate * | gate, |
ResolveMode | resolve = ResolveMode::OldStyleElement |
||
) |
add a SelectionGate to control what is selectable
References ActiveGate, gateResolve, and rmvSelectionGate().
Referenced by PartDesignGui::TaskTransformedParameters::addReferenceSelectionGate(), Gui::SelectionObserver::attachSelection(), PartGui::DlgFilletEdges::DlgFilletEdges(), Gui::ElementColors::ElementColors(), PartGui::FaceColors::FaceColors(), PartDesignGui::TaskDressUpParameters::onButtonRefAdd(), PartDesignGui::TaskDressUpParameters::onButtonRefRemove(), PartDesignGui::TaskSketchBasedParameters::onSelectReference(), sAddSelectionGate(), PartGui::ShapeBuilderWidget::ShapeBuilderWidget(), and PartDesignGui::TaskDatumParameters::TaskDatumParameters().
bool SelectionSingleton::addSelections | ( | const char * | pDocName, |
const char * | pObjectName, | ||
const std::vector< std::string > & | pSubNames | ||
) |
Add to selection with several sub-elements.
References Gui::SelectionChanges::AddSelection, checkSelection(), Gui::getMainWindow(), draftfunctions.move::move(), Gui::NoResolve, notify(), Gui::SelectionChanges::pDocName, Gui::SelectionChanges::PickedListChanged, Gui::SelectionChanges::pObjectName, Gui::SelectionChanges::pSubName, and Gui::MainWindow::updateActions().
Referenced by SketcherGui::ConstraintView::contextMenuEvent(), SketcherGui::TaskSketcherConstraints::on_listWidgetConstraints_itemSelectionChanged(), SketcherGui::TaskSketcherElements::on_listWidgetElements_itemSelectionChanged(), PartDesignGui::ViewProviderSubShapeBinder::setEdit(), and PartGui::DlgFilletEdges::setupFillet().
|
protected |
References Gui::TreeWidget::checkTopParent(), getDocument(), Gui::NoResolve, App::GeoFeature::Normal, Gui::OldStyleElement, and App::GeoFeature::resolveElement().
Referenced by draftguitools.gui_selectplane.Draft_SelectPlane::action(), addSelection(), addSelections(), isSelected(), rmvSelection(), selStackGet(), and setSelection().
void SelectionSingleton::clearCompleteSelection | ( | bool | clearPreSelect = true | ) |
Clear the selection of all documents.
References Gui::MacroManager::addLine(), Gui::SelectionChanges::ClrSelection, Gui::MacroManager::Cmt, Gui::getMainWindow(), Gui::Application::Instance, logDisabled, Gui::Application::macroManager(), draftfunctions.move::move(), notify(), Gui::SelectionChanges::PickedListChanged, rmvPreselect(), and Gui::MainWindow::updateActions().
Referenced by StdCmdLinkMakeGroup::activated(), StdCmdLinkMake::activated(), StdCmdLinkMakeRelative::activated(), StdCmdLinkSelectLinked::activated(), StdCmdLinkSelectLinkedFinal::activated(), StdCmdLinkSelectAllLinks::activated(), StdCmdTreeSelectAllInstances::activated(), clearSelection(), Gui::TreeWidget::dropEvent(), selStackGoBack(), selStackGoForward(), and Gui::Application::slotDeleteDocument().
void SelectionSingleton::clearSelection | ( | const char * | pDocName = nullptr , |
bool | clearPreSelect = true |
||
) |
Clear the selection of document pDocName. If the document name is not given the selection of the active document is cleared.
References Gui::MacroManager::addLine(), clearCompleteSelection(), Gui::SelectionChanges::ClrSelection, Gui::MacroManager::Cmt, DocName, getDocument(), Gui::getMainWindow(), Gui::Application::Instance, logDisabled, Gui::Application::macroManager(), notify(), Gui::SelectionChanges::PickedListChanged, rmvPreselect(), and Gui::MainWindow::updateActions().
Referenced by MeshGui::TaskDecimating::accept(), SketcherCopy::activate(), StdCmdAlignment::activated(), CmdSketcherConstrainHorizontal::activated(), CmdSketcherConstrainVertical::activated(), CmdSketcherConstrainLock::activated(), CmdSketcherConstrainBlock::activated(), CmdSketcherConstrainCoincident::activated(), CmdSketcherConstrainDistance::activated(), CmdSketcherConstrainPointOnObject::activated(), CmdSketcherConstrainDistanceX::activated(), CmdSketcherConstrainDistanceY::activated(), CmdSketcherConstrainParallel::activated(), CmdSketcherConstrainPerpendicular::activated(), CmdSketcherConstrainTangent::activated(), CmdSketcherConstrainRadius::activated(), CmdSketcherConstrainDiameter::activated(), CmdSketcherConstrainRadiam::activated(), CmdSketcherConstrainAngle::activated(), CmdSketcherConstrainEqual::activated(), CmdSketcherConstrainSymmetric::activated(), CmdSketcherConstraint::activated(), Gui::ElementColors::Private::apply(), CmdSketcherConstrainPerpendicular::applyConstraint(), CmdSketcherConstrainTangent::applyConstraint(), CmdSketcherConstrainRadius::applyConstraint(), CmdSketcherConstrainDiameter::applyConstraint(), CmdSketcherConstrainRadiam::applyConstraint(), CmdSketcherConstrainSymmetric::applyConstraint(), PartGui::ViewProviderPartExt::changeFaceColors(), SketcherGui::ConstraintView::contextMenuEvent(), Gui::DAG::Model::contextMenuEvent(), Gui::Dialog::DlgPropertyLink::detachObserver(), PartDesignGui::TaskDressUpParameters::doubleClicked(), TechDrawGui::execHoleCircle(), PartDesignGui::TaskDressUpParameters::exitSelectionMode(), PartGui::goDimensionAngularRoot(), PartGui::goDimensionLinearRoot(), Gui::SoFCSelection::handleEvent(), Gui::TreeWidget::itemSearch(), SketcherGui::ViewProviderSketch::mouseButtonPressed(), Gui::DAG::Model::mousePressEvent(), SketcherGui::TaskSketcherConstraints::on_listWidgetConstraints_itemSelectionChanged(), SketcherGui::TaskSketcherElements::on_listWidgetElements_itemSelectionChanged(), PartDesignGui::TaskTransformedParameters::onButtonAddFeature(), PartDesignGui::TaskDressUpParameters::onButtonRefAdd(), FemGui::TaskFemConstraint::onButtonReference(), PartDesignGui::TaskDressUpParameters::onButtonRefRemove(), PartDesignGui::TaskTransformedParameters::onButtonRemoveFeature(), FemGui::TaskFemConstraintOnBoundary::onButtonToggled(), PartDesignGui::TaskDlgPipeParameters::onButtonToggled(), SketcherGui::ViewProviderSketch::onDelete(), PartDesignGui::TaskFeaturePick::onItemSelectionChanged(), FemGui::TaskFemConstraintBearing::onSelectionChanged(), FemGui::TaskFemConstraintGear::onSelectionChanged(), PartDesignGui::TaskChamferParameters::onSelectionChanged(), PartDesignGui::TaskDraftParameters::onSelectionChanged(), PartDesignGui::TaskFilletParameters::onSelectionChanged(), PartDesignGui::TaskThicknessParameters::onSelectionChanged(), SketcherGui::DrawSketchHandlerCarbonCopy::onSelectionChanged(), SketcherGui::DrawSketchHandlerExternal::onSelectionChanged(), PartDesignGui::TaskSketchBasedParameters::onSelectReference(), SurfaceGui::FillingPanel::open(), SurfaceGui::FillingEdgePanel::open(), SurfaceGui::FillingVertexPanel::open(), SurfaceGui::GeomFillSurface::open(), SurfaceGui::SectionsPanel::open(), MeshGui::ParametersDialog::ParametersDialog(), TechDrawGui::MDIViewPage::print(), Gui::NavigationStyle::processEvent(), SketcherGui::ViewProviderSketch::purgeHandler(), DrawSketchHandlerGenConstraint::releaseButton(), DrawSketchHandlerCoincident::releaseButton(), SketcherGui::DrawSketchHandlerFillet::releaseButton(), MeshGui::RemoveComponents::RemoveComponents(), Gui::ElementColors::Private::reset(), PartGui::TaskMeasureLinear::resetDialogSlot(), PartGui::TaskMeasureAngular::resetDialogSlot(), DrawSketchHandlerGenConstraint::resetOngoingSequences(), TechDrawGui::QGSPage::saveSvg(), sClearSelection(), ReverseEngineeringGui::SegmentationManual::SegmentationManual(), Gui::PropertyEditor::LinkSelection::select(), Gui::TreeWidget::selectAll(), PartGui::TaskMeasureLinear::selection1Slot(), PartGui::TaskMeasureAngular::selection1Slot(), PartGui::TaskMeasureLinear::selection2Slot(), PartGui::TaskMeasureAngular::selection2Slot(), PartGui::TaskMeasureLinear::selectionClearDelayedSlot(), PartGui::TaskMeasureAngular::selectionClearDelayedSlot(), FemGui::ViewProviderFemConstraintBearing::setEdit(), FemGui::ViewProviderFemConstraintContact::setEdit(), FemGui::ViewProviderFemConstraintDisplacement::setEdit(), FemGui::ViewProviderFemConstraintFixed::setEdit(), FemGui::ViewProviderFemConstraintFluidBoundary::setEdit(), FemGui::ViewProviderFemConstraintForce::setEdit(), FemGui::ViewProviderFemConstraintGear::setEdit(), FemGui::ViewProviderFemConstraintHeatflux::setEdit(), FemGui::ViewProviderFemConstraintInitialTemperature::setEdit(), FemGui::ViewProviderFemConstraintPlaneRotation::setEdit(), FemGui::ViewProviderFemConstraintPressure::setEdit(), FemGui::ViewProviderFemConstraintPulley::setEdit(), FemGui::ViewProviderFemConstraintSpring::setEdit(), FemGui::ViewProviderFemConstraintTemperature::setEdit(), FemGui::ViewProviderFemConstraintTransform::setEdit(), FemGui::ViewProviderFemMeshShapeNetgen::setEdit(), PartGui::ViewProviderOffset::setEdit(), PartGui::ViewProviderThickness::setEdit(), PartDesignGui::ViewProviderHole::setEdit(), PartDesignGui::ViewProviderPrimitive::setEdit(), TechDrawGui::ViewProviderBalloon::setEdit(), TechDrawGui::ViewProviderDimension::setEdit(), TechDrawGui::ViewProviderLeader::setEdit(), TechDrawGui::ViewProviderProjGroup::setEdit(), TechDrawGui::ViewProviderRichAnno::setEdit(), TechDrawGui::ViewProviderViewPart::setEdit(), TechDrawGui::ViewProviderViewSection::setEdit(), TechDrawGui::ViewProviderWeld::setEdit(), Gui::ViewProviderLink::setEdit(), PartDesignGui::ViewProvider::setEdit(), PartDesignGui::ViewProviderBoolean::setEdit(), PartDesignGui::ViewProviderDatum::setEdit(), PartDesignGui::ViewProviderShapeBinder::setEdit(), PartDesignGui::ViewProviderSubShapeBinder::setEdit(), SketcherGui::ViewProviderSketch::setEdit(), TechDrawGui::ViewProviderGeomHatch::setEdit(), TechDrawGui::ViewProviderHatch::setEdit(), PartDesignGui::TaskDressUpParameters::setSelection(), FemGui::TaskFemConstraint::setSelection(), TechDrawGui::MDIViewPage::setTreeToSceneSelect(), PartGui::DlgFilletEdges::setupFillet(), CmdSketcherConstrainTangent::substituteConstraintCombinations(), CmdSketcherConstrainPointOnObject::substituteConstraintCombinations(), CmdSketcherConstrainCoincident::substituteConstraintCombinations(), MeshGui::TaskSmoothing::TaskSmoothing(), FemGui::ViewProviderFemConstraint::unsetEdit(), PartDesignGui::ViewProvider::unsetEdit(), SketcherGui::ViewProviderSketch::unsetEdit(), PartDesignGui::TaskChamferParameters::~TaskChamferParameters(), PartGui::TaskCheckGeometryResults::~TaskCheckGeometryResults(), PartDesignGui::TaskDraftParameters::~TaskDraftParameters(), PartDesignGui::TaskFilletParameters::~TaskFilletParameters(), PartGui::TaskMeasureAngular::~TaskMeasureAngular(), PartGui::TaskMeasureLinear::~TaskMeasureLinear(), and PartDesignGui::TaskThicknessParameters::~TaskThicknessParameters().
unsigned int SelectionSingleton::countObjectsOfType | ( | const Base::Type & | typeId = App::DocumentObject::getClassTypeId() , |
const char * | pDocName = nullptr , |
||
ResolveMode | resolve = ResolveMode::OldStyleElement |
||
) | const |
Returns the number of selected objects with a special object type It's the convenient way to check if the right objects are selected to perform an operation (GuiCommand).
The check also detects base types. E.g. "Part" also fits on "PartImport" or "PartTransform types. If no document name is given the active document is assumed.
Set 'resolve' to true to resolve any sub object inside selection SubName field
References getDocument(), and getObjectOfType().
Referenced by StdCmdMeasurementSimple::activated(), countObjectsOfType(), StdCmdPlacement::isActive(), StdCmdTransformManip::isActive(), StdCmdAlignment::isActive(), SketcherGui::isCommandActive(), sCountObjectsOfType(), and PartDesignGui::Workbench::setupContextMenu().
unsigned int SelectionSingleton::countObjectsOfType | ( | const char * | typeName, |
const char * | pDocName = nullptr , |
||
ResolveMode | resolve = ResolveMode::OldStyleElement |
||
) | const |
Does basically the same as the method above unless that it accepts a string literal as first argument.
typeName must be a registered type, otherwise 0 is returned.
References Base::Type::badType(), countObjectsOfType(), and Base::Type::fromName().
|
static |
Referenced by Gui::Application::~Application().
int SelectionSingleton::disableCommandLog | ( | ) |
References hasSelection(), logDisabled, and logHasSelection.
Referenced by Gui::SelectionLogDisabler::SelectionLogDisabler().
void SelectionSingleton::enablePickedList | ( | bool | enable | ) |
Turn on or off picked list.
References notify(), and Gui::SelectionChanges::PickedListChanged.
Referenced by sEnablePickedList().
int SelectionSingleton::getAsPropertyLinkSubList | ( | App::PropertyLinkSubList & | prop | ) | const |
getAsPropertyLinkSubList fills PropertyLinkSubList with current selection.
prop | (output). The property object to receive links |
References Gui::SelectionObject::getObject(), getSelectionEx(), Gui::SelectionObject::getSubNames(), and App::PropertyLinkSubList::setValues().
Referenced by SketcherGui::SuggestAutoMapMode().
std::vector< SelectionSingleton::SelObj > SelectionSingleton::getCompleteSelection | ( | ResolveMode | resolve = ResolveMode::OldStyleElement | ) | const |
Returns a vector of all selection objects of all documents.
References getSelection().
Referenced by StdCmdEdit::activated(), Gui::TreeWidget::contextMenuEvent(), StdCmdDelete::isActive(), Gui::Document::setEdit(), and sGetCompleteSelection().
|
protected |
helper to retrieve document by name
References App::Application::getActiveDocument(), App::GetApplication(), and App::Application::getDocument().
Referenced by checkSelection(), clearSelection(), countObjectsOfType(), getObjectList(), getObjectsOfType(), getPickedList(), getSelection(), hasSelection(), hasSubSelection(), setPreselect(), setSelection(), and updateSelection().
|
protected |
References Base::Type::badType(), getDocument(), getObjectOfType(), and Gui::NoResolve.
Referenced by getPickedListEx(), getSelectionEx(), and selStackGet().
|
staticprotected |
References Gui::FollowLink, Gui::NewStyleElement, and Gui::NoResolve.
Referenced by addSelection(), countObjectsOfType(), getObjectList(), getObjectsOfType(), getSelection(), and hasSelection().
vector< App::DocumentObject * > SelectionSingleton::getObjectsOfType | ( | const Base::Type & | typeId, |
const char * | pDocName = nullptr , |
||
ResolveMode | resolve = ResolveMode::OldStyleElement |
||
) | const |
Returns a vector of objects of type TypeName selected for the given document name pDocName.
If no document name is specified the objects from the active document are regarded. If no objects of this document are selected an empty vector is returned.
References getDocument(), and getObjectOfType().
Referenced by DrawingGui::TaskProjection::accept(), MeshGui::TaskDecimating::accept(), ReenGui::FitBSplineSurfaceWidget::accept(), TechDrawGui::TaskProjection::accept(), StdCmdExport::activated(), StdCmdPlacement::activated(), StdCmdTransformManip::activated(), StdCmdAlignment::activated(), StdCmdToggleSelectability::activated(), Gui::Application::exportTo(), getObjectsOfType(), PartGui::getShapesFromSelection(), PartGui::hasShapesInSelection(), Gui::MainWindow::insertFromMimeData(), MeshInfoWatcher::onSelectionChanged(), MeshGui::TaskDecimating::TaskDecimating(), and DrawingGui::TaskOrthoViews::TaskOrthoViews().
std::vector< T * > Gui::SelectionSingleton::getObjectsOfType | ( | const char * | pDocName = nullptr , |
ResolveMode | resolve = ResolveMode::OldStyleElement |
||
) | const |
A convenience template-based method that returns an array with the correct types already.
References draftutils.utils::getObjectsOfType.
std::vector< App::DocumentObject * > SelectionSingleton::getObjectsOfType | ( | const char * | typeName, |
const char * | pDocName = nullptr , |
||
ResolveMode | resolve = ResolveMode::OldStyleElement |
||
) | const |
Does basically the same as the method above unless that it accepts a string literal as first argument.
typeName must be a registered type otherwise an empty array is returned.
References Base::Type::badType(), Base::Type::fromName(), and getObjectsOfType().
std::vector< SelectionSingleton::SelObj > SelectionSingleton::getPickedList | ( | const char * | pDocName | ) | const |
Return select objects inside picked list.
References Gui::SelectionSingleton::SelObj::DocName, Gui::SelectionSingleton::SelObj::FeatName, getDocument(), Gui::SelectionSingleton::SelObj::pDoc, Gui::SelectionSingleton::SelObj::pObject, Gui::SelectionSingleton::SelObj::pResolvedObject, Gui::SelectionSingleton::SelObj::SubName, Gui::SelectionSingleton::SelObj::TypeName, Gui::SelectionSingleton::SelObj::x, Gui::SelectionSingleton::SelObj::y, and Gui::SelectionSingleton::SelObj::z.
std::vector< SelectionObject > SelectionSingleton::getPickedListEx | ( | const char * | pDocName = nullptr , |
Base::Type | typeId = App::DocumentObject::getClassTypeId() |
||
) | const |
Return selected object inside picked list grouped by top level parents.
References getObjectList(), and Gui::NoResolve.
Referenced by sGetPickedList().
const SelectionChanges & SelectionSingleton::getPreselection | ( | void | ) | const |
const char * SelectionSingleton::getSelectedElement | ( | App::DocumentObject * | obj, |
const char * | pSubName | ||
) | const |
std::vector< SelectionSingleton::SelObj > SelectionSingleton::getSelection | ( | const char * | pDocName = nullptr , |
ResolveMode | resolve = ResolveMode::OldStyleElement , |
||
bool | single = false |
||
) | const |
Returns a vector of selection objects.
pDocName | document name. If no document name is given the objects of the active are returned. If nothing for this Document is selected an empty vector is returned. If document name is "*", then all document is considered. |
resolve | sub-object resolving mode 0 no resolve, 1 resolve sub-object with old style element name 2 resolve sub-object with new style element name |
single | if set to true, then it will return an empty vector if there is more than one selections. |
References Gui::SelectionSingleton::SelObj::DocName, Gui::SelectionSingleton::SelObj::FeatName, Base::Persistence::getClassTypeId(), getDocument(), getObjectOfType(), Gui::NoResolve, Gui::SelectionSingleton::SelObj::pDoc, Gui::SelectionSingleton::SelObj::pObject, Gui::SelectionSingleton::SelObj::pResolvedObject, Gui::SelectionSingleton::SelObj::SubName, Gui::SelectionSingleton::SelObj::TypeName, Gui::SelectionSingleton::SelObj::x, Gui::SelectionSingleton::SelObj::y, and Gui::SelectionSingleton::SelObj::z.
Referenced by StdCmdLinkSelectAllLinks::activated(), StdCmdMeasurementSimple::activated(), Gui::PropertyEditor::PropertyEditor::contextMenuEvent(), PartGui::evaluateAngularPreSelection(), PartGui::evaluateLinearPreSelection(), getCompleteSelection(), PartGui::TaskCheckGeometryResults::goCheck(), StdCmdLinkSelectAllLinks::isActive(), TechDrawGui::MDIViewPage::onSelectionChanged(), Gui::DAG::Model::selectionChanged(), Gui::DocumentItem::selectItems(), Gui::View3DInventorViewer::setDocument(), femguiutils.selection_widgets._Selector::setHelpText(), PartDesignGui::Workbench::setupContextMenu(), and sGetSelection().
std::vector< SelectionObject > SelectionSingleton::getSelectionEx | ( | const char * | pDocName = nullptr , |
Base::Type | typeId = App::DocumentObject::getClassTypeId() , |
||
ResolveMode | resolve = ResolveMode::OldStyleElement , |
||
bool | single = false |
||
) | const |
Returns a vector of selection objects.
pDocName | document name. If no document name is given the objects of the active are returned. If nothing for this Document is selected an empty vector is returned. If document name is "*", then all document is considered. |
typeId | specify the type of object to be returned. |
resolve | sub-object resolving mode. 0 no resolve, 1 resolve sub-object with old style element name 2 resolve sub-object with new style element name |
single | if set to true, then it will return an empty vector if there is more than one selections. |
References getObjectList().
Referenced by PartGui::SweepWidget::accept(), SketcherCopy::activate(), StdCmdDelete::activated(), StdCmdTreeSelectAllInstances::activated(), CmdSketcherConstrainHorizontal::activated(), CmdSketcherConstrainVertical::activated(), CmdSketcherConstrainLock::activated(), CmdSketcherConstrainBlock::activated(), CmdSketcherConstrainCoincident::activated(), CmdSketcherConstrainDistance::activated(), CmdSketcherConstrainPointOnObject::activated(), CmdSketcherConstrainDistanceX::activated(), CmdSketcherConstrainDistanceY::activated(), CmdSketcherConstrainParallel::activated(), CmdSketcherConstrainPerpendicular::activated(), CmdSketcherConstrainTangent::activated(), CmdSketcherConstrainRadius::activated(), CmdSketcherConstrainDiameter::activated(), CmdSketcherConstrainRadiam::activated(), CmdSketcherConstrainAngle::activated(), CmdSketcherConstrainEqual::activated(), CmdSketcherConstrainSymmetric::activated(), SketcherGui::ConstraintView::deleteSelectedItems(), SketcherGui::ElementView::deleteSelectedItems(), getAsPropertyLinkSubList(), TechDrawGui::TaskAlignViews::getSelectedEdges(), StdCmdTreeSelectAllInstances::isActive(), Gui::SelectionFilter::match(), SketcherGui::ViewProviderSketch::mouseButtonPressed(), Gui::PropertyView::onTimer(), Gui::Dialog::Placement::Placement(), TechDrawGui::MDIViewPage::sceneSelectionChanged(), SketcherGui::SketchSelection::setUp(), and sGetSelectionEx().
bool SelectionSingleton::hasPickedList | ( | ) | const |
Check if there is any selection inside picked list.
bool SelectionSingleton::hasPreselection | ( | ) | const |
Check if there is any pre-selection.
References CurrentPreselection, App::DocumentObjectT::getObjectName(), and Gui::SelectionChanges::Object.
bool SelectionSingleton::hasSelection | ( | ) | const |
Check if there is any selection.
Referenced by disableCommandLog(), enableCommandLog(), StdCmdCopy::isActive(), StdCmdDuplicateSelection::isActive(), Gui::TreeWidget::scrollItemToTop(), and sHasSelection().
bool SelectionSingleton::hasSelection | ( | const char * | doc, |
ResolveMode | resolve = ResolveMode::OldStyleElement |
||
) | const |
Check if there is any selection within a given document.
doc | specify the document to check for selection. If NULL, then check the current active document. |
resolve | whether to resolve the selected sub-object |
If resolve
is true, then the selection is first resolved before matching its owner document. So in case the selected sub-object is linked from an external document, it may not match the input doc
. If resolve
is false, then the match is only done with the top level parent object.
References Base::Persistence::getClassTypeId(), getDocument(), and getObjectOfType().
bool SelectionSingleton::hasSubSelection | ( | const char * | doc = nullptr , |
bool | subElement = false |
||
) | const |
Check if there is any sub-element selection.
doc | optional document to check for selection |
subElement | whether to count sub-element only selection |
Example sub selections are face, edge or vertex. If subElement
is false, then sub-object (i.e. a group child object) selection is also counted even if it selects the whole sub-object.
References getDocument().
Referenced by StdCmdLinkMakeRelative::isActive(), and sHasSubSelection().
|
static |
References SelectionSingleton().
bool SelectionSingleton::isSelected | ( | App::DocumentObject * | pObject, |
const char * | pSubName = nullptr , |
||
ResolveMode | resolve = ResolveMode::OldStyleElement |
||
) | const |
Check if selected.
References checkSelection(), App::DocumentObject::getDocument(), App::Document::getName(), and App::DocumentObject::getNameInDocument().
bool SelectionSingleton::isSelected | ( | const char * | pDocName, |
const char * | pObjectName = nullptr , |
||
const char * | pSubName = nullptr , |
||
ResolveMode | resolve = ResolveMode::OldStyleElement |
||
) | const |
Check if selected.
References checkSelection().
Referenced by addSelection(), Gui::SoFCSelection::doAction(), Gui::SoFCUnifiedSelection::doAction(), notify(), sIsSelected(), and updateSelection().
bool SelectionSingleton::needPickedList | ( | ) | const |
Check whether picked list is enabled.
Referenced by Gui::View3DInventorViewer::checkGroupOnTop().
|
protected |
|
protected |
References Gui::SelectionChanges::AddSelection, Gui::SelectionChanges::ClrSelection, Base::Console(), CurrentPreselection, isSelected(), draftfunctions.move::move(), Gui::NoResolve, NotificationQueue, Base::Subject< const SelectionChanges & >::Notify(), notify(), Notifying, Gui::SelectionChanges::Object, Gui::SelectionChanges::RmvPreselect, Gui::SelectionChanges::RmvSelection, Gui::SelectionChanges::SetPreselect, signalSelectionChanged, Gui::SelectionChanges::Type, and Base::ConsoleSingleton::Warning().
Referenced by addSelection(), addSelections(), clearCompleteSelection(), clearSelection(), enablePickedList(), notify(), rmvPreselect(), rmvSelection(), setPreselect(), setSelection(), slotDeletedObject(), and updateSelection().
void SelectionSingleton::rmvPreselect | ( | bool | signal = false | ) |
remove the present preselection
References Gui::Application::activeDocument(), ActiveGate, CurrentPreselection, DocName, FeatName, Gui::Document::getActiveView(), Gui::getMainWindow(), hx, hy, hz, Gui::Application::Instance, draftfunctions.move::move(), notify(), Gui::MDIView::restoreOverrideCursor(), Gui::SelectionChanges::RmvPreselect, Gui::SelectionChanges::RmvPreselectSignal, and SubName.
Referenced by addSelection(), clearCompleteSelection(), clearSelection(), Gui::SoFCSelection::handleEvent(), Gui::Dialog::DlgPropertyLink::leaveEvent(), Gui::ElementColors::leaveEvent(), Gui::DockWnd::SelectionView::leaveEvent(), Gui::TreeWidget::leaveEvent(), SketcherGui::TaskSketcherElements::leaveEvent(), SketcherGui::TaskSketcherElements::on_listWidgetElements_currentFilterChanged(), SketcherGui::TaskSketcherElements::on_listWidgetElements_filterShortcutPressed(), SketcherGui::TaskSketcherElements::on_listWidgetElements_itemEntered(), SketcherGui::DrawSketchHandler::quit(), SketcherGui::ViewProviderSketch::setEdit(), setPreselect(), slotDeletedObject(), sRemPreselection(), and updateSelection().
void SelectionSingleton::rmvSelection | ( | const char * | pDocName, |
const char * | pObjectName = nullptr , |
||
const char * | pSubName = nullptr , |
||
const std::vector< SelObj > * | pickedList = nullptr |
||
) |
Remove from selection (for internal use)
References checkSelection(), Gui::getMainWindow(), draftfunctions.move::move(), Gui::NoResolve, notify(), Gui::SelectionChanges::PickedListChanged, Gui::SelectionChanges::RmvSelection, and Gui::MainWindow::updateActions().
Referenced by Gui::SoFCSelection::handleEvent(), Gui::DAG::Model::mousePressEvent(), Gui::ElementColors::Private::onSelectionChanged(), sRemoveSelection(), and Gui::DocumentItem::updateItemSelection().
void SelectionSingleton::rmvSelectionGate | ( | void | ) |
remove the active SelectionGate
References Gui::Application::activeDocument(), ActiveGate, Gui::Application::Instance, and Gui::MDIView::restoreOverrideCursor().
Referenced by SurfaceGui::FillingPanel::accept(), SurfaceGui::FillingEdgePanel::accept(), SurfaceGui::GeomFillSurface::accept(), SurfaceGui::SectionsPanel::accept(), addSelectionGate(), Gui::SelectionObserver::detachSelection(), PartDesignGui::TaskDressUpParameters::exitSelectionMode(), PartDesignGui::TaskTransformedParameters::exitSelectionMode(), FemGui::TaskCreateNodeSet::onSelectionChanged(), SurfaceGui::FillingPanel::onSelectionChanged(), PartDesignGui::TaskSketchBasedParameters::onSelectReference(), SketcherGui::DrawSketchHandler::quit(), SurfaceGui::FillingPanel::reject(), SurfaceGui::FillingEdgePanel::reject(), SurfaceGui::GeomFillSurface::reject(), SurfaceGui::SectionsPanel::reject(), sRemoveSelectionGate(), PartGui::DlgExtrusion::~DlgExtrusion(), PartGui::DlgFilletEdges::~DlgFilletEdges(), PartGui::DlgProjectionOnSurface::~DlgProjectionOnSurface(), PartGui::DlgRevolution::~DlgRevolution(), SketcherGui::DrawSketchHandlerCarbonCopy::~DrawSketchHandlerCarbonCopy(), DrawSketchHandlerCoincident::~DrawSketchHandlerCoincident(), SketcherGui::DrawSketchHandlerExtend::~DrawSketchHandlerExtend(), SketcherGui::DrawSketchHandlerExternal::~DrawSketchHandlerExternal(), SketcherGui::DrawSketchHandlerFillet::~DrawSketchHandlerFillet(), DrawSketchHandlerGenConstraint::~DrawSketchHandlerGenConstraint(), SketcherGui::DrawSketchHandlerSplitting::~DrawSketchHandlerSplitting(), SketcherGui::DrawSketchHandlerTrimming::~DrawSketchHandlerTrimming(), Gui::ElementColors::~ElementColors(), PartGui::FaceColors::~FaceColors(), SurfaceGui::FillingEdgePanel::~FillingEdgePanel(), SurfaceGui::FillingVertexPanel::~FillingVertexPanel(), PartGui::ShapeBuilderWidget::~ShapeBuilderWidget(), PartGui::SweepWidget::~SweepWidget(), PartDesignGui::TaskChamferParameters::~TaskChamferParameters(), FemGui::TaskCreateNodeSet::~TaskCreateNodeSet(), PartDesignGui::TaskDatumParameters::~TaskDatumParameters(), PartDesignGui::TaskDraftParameters::~TaskDraftParameters(), PartDesignGui::TaskDressUpParameters::~TaskDressUpParameters(), PartDesignGui::TaskFilletParameters::~TaskFilletParameters(), PartDesignGui::TaskSketchBasedParameters::~TaskSketchBasedParameters(), PartDesignGui::TaskThicknessParameters::~TaskThicknessParameters(), PartDesignGui::TaskTransformedParameters::~TaskTransformedParameters(), and PartGui::ThicknessWidget::~ThicknessWidget().
|
staticprotected |
References addSelectionGate(), and Gui::Selection().
References Gui::SelectionObserverPython::addObserver().
References clearSelection(), and Gui::Selection().
|
staticprotected |
References countObjectsOfType(), and Gui::Selection().
int Gui::SelectionSingleton::selStackBackSize | ( | ) | const |
Return the current selection stack size.
Referenced by StdCmdSelBack::isActive().
int Gui::SelectionSingleton::selStackForwardSize | ( | ) | const |
Return the current forward selection stack size.
Referenced by StdCmdSelForward::isActive().
std::vector< SelectionObject > SelectionSingleton::selStackGet | ( | const char * | pDocName = nullptr , |
ResolveMode | resolve = ResolveMode::OldStyleElement , |
||
int | index = 0 |
||
) | const |
Obtain selected objects from stack.
pDocName | optional filtering document, NULL for current active document |
resolve | sub-object resolving mode. 0 no resolve, 1 resolve sub-object with old style element name 2 resolve sub-object with new style element name |
index | optional position in the stack |
References checkSelection(), Base::Persistence::getClassTypeId(), getObjectList(), and Gui::NoResolve.
Referenced by sGetSelectionFromStack().
void SelectionSingleton::selStackGoBack | ( | int | count = 1 | ) |
Go back selection history.
count | optional number of steps to go back |
This function pops the selection stack, and populate the current selection with the content of the last pop'd entry
References addSelection(), clearCompleteSelection(), Gui::getMainWindow(), draftfunctions.move::move(), selStackPush(), and Gui::MainWindow::updateActions().
Referenced by StdCmdSelBack::activated().
void SelectionSingleton::selStackGoForward | ( | int | count = 1 | ) |
Go forward selection history.
count | optional number of steps to go back |
This function pops the selection stack, and populate the current selection with the content of the last pop'd entry
References addSelection(), clearCompleteSelection(), Gui::getMainWindow(), draftfunctions.move::move(), selStackPush(), and Gui::MainWindow::updateActions().
Referenced by StdCmdSelForward::activated().
Save the current selection on to the stack.
clearForward | whether to clear forward selection stack |
overwrite | whether to overwrite the current top entry of the stack instead of pushing a new entry. |
References App::GetApplication(), ParameterGrp::GetInt(), App::Application::GetParameterGroupByPath(), and draftfunctions.move::move().
Referenced by StdCmdLinkMakeGroup::activated(), StdCmdLinkMake::activated(), StdCmdLinkMakeRelative::activated(), StdCmdLinkSelectLinked::activated(), StdCmdLinkSelectLinkedFinal::activated(), StdCmdLinkSelectAllLinks::activated(), StdCmdTreeSelectAllInstances::activated(), Gui::Dialog::DlgPropertyLink::attachObserver(), Gui::TreeWidget::dropEvent(), Gui::TreeWidget::itemSearch(), Gui::PropertyEditor::LinkSelection::select(), Gui::TreeWidget::selectAll(), selStackGoBack(), selStackGoForward(), PartDesignGui::ViewProviderSubShapeBinder::setEdit(), and sPushSelStack().
|
staticprotected |
References enablePickedList(), and Gui::Selection().
int SelectionSingleton::setPreselect | ( | const char * | pDocName, |
const char * | pObjectName, | ||
const char * | pSubName, | ||
float | x = 0 , |
||
float | y = 0 , |
||
float | z = 0 , |
||
SelectionChanges::MsgSource | signal = SelectionChanges::MsgSource::Any |
||
) |
set the preselected object (mostly by the 3D view)
References Gui::Application::activeDocument(), ActiveGate, Gui::SelectionGate::allow(), CurrentPreselection, DocName, FeatName, gateResolve, Gui::Document::getActiveView(), getDocument(), Gui::getMainWindow(), App::Document::getObject(), hx, hy, hz, Gui::Application::Instance, Gui::SelectionChanges::Internal, draftfunctions.move::move(), Gui::SelectionChanges::MovePreselect, Gui::NoResolve, Gui::SelectionGate::notAllowedReason, notify(), Gui::OldStyleElement, App::GeoFeature::resolveElement(), Gui::MDIView::restoreOverrideCursor(), rmvPreselect(), Gui::MDIView::setOverrideCursor(), Gui::SelectionChanges::SetPreselect, Gui::SelectionChanges::SetPreselectSignal, Gui::MainWindow::showMessage(), SubName, draftguitools.gui_setstyle::translate, and Gui::SelectionChanges::Type.
Referenced by Gui::SoFCSelection::handleEvent(), Gui::TreeWidget::itemSearch(), SketcherGui::TaskSketcherElements::on_listWidgetElements_itemEntered(), Gui::TreeWidget::onPreSelectTimer(), TechDrawGui::MDIViewPage::preSelectionChanged(), and sSetPreselection().
void SelectionSingleton::setPreselectCoord | ( | float | x, |
float | y, | ||
float | z | ||
) |
sets different coords for the preselection
References CurrentPreselection, Gui::getMainWindow(), App::DocumentObjectT::getObjectName(), Gui::SelectionChanges::Object, Gui::SelectionChanges::pDocName, Gui::SelectionChanges::pObjectName, Gui::SelectionChanges::pSubName, Gui::schemaTranslatePoint(), Gui::MainWindow::showMessage(), Gui::SelectionChanges::x, Gui::SelectionChanges::y, and Gui::SelectionChanges::z.
Referenced by Gui::SoFCSelection::handleEvent().
void SelectionSingleton::setSelection | ( | const char * | pDocName, |
const std::vector< App::DocumentObject * > & | sel | ||
) |
Set the selection for a document.
References checkSelection(), getDocument(), Gui::getMainWindow(), Gui::NoResolve, notify(), Gui::SelectionChanges::PickedListChanged, Gui::SelectionChanges::SetSelection, and Gui::MainWindow::updateActions().
Referenced by StdCmdSelectAll::activated(), StdCmdSelectVisibleObjects::activated(), Gui::TreeWidget::dropEvent(), Gui::View3DInventorViewer::selectAll(), and Gui::TreeWidget::selectAll().
void SelectionSingleton::setVisible | ( | VisibleState | visible | ) |
Set selection object visibility.
visible | see VisibleState |
References App::GetApplication(), App::Application::getDocument(), App::DocumentObject::getNameInDocument(), Gui::Application::getViewProvider(), Gui::Application::Instance, App::DocumentObject::isElementVisible(), App::DocumentObject::resolve(), App::DocumentObject::setElementVisible(), updateSelection(), VisShow, and VisToggle.
Referenced by StdCmdToggleVisibility::activated(), StdCmdShowSelection::activated(), StdCmdHideSelection::activated(), and sSetVisible().
|
staticprotected |
References getCompleteSelection(), and Gui::Selection().
References getPickedListEx(), and Gui::Selection().
|
staticprotected |
References getPreselection(), and Gui::Selection().
References getSelection(), and Gui::Selection().
References Base::Persistence::getClassTypeId(), getSelectionEx(), and Gui::Selection().
|
staticprotected |
References Gui::Selection(), and selStackGet().
References hasSelection(), and Gui::Selection().
|
staticprotected |
References hasSubSelection(), and Gui::Selection().
References isSelected(), and Gui::Selection().
unsigned int Gui::SelectionSingleton::size | ( | void | ) | const |
Size of selected entities for all documents.
Referenced by gzip_utf8.GzipFile::close(), PathScripts.PostUtils.GCodeEditorDialog::done(), StdCmdSetAppearance::isActive(), and gzip_utf8.GzipFile::write().
|
protected |
Observer message from the App doc.
References App::DocumentObject::getDocument(), Gui::getMainWindow(), App::Document::getName(), App::DocumentObject::getNameInDocument(), draftfunctions.move::move(), notify(), Gui::SelectionChanges::PickedListChanged, rmvPreselect(), Gui::SelectionChanges::RmvSelection, and Gui::MainWindow::updateActions().
Referenced by SelectionSingleton().
|
protected |
References Base::Console(), App::SubObjectT::getSubName(), Gui::SelectionChanges::HideSelection, Gui::SelectionChanges::Object, Gui::SelectionChanges::pOriginalMsg, Gui::SelectionChanges::pSubName, App::GeoFeature::resolveElement(), Gui::SelectionChanges::SetPreselectSignal, App::SubObjectT::setSubName(), Gui::SelectionChanges::ShowSelection, signalSelectionChanged2, signalSelectionChanged3, and Base::ConsoleSingleton::Warning().
Referenced by SelectionSingleton().
|
staticprotected |
References Gui::Selection(), and selStackPush().
|
staticprotected |
References rmvSelectionGate(), and Gui::Selection().
|
staticprotected |
References rmvPreselect(), and Gui::Selection().
References Gui::SelectionObserverPython::removeObserver().
References Gui::Selection(), setVisible(), VisHide, VisShow, and VisToggle.
bool SelectionSingleton::updateSelection | ( | bool | show, |
const char * | pDocName, | ||
const char * | pObjectName = nullptr , |
||
const char * | pSubName = nullptr |
||
) |
Update a selection.
References DocName, FeatName, getDocument(), Gui::SelectionChanges::HideSelection, isSelected(), draftfunctions.move::move(), Gui::NoResolve, notify(), Gui::SelectionChanges::pDocName, Gui::SelectionChanges::pObjectName, Gui::SelectionChanges::pSubName, rmvPreselect(), Gui::SelectionChanges::SetPreselectSignal, Gui::SelectionChanges::ShowSelection, and SubName.
Referenced by PathScripts.PathJobGui.TaskPanel::addSelection(), PathScripts.PathOpGui.TaskPanel::addSelection(), PathScripts.PathJobGui.TaskPanel::clearSelection(), PathScripts.PathOpGui.TaskPanel::clearSelection(), PathScripts.PathToolLibraryEditor.EditorPanel::duplicate(), PathScripts.PathPreferencesAdvanced.AdvancedPreferencesPage::loadSettings(), PathScripts.PathToolLibraryEditor.EditorPanel::moveDown(), PathScripts.PathToolLibraryEditor.EditorPanel::moveUp(), PathScripts.PathJobGui.TaskPanel::removeSelection(), PathScripts.PathOpGui.TaskPanel::removeSelection(), PathScripts.PathOpGui.TaskPanelDepthsPage::setFields(), PathScripts.PathJobGui.TaskPanel::setSelection(), PathScripts.PathOpGui.TaskPanel::setSelection(), PathScripts.PathJobGui.TaskPanel::setupUi(), setVisible(), and sUpdateSelection().
|
friend |
|
protected |
Referenced by addSelection(), addSelectionGate(), rmvPreselect(), rmvSelectionGate(), SelectionSingleton(), and setPreselect().
|
protected |
Referenced by getPreselection(), hasPreselection(), notify(), rmvPreselect(), setPreselect(), and setPreselectCoord().
|
protected |
Referenced by clearSelection(), rmvPreselect(), setPreselect(), Mod.Test.Document.DocumentPlatformCases::testColorList(), Mod.Test.Document.DocumentPlatformCases::testFloatList(), Mod.Test.Document.DocumentPlatformCases::testPoints(), Mod.Test.Document.DocumentPlatformCases::testVectorList(), and updateSelection().
|
protected |
Referenced by rmvPreselect(), setPreselect(), and updateSelection().
|
protected |
Referenced by addSelection(), addSelectionGate(), SelectionSingleton(), and setPreselect().
|
protected |
Referenced by rmvPreselect(), SelectionSingleton(), and setPreselect().
|
protected |
Referenced by rmvPreselect(), SelectionSingleton(), and setPreselect().
|
protected |
Referenced by rmvPreselect(), SelectionSingleton(), and setPreselect().
|
protected |
Referenced by addSelection(), clearCompleteSelection(), clearSelection(), disableCommandLog(), and enableCommandLog().
|
protected |
Referenced by disableCommandLog(), and enableCommandLog().
|
static |
Referenced by Gui::Application::Application().
|
protected |
Referenced by notify().
boost::signals2::signal<void (const SelectionChanges& msg)> Gui::SelectionSingleton::signalSelectionChanged |
signal on new object
Referenced by Gui::SelectionObserver::attachSelection(), notify(), and SelectionSingleton().
boost::signals2::signal<void (const SelectionChanges& msg)> Gui::SelectionSingleton::signalSelectionChanged2 |
signal on selection change with resolved object
Referenced by Gui::SelectionObserver::attachSelection(), and slotSelectionChanged().
boost::signals2::signal<void (const SelectionChanges& msg)> Gui::SelectionSingleton::signalSelectionChanged3 |
signal on selection change with resolved object and sub element map
Referenced by Gui::SelectionObserver::attachSelection(), and slotSelectionChanged().
|
protected |
Referenced by rmvPreselect(), setPreselect(), and updateSelection().