#include "XGUI_Tools.h"
#include "XGUI_ViewerProxy.h"
#include "XGUI_WorkshopListener.h"
-#include <XGUI_CustomPrs.h>
#include <XGUI_HistoryMenu.h>
#include <XGUI_QtEvents.h>
#include <XGUI_DataModel.h>
#include <ModuleBase_Tools.h>
#include <ModuleBase_WidgetFactory.h>
#include <ModuleBase_OperationFeature.h>
-#include <ModuleBase_OperationAction.h>
#include <ModuleBase_PagedContainer.h>
#include <ModuleBase_WidgetValidated.h>
#include <ModuleBase_ModelWidget.h>
connect(myEventsListener, SIGNAL(errorOccurred(std::shared_ptr<Events_InfoMessage>)),
myErrorDlg, SLOT(addError(std::shared_ptr<Events_InfoMessage>)));
- //Config_PropManager::registerProp("Visualization", "object_default_color", "Object color",
- // Config_Prop::Color, "225,225,225");
-
- Config_PropManager::registerProp("Visualization", "result_body_color", "Result color",
- Config_Prop::Color, ModelAPI_ResultBody::DEFAULT_COLOR());
- Config_PropManager::registerProp("Visualization", "result_group_color", "Group color",
- Config_Prop::Color, ModelAPI_ResultGroup::DEFAULT_COLOR());
- Config_PropManager::registerProp("Visualization", "result_construction_color",
- "Construction color",
- Config_Prop::Color,
- ModelAPI_ResultConstruction::DEFAULT_COLOR());
- Config_PropManager::registerProp("Visualization", "result_part_color", "Part color",
- Config_Prop::Color, ModelAPI_ResultPart::DEFAULT_COLOR());
- Config_PropManager::registerProp("Visualization", "result_field_color", "Field color",
- Config_Prop::Color, ModelAPI_ResultField::DEFAULT_COLOR());
-
Config_PropManager::registerProp("Visualization", "selection_color", "Selection color",
Config_Prop::Color, "255,255,255");
myPropertyPanel->cleanContent();
QList<ModuleBase_ModelWidget*> aWidgets;
- if (!module()->createWidgets(theOperation, aWidgets)) {
- QString aXmlRepr = aFOperation->getDescription()->xmlRepresentation();
+ QString aXmlRepr = aFOperation->getDescription()->xmlRepresentation();
+ if (!module()->createWidgets(aFOperation->feature(), aXmlRepr, aWidgets)) {
ModuleBase_WidgetFactory aFactory(aXmlRepr.toStdString(), myModuleConnector);
aFactory.createWidget(myPropertyPanel->contentWidget());
aWidgets = aFactory.getModelWidgets();
myErrorMgr->setPropertyPanel(myPropertyPanel);
theOperation->setHideFacesVisible(myFacesPanel->isVisible());
- if (aFeatureInfo->isHideFacesPanel() && !myFacesPanel->isVisible())
+ if (aFeatureInfo.get() && aFeatureInfo->isHideFacesPanel() && !myFacesPanel->isVisible())
myFacesPanel->show();
showPanel(myPropertyPanel);
}
Qt::BottomDockWidgetArea);
connect(myFacesPanel, SIGNAL(closed()), myFacesPanel, SLOT(onClosed()));
- myInspectionPanel = new XGUI_InspectionPanel(aDesktop, mySelector);
+ myInspectionPanel = new XGUI_InspectionPanel(aDesktop, this);
myInspectionPanel->setAllowedAreas(Qt::LeftDockWidgetArea |
Qt::RightDockWidgetArea);
aDesktop->addDockWidget(Qt::RightDockWidgetArea, myInspectionPanel);
// allow the module to delete objects, do nothing if it has succeed
if (aModule->deleteObjects()) {
updateCommandStatus();
+ myDisplayer->updateViewer();
return;
}
bool aDone = false;
QString aDescription = contextMenuMgr()->action("DELETE_CMD")->text() + " %1";
aDescription = aDescription.arg(XGUI_Tools::unionOfObjectNames(anObjects, ", "));
- ModuleBase_OperationAction* anOpAction = new ModuleBase_OperationAction(aDescription, module());
+ ModuleBase_Operation* anOpAction = new ModuleBase_Operation(aDescription, module());
operationMgr()->startOperation(anOpAction);
// 1. start operation
aDescription += "by deleting of " +
aDescription.arg(XGUI_Tools::unionOfObjectNames(anObjects, ", "));
- ModuleBase_OperationAction* anOpAction = new ModuleBase_OperationAction(aDescription, module());
+ ModuleBase_Operation* anOpAction = new ModuleBase_Operation(aDescription, module());
operationMgr()->startOperation(anOpAction);
// WORKAROUND, should be done before each object remove, if it presents in XGUI_DataModel tree
foreach(ObjectPtr anObject, theObjects) {
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObject);
if (aResult.get()) {
- XGUI_CustomPrs::getResultColor(aResult, aColor);
+ ModelAPI_Tools::getColor(aResult, aColor);
}
else {
// TODO: remove the obtaining a color from the AIS object
foreach(ObjectPtr anObject, theObjects) {
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObject);
if (aResult.get()) {
- aDeflection = XGUI_CustomPrs::getResultDeflection(aResult);
+ aDeflection = ModelAPI_Tools::getDeflection(aResult);
}
else {
// TODO: remove the obtaining a property from the AIS object
foreach(ObjectPtr anObject, theObjects) {
ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(anObject);
if (aResult.get()) {
- aCurrentValue = XGUI_CustomPrs::getResultTransparency(aResult);
+ aCurrentValue = ModelAPI_Tools::getTransparency(aResult);
}
if (aCurrentValue > 0)
break;
myObjectBrowser->updateAllIndexes();
updateColorScaleVisibility();
+ displayer()->updateViewer();
}
//**************************************************************
// Necessary for update icons in ObjectBrowser on Linux
myObjectBrowser->updateAllIndexes();
updateColorScaleVisibility();
+ displayer()->updateViewer();
}
aDocs.append(aMgr->moduleDocument());
foreach(DocumentPtr aDoc, aDocs) {
- synchronizeGroupInViewer(aDoc, ModelAPI_ResultConstruction::group(), false);
- synchronizeGroupInViewer(aDoc, ModelAPI_ResultBody::group(), false);
- synchronizeGroupInViewer(aDoc, ModelAPI_ResultPart::group(), false);
- synchronizeGroupInViewer(aDoc, ModelAPI_ResultGroup::group(), false);
+ synchronizeGroupInViewer(aDoc, false);
}
}
//******************************************************
void XGUI_Workshop::synchronizeGroupInViewer(const DocumentPtr& theDoc,
- const std::string& theGroup,
bool theUpdateViewer)
{
- ObjectPtr aObj;
- int aSize = theDoc->size(theGroup);
+ FeaturePtr aFeature;
+ ResultPtr aRes;
+ int aSize = theDoc->numInternalFeatures();
for (int i = 0; i < aSize; i++) {
- aObj = theDoc->object(theGroup, i);
- if (aObj->isDisplayed()) {
- // Hide the presentation with an empty shape. But isDisplayed state of the object should not
- // be changed to the object becomes visible when the shape becomes not empty
- ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(aObj);
- if (aRes.get() && (!aRes->shape().get() || aRes->shape()->isNull()))
- continue;
- ResultBodyPtr aResBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aObj);
- if (aResBody.get())
- synchronizeResultTree(aResBody, false);
- else
- myDisplayer->display(aObj, false);
+ aFeature = theDoc->internalFeature(i);
+ if (!aFeature.get())
+ continue;
+ const std::list<ResultPtr>& aResults = aFeature->results();
+ std::list<ResultPtr>::const_iterator aIt;
+ aFeature->setDisplayed(false);
+ for (aIt = aResults.cbegin(); aIt != aResults.cend(); aIt++) {
+ aRes = (*aIt);
+ if (aRes->isDisplayed() && !aRes->isConcealed()) {
+ // Hide the presentation with an empty shape. But isDisplayed state of the object should not
+ // be changed to the object becomes visible when the shape becomes not empty
+ if (!aRes->shape().get() || aRes->shape()->isNull())
+ continue;
+ ResultBodyPtr aResBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aRes);
+ if (aResBody.get())
+ synchronizeResultTree(aResBody, false);
+ else {
+ if (aRes->isInHistory()) {
+ if (aRes->isDisplayed())
+ myDisplayer->display(aRes, false);
+ else
+ myDisplayer->erase(aRes, false);
+ }
+ else
+ aRes->setDisplayed(false);
+ }
+ }
}
}
if (theUpdateViewer)