Additionaly performance of fillet, mirror, rotation are improved by this modification.
const bool isSendError = true);
//! Removes the feature from the document (with result)
+ //! It is necessary to flush REDISPLAY signal manually after this method because
+ //! the method sends it, but for the performance purpose does not flush it
//! \param theFeature a removed feature
MODEL_EXPORT virtual void removeFeature(FeaturePtr theFeature);
RemoveFromRefArray(featuresLabel(), aFeatureLabel);
// event: feature is deleted
ModelAPI_EventCreator::get()->sendDeleted(theFeature->document(), ModelAPI_Feature::group());
- // the redisplay signal should be flushed in order to erase the feature presentation in the viewer
- Events_Loop::loop()->flush(EVENT_DISP);
updateHistory(ModelAPI_Feature::group());
}
}
myProcessOnFinish.clear(); // processed features must be only on finish, so clear anyway (to avoid reimport on load)
if (!(theMessage->eventID() == kOpStartEvent)) {
- processFeatures();
+ processFeatures(false);
}
// remove all macros before clearing all created
std::set<FeaturePtr>::iterator anUpdatedIter = myWaitForFinish.begin();
anUpdatedIter++;
}
}
+ // the redisplay signal should be flushed in order to erase the feature presentation in the viewer
+ // if should be done after removeFeature() of document,
+ // by this reason, upper processFeatures() do not perform this flush
+ Events_Loop::loop()->flush(Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY));
+
// in the end of transaction everything is updated, so clear the old objects
myIsParamUpdated = false;
myWaitForFinish.clear();
}
}
-void Model_Update::processFeatures()
+void Model_Update::processFeatures(const bool theFlushRedisplay)
{
// perform update of everything if it is not performed right now or any preview is blocked
if (!myIsProcessed && !myIsPreviewBlocked) {
aLoop->flush(kUpdatedEvent);
// flush to update display
- static Events_ID EVENT_DISP = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
- aLoop->flush(EVENT_DISP);
+ if (theFlushRedisplay) {
+ static Events_ID EVENT_DISP = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
+ aLoop->flush(EVENT_DISP);
+ }
#ifdef DEB_UPDATE
std::cout<<"****** End processing"<<std::endl;
#endif
/// On operation start/end/abort the "Just" fileds must be cleared and processed in the right way
/// \param theFinish is true for start, close or abort transaction: all objects must be processed
- void processFeatures();
+ //! \param theFlushRedisplay a boolean value if the redisplay signal should be flushed
+ void processFeatures(const bool theFlushRedisplay = true);
/// Performs the feature execution
/// \returns the status of execution
#include <XGUI_DataModel.h>
#include <XGUI_ErrorMgr.h>
#include <XGUI_CustomPrs.h>
+#include <XGUI_SelectionMgr.h>
#include <SketchPlugin_Feature.h>
#include <SketchPlugin_Sketch.h>
anOpMgr->startOperation(anOpAction);
+ // WORKAROUND, should be done to avoid viewer highlight update after deletetion of objects
+ // the problem is in AIS Dimensions recompute if a line and the dim are removed, line is the first
+ // it causes the AIS recompute, where the base line is null, the result is empty AIS in the viewer
+ XGUI_Tools::workshop(myWorkshop)->selector()->clearSelection();
+
// 4. delete features
// sketch feature should be skipped, only sub-features can be removed
// when sketch operation is active
void PartSetPlugin_Part::removeFeature(std::shared_ptr<ModelAPI_Feature> theFeature)
{
- ResultPartPtr aResult = std::dynamic_pointer_cast<ModelAPI_ResultPart>(firstResult());
- if (aResult.get()) {
- DocumentPtr aDoc = aResult->partDoc();
- if (aDoc.get() && aDoc->isOpened())
- aDoc->removeFeature(theFeature);
- }
}
#include "PartSetPlugin_Remove.h"
#include "PartSetPlugin_Part.h"
+
#include <ModelAPI_Document.h>
#include <ModelAPI_Data.h>
#include <ModelAPI_AttributeDocRef.h>
#include <ModelAPI_Session.h>
#include <ModelAPI_Feature.h>
#include <ModelAPI_Tools.h>
+#include <ModelAPI_Events.h>
+
+#include <Events_Loop.h>
void PartSetPlugin_Remove::execute()
{
aPart->data()->document(ModelAPI_ResultPart::DOC_REF())->value()->close();
std::set<std::shared_ptr<ModelAPI_Feature> > aRefFeatures;
aRoot->refsToFeature(aFeature, aRefFeatures);
- if (aRefFeatures.empty())
+ if (aRefFeatures.empty()) {
aRoot->removeFeature(aFeature);
+ // the redisplay signal should be flushed in order to erase the feature presentation in the viewer
+ // after removeFeature from the document
+ Events_Loop::loop()->flush(Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY));
+ }
}
}
}
mySelector->clearSelection();
std::set<FeaturePtr> anIgnoredFeatures;
- if (removeFeatures(anUnusedObjects, anIgnoredFeatures, anActionId)) {
+ if (removeFeatures(anUnusedObjects, anIgnoredFeatures, anActionId, true)) {
operationMgr()->commitOperation();
}
else {
const std::set<FeaturePtr>& theIgnoredFeatures,
const bool doDeleteReferences)
{
+ bool isDone = false;
if (doDeleteReferences) {
std::set<FeaturePtr> aFeaturesToDelete = aDirectRefFeatures;
aFeaturesToDelete.insert(aIndirectRefFeatures.begin(), aIndirectRefFeatures.end());
FeaturePtr aFeature = (*anIt);
DocumentPtr aDoc = aFeature->document();
if (theIgnoredFeatures.find(aFeature) == theIgnoredFeatures.end()) {
+ // flush REDISPLAY signal after remove feature
aDoc->removeFeature(aFeature);
+ isDone = true;
#ifdef DEBUG_DELETE
anInfo.append(ModuleBase_Tools::objectInfo(aFeature).toStdString().c_str());
#endif
}
QString anActionId = "DELETE_CMD";
- return removeFeatures(theList, theIgnoredFeatures, anActionId);
+ isDone = removeFeatures(theList, theIgnoredFeatures, anActionId, false) || isDone;
+
+ if (isDone) {
+ // the redisplay signal should be flushed in order to erase the feature presentation in the viewer
+ // if should be done after removeFeature() of document
+ Events_Loop::loop()->flush(Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY));
+ }
+ return isDone;
}
//**************************************************************
bool XGUI_Workshop::removeFeatures(const QObjectPtrList& theList,
const std::set<FeaturePtr>& theIgnoredFeatures,
- const QString& theActionId)
+ const QString& theActionId,
+ const bool theFlushRedisplay)
{
bool isDone = false;
anInfo.append(anInfoStr);
qDebug(QString("remove feature :%1").arg(anInfoStr).toStdString().c_str());
#endif
+ // flush REDISPLAY signal after remove feature
aDoc->removeFeature(aFeature);
isDone = true;
}
}
}
+ if (isDone && theFlushRedisplay) {
+ // the redisplay signal should be flushed in order to erase the feature presentation in the viewer
+ // if should be done after removeFeature() of document
+ Events_Loop::loop()->flush(Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY));
+ }
+
#ifdef DEBUG_DELETE
qDebug(QString("remove features:%1").arg(anInfo.join("; ")).toStdString().c_str());
#endif
//! \param theList an objects to be deleted
//! \param theIgnoredFeatures a list of features to be ignored during delete
//! \param theActionId an action command key to find context menu object types enabled for remove
+ //! \param theFlushRedisplay a boolean value if the redisplay signal should be flushed
bool removeFeatures(const QObjectPtrList& theList,
const std::set<FeaturePtr>& theIgnoredFeatures,
- const QString& theActionId);
+ const QString& theActionId,
+ const bool theFlushRedisplay);
//! Creates list of actions (commands) by given history list from session
QList<ActionInfo> processHistoryList(const std::list<std::string>&) const;