From: nds Date: Mon, 31 Jul 2017 07:43:02 +0000 (+0300) Subject: Issue #2214 Show only must not make zoom fit all. X-Git-Tag: V_2.7.2~7 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a5f449ff8176d45a0abbd3a190e3bc1f7504c84e;p=modules%2Fshaper.git Issue #2214 Show only must not make zoom fit all. It was decided to do not automatically fit all at all. --- diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 93e82f071..ca2a26fb8 100755 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -1416,6 +1416,9 @@ void XGUI_Workshop::onContextMenuCommand(const QString& theId, bool isChecked) aParameters.Append(aContext); MyVCallBack = new VInspector_CallBack(); + MyTCommunicator->RegisterPlugin("TKDFBrowser"); + MyTCommunicator->RegisterPlugin("TKVInspector"); + MyTCommunicator->RegisterPlugin("TKShapeView"); myDisplayer->setCallBack(MyVCallBack); #ifndef HAVE_SALOME AppElements_Viewer* aViewer = mainWindow()->viewer(); @@ -2052,9 +2055,6 @@ void XGUI_Workshop::showOnlyObjects(const QObjectPtrList& theList) if (module()->canEraseObject(aObj)) aObj->setDisplayed(false); } - // Block fitAll command according to bug #2214 - myEventsListener->setFitAllBlocked(true); - //Do not use eraseAll if you didn't send Redisplay event: //all objects are erased from viewer, but considered as displayed in displayer // Problem in bug 2218 @@ -2069,9 +2069,6 @@ void XGUI_Workshop::showOnlyObjects(const QObjectPtrList& theList) aObj->setDisplayed(true); } Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); - - // UnBlock fitAll command (bug #2214) - myEventsListener->setFitAllBlocked(false); } diff --git a/src/XGUI/XGUI_WorkshopListener.cpp b/src/XGUI/XGUI_WorkshopListener.cpp index 81f88b857..d1b34d181 100755 --- a/src/XGUI/XGUI_WorkshopListener.cpp +++ b/src/XGUI/XGUI_WorkshopListener.cpp @@ -43,8 +43,6 @@ #include #include #include -#include -#include #include #include @@ -86,8 +84,7 @@ const std::string DebugFeatureKind = "";//"Extrusion"; XGUI_WorkshopListener::XGUI_WorkshopListener(ModuleBase_IWorkshop* theWorkshop) : myWorkshop(theWorkshop), - myUpdatePrefs(false), - myBlockFitAll(false) + myUpdatePrefs(false) { XGUI_OperationMgr* anOperationMgr = workshop()->operationMgr(); } @@ -255,9 +252,6 @@ void XGUI_WorkshopListener:: XGUI_Workshop* aWorkshop = workshop(); XGUI_Displayer* aDisplayer = aWorkshop->displayer(); - //bool aFirstVisualizedBody = false; - bool aDoFitAll = false; - int aNbOfShownObjects = workshop()->displayer()->objectsCount(); bool aRedisplayed = false; //std::list aHiddenObjects; for (aIt = anObjects.begin(); aIt != anObjects.end(); ++aIt) { @@ -334,8 +328,6 @@ void XGUI_WorkshopListener:: } } else { // display object if the current operation has it if (displayObject(aObj)) { - aDoFitAll = aDoFitAll || neededFitAll(aObj, aNbOfShownObjects); - aRedisplayed = true; // Deactivate object of current operation from selection aWorkshop->deactivateActiveObject(aObj, false); @@ -352,11 +344,7 @@ void XGUI_WorkshopListener:: if (aRedisplayed || isCustomized) { Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_EMPTY_AIS_PRESENTATION)); - //VSV FitAll updated viewer by itself - if (aDoFitAll && (!myBlockFitAll)) - myWorkshop->viewer()->fitAll(); - else - aDisplayer->updateViewer(); + aDisplayer->updateViewer(); } } @@ -376,9 +364,6 @@ void XGUI_WorkshopListener:: .arg(anObjects.size()).arg(anInfoStr).toStdString().c_str()); #endif - bool aDoFitAll = false; - int aNbOfShownObjects = workshop()->displayer()->objectsCount(); - //bool aHasPart = false; bool aDisplayed = false; for (aIt = anObjects.begin(); aIt != anObjects.end(); ++aIt) { @@ -417,8 +402,6 @@ void XGUI_WorkshopListener:: if (myWorkshop->module()->canDisplayObject(anObject)) { anObject->setDisplayed(true); aDisplayed = displayObject(anObject); - if (aDisplayed) - aDoFitAll = aDoFitAll || neededFitAll(anObject, aNbOfShownObjects); } else anObject->setDisplayed(false); } @@ -430,11 +413,7 @@ void XGUI_WorkshopListener:: // myObjectBrowser->processEvent(theMsg); if (aDisplayed) { Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_EMPTY_AIS_PRESENTATION)); - //VSV FitAll updated viewer by itself - if (aDoFitAll) - myWorkshop->viewer()->fitAll(); - else - workshop()->displayer()->updateViewer(); + workshop()->displayer()->updateViewer(); } //if (aHasPart) { // TODO: Avoid activate last part on loading of document // activateLastPart(); @@ -506,25 +485,6 @@ bool XGUI_WorkshopListener::displayObject(ObjectPtr theObj) return aDisplayer->display(theObj, false); } -//************************************************************** -bool XGUI_WorkshopListener::neededFitAll(ObjectPtr theObj, const int theNbOfShownObjects) -{ - bool aFirstVisualizedBody = false; - - if (theNbOfShownObjects == 0) { - ResultPtr aResult = std::dynamic_pointer_cast(theObj); - if (aResult.get()) { - std::string aResultGroupName = aResult->groupName(); - if (aResultGroupName == ModelAPI_ResultBody::group() || - aResultGroupName == ModelAPI_ResultGroup::group()) { - std::shared_ptr aShapePtr = ModelAPI_Tools::shape(aResult); - aFirstVisualizedBody = aShapePtr.get() != NULL; - } - } - } - return aFirstVisualizedBody; -} - bool XGUI_WorkshopListener::customizeCurrentObject(const std::set& theObjects, bool theForceRedisplay) { diff --git a/src/XGUI/XGUI_WorkshopListener.h b/src/XGUI/XGUI_WorkshopListener.h index aad3aa07a..c338535bd 100755 --- a/src/XGUI/XGUI_WorkshopListener.h +++ b/src/XGUI/XGUI_WorkshopListener.h @@ -59,13 +59,6 @@ public: //! Redefinition of Events_Listener method virtual void processEvent(const std::shared_ptr& theMessage); - //! Returns state of blocking fitAll command - bool isFitAllBlocked() const { return myBlockFitAll; } - - //! Sets state of blocking fitAll command - //! \param toBlock a new blocking state - void setFitAllBlocked(bool toBlock) { myBlockFitAll = toBlock; } - signals: /// Emitted when error in applivation happens void errorOccurred(std::shared_ptr theMsg); @@ -98,13 +91,6 @@ protected: /// \return true if the object is displayed bool displayObject(ObjectPtr theObj); - /// Answer if the viewer needed to be fit all after the object visualization - /// The condition is there is not shown objects and the object is a group or body result - /// \param theObject a shown object - /// \param theNbOfShownObjects a count of already shown objects in the viewer - /// \return true if fit all should be done - bool neededFitAll(ObjectPtr theObject, const int theNbOfShownObjects); - /// Calls the module method of cusomize object for the feature of the current operation /// Perform cusomize if the force redisplay flag is true or the list of objects contains the /// current operation feature @@ -121,7 +107,6 @@ private: ModuleBase_IWorkshop* myWorkshop; // the current workshop bool myUpdatePrefs; - bool myBlockFitAll; }; #endif