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();
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
aObj->setDisplayed(true);
}
Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
-
- // UnBlock fitAll command (bug #2214)
- myEventsListener->setFitAllBlocked(false);
}
#include <ModelAPI_Result.h>
#include <ModelAPI_Feature.h>
#include <ModelAPI_Data.h>
-#include <ModelAPI_ResultBody.h>
-#include <ModelAPI_ResultGroup.h>
#include <ModelAPI_ResultCompSolid.h>
#include <ModelAPI_Tools.h>
XGUI_WorkshopListener::XGUI_WorkshopListener(ModuleBase_IWorkshop* theWorkshop)
: myWorkshop(theWorkshop),
- myUpdatePrefs(false),
- myBlockFitAll(false)
+ myUpdatePrefs(false)
{
XGUI_OperationMgr* anOperationMgr = workshop()->operationMgr();
}
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<ObjectPtr> aHiddenObjects;
for (aIt = anObjects.begin(); aIt != anObjects.end(); ++aIt) {
}
} 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);
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();
}
}
.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) {
if (myWorkshop->module()->canDisplayObject(anObject)) {
anObject->setDisplayed(true);
aDisplayed = displayObject(anObject);
- if (aDisplayed)
- aDoFitAll = aDoFitAll || neededFitAll(anObject, aNbOfShownObjects);
} else
anObject->setDisplayed(false);
}
// 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();
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<ModelAPI_Result>(theObj);
- if (aResult.get()) {
- std::string aResultGroupName = aResult->groupName();
- if (aResultGroupName == ModelAPI_ResultBody::group() ||
- aResultGroupName == ModelAPI_ResultGroup::group()) {
- std::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(aResult);
- aFirstVisualizedBody = aShapePtr.get() != NULL;
- }
- }
- }
- return aFirstVisualizedBody;
-}
-
bool XGUI_WorkshopListener::customizeCurrentObject(const std::set<ObjectPtr>& theObjects,
bool theForceRedisplay)
{
//! Redefinition of Events_Listener method
virtual void processEvent(const std::shared_ptr<Events_Message>& 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<Events_InfoMessage> theMsg);
/// \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
ModuleBase_IWorkshop* myWorkshop; // the current workshop
bool myUpdatePrefs;
- bool myBlockFitAll;
};
#endif