From: vsv Date: Wed, 24 Dec 2014 16:08:22 +0000 (+0300) Subject: Call fitAll on display of first object X-Git-Tag: V_0.7.0_rc1~47 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=cb357e58a883375cc9dfc33e5cd501c2cd1ad0c1;p=modules%2Fshaper.git Call fitAll on display of first object --- diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 8d113e9d1..d892ccf70 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -499,7 +499,7 @@ void XGUI_Workshop::onFeatureRedisplayMsg(const std::shared_ptrerase(aObj, false); else { if (myDisplayer->isVisible(aObj)) { - myDisplayer->display(aObj, false); // In order to update presentation + displayObject(aObj); // In order to update presentation if (myOperationMgr->hasOperation()) { ModuleBase_Operation* aOperation = myOperationMgr->currentOperation(); if (aOperation->hasObject(aObj) && myDisplayer->isActive(aObj)) @@ -510,7 +510,7 @@ void XGUI_Workshop::onFeatureRedisplayMsg(const std::shared_ptrcurrentOperation(); // Display only current operation results if operation has preview if (aOperation->hasObject(aObj)/* && aOperation->hasPreview()*/) { - myDisplayer->display(aObj, false); + displayObject(aObj); // Deactivate object of current operation from selection if (myDisplayer->isActive(aObj)) myDisplayer->deactivate(aObj); @@ -539,7 +539,7 @@ void XGUI_Workshop::onFeatureCreatedMsg(const std::shared_ptrhasOperation()) { ModuleBase_Operation* aOperation = myOperationMgr->currentOperation(); if (aOperation->hasObject(*aIt)) { // Display only current operation results - myDisplayer->display(*aIt, false); + displayObject(*aIt); isDisplayed = true; } } @@ -600,14 +600,10 @@ void XGUI_Workshop::onOperationStopped(ModuleBase_Operation* theOperation) hidePropertyPanel(); myPropertyPanel->cleanContent(); - // Activate objects created by current operation - //FeaturePtr aFeature = theOperation->feature(); - //myDisplayer->activate(aFeature); - //const std::list& aResults = aFeature->results(); - //std::list::const_iterator aIt; - //for (aIt = aResults.cbegin(); aIt != aResults.cend(); ++aIt) { - // myDisplayer->activate(*aIt); - //} + // Activate objects created by current operation + // in order to clean selection modes + QIntList aModes; + myDisplayer->activateObjects(aModes); myModule->operationStopped(theOperation); } @@ -1306,7 +1302,7 @@ void XGUI_Workshop::showObjects(const QObjectPtrList& theList, bool isVisible) foreach (ObjectPtr aObj, theList) { if (isVisible) { - myDisplayer->display(aObj, false); + displayObject(aObj); } else { myDisplayer->erase(aObj, false); } @@ -1355,7 +1351,7 @@ void XGUI_Workshop::displayDocumentResults(DocumentPtr theDoc) void XGUI_Workshop::displayGroupResults(DocumentPtr theDoc, std::string theGroup) { for (int i = 0; i < theDoc->size(theGroup); i++) - myDisplayer->display(theDoc->object(theGroup, i), false); + displayObject(theDoc->object(theGroup, i)); } //************************************************************** @@ -1379,3 +1375,16 @@ void XGUI_Workshop::closeDocument() aMgr->closeAll(); objectBrowser()->clearContent(); } + +//************************************************************** +void XGUI_Workshop::displayObject(ObjectPtr theObj) +{ + ResultBodyPtr aBody = std::dynamic_pointer_cast(theObj); + if (aBody.get() != NULL) { + int aNb = myDisplayer->objectsCount(); + myDisplayer->display(theObj, false); + if (aNb == 0) + viewer()->fitAll(); + } else + myDisplayer->display(theObj, false); +} \ No newline at end of file diff --git a/src/XGUI/XGUI_Workshop.h b/src/XGUI/XGUI_Workshop.h index 4db6052fe..d2423262c 100644 --- a/src/XGUI/XGUI_Workshop.h +++ b/src/XGUI/XGUI_Workshop.h @@ -289,6 +289,10 @@ signals: // Creates Dock widgets: Object browser and Property panel void createDockWidgets(); + /// Displaus object and fit all viewer if the object is first (update viewer will not be called) + void displayObject(ObjectPtr theObj); + +private: AppElements_MainWindow* myMainWindow; ModuleBase_IModule* myModule; XGUI_ObjectsBrowser* myObjectBrowser;