2. External edge: do not use execute() for external objects, created temporary for validating; union create/remove external objects
3. Compsolid redisplay: erase CompSolid on redisplay signal if it is visualized but number of sub results is positive
4. Deviation coefficient for visualized shapes with Edge shape type.
return ResultCompSolidPtr(); // not found
}
+bool hasSubResults(const ResultPtr& theResult)
+{
+ ResultCompSolidPtr aCompSolid = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(theResult);
+ return aCompSolid.get() && aCompSolid->numberOfSubs() > 0;
+}
+
} // namespace ModelAPI_Tools
*/
MODELAPI_EXPORT ResultCompSolidPtr compSolidOwner(const ResultPtr& theSub);
+/*!
+* Returns true if the result contains a not empty list of sub results. It processes result compsolid.
+* \param theResult a result object
+* \returns boolean value
+*/
+MODELAPI_EXPORT bool hasSubResults(const ResultPtr& theResult);
+
}
#endif
Set(myOriginalShape);
// change deviation coefficient to provide more precise circle
- Handle(Prs3d_Drawer) aDrawer = Attributes();
- //aDrawer->SetDeviationCoefficient(ModuleBase_Tools::defaultDeviationCoefficient());
+ ModuleBase_Tools::setDefaultDeviationCoefficient(myOriginalShape, Attributes());
AIS_Shape::Compute(thePresentationManager, thePresentation, theMode);
}
}
}
}
-double defaultDeviationCoefficient()
+void setDefaultDeviationCoefficient(const TopoDS_Shape& theShape,
+ const Handle(Prs3d_Drawer)& theDrawer)
{
- // this value is chosen by performance check. Test case is an extrusion on sketch circle.
- return 1.e-4; // default value is 1.e-3
+ if (!theShape.IsNull() && theShape.ShapeType() == TopAbs_EDGE)
+ theDrawer->SetDeviationCoefficient(1.e-4);
}
}
#include <ModelAPI_Feature.h>
#include <TopAbs_ShapeEnum.hxx>
+#include <TopoDS_Shape.hxx>
+#include <Prs3d_Drawer.hxx>
#include <QPixmap>
\param hasParameter will be set to true if list contains Parameter objects
\param hasSubFeature will be set to true if list contains Sub-Feature objects
*/
-MODULEBASE_EXPORT void checkObjects(const QObjectPtrList& theObjects, bool& hasResult, bool& hasFeature, bool& hasParameter, bool& hasSubFeature);
+MODULEBASE_EXPORT void checkObjects(const QObjectPtrList& theObjects, bool& hasResult,
+ bool& hasFeature, bool& hasParameter, bool& hasSubFeature);
-/*! Returns the default deviation coefficient value
+/*! Sets the default coeffient into the driver calculated accordingly the shape type.
+It provides 1.e-4 for a shape withe Edge shape type
+\param theShape a shape to define the deviation coeffient,
\return double value
*/
-MODULEBASE_EXPORT double defaultDeviationCoefficient();
+MODULEBASE_EXPORT void setDefaultDeviationCoefficient(const TopoDS_Shape& theShape,
+ const Handle(Prs3d_Drawer)& theDrawer);
}
#endif
#include <ModelAPI_Data.h>
#include <ModelAPI_Object.h>
+#include <ModelAPI_AttributeSelectionList.h>
+#include <ModelAPI_AttributeRefList.h>
#include <Config_WidgetAPI.h>
const Config_WidgetAPI* theData,
const std::string& theParentId)
: ModuleBase_WidgetSelector(theParent, theWorkshop, theData, theParentId),
- mySelectionCount(0), myIsInValidate(false)
+ mySelectionCount(0)
{
QGridLayout* aMainLay = new QGridLayout(this);
ModuleBase_Tools::adjustMargins(aMainLay);
{
// the value is stored on the selection changed signal processing
// A rare case when plugin was not loaded.
- if(!myFeature)
+ if (!myFeature)
return false;
- DataPtr aData = myFeature->data();
- AttributeSelectionListPtr aSelectionListAttr =
- std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(aData->attribute(attributeID()));
-
- if (aSelectionListAttr) {
- // Store shapes type
- TopAbs_ShapeEnum aCurrentType =
- ModuleBase_Tools::shapeType(myTypeCombo->currentText());
+
+ AttributeSelectionListPtr aSelectionListAttr = myFeature->data()->selectionList(attributeID());
+ if (aSelectionListAttr.get()) {
aSelectionListAttr->setSelectionType(myTypeCombo->currentText().toStdString());
}
return true;
bool ModuleBase_WidgetMultiSelector::restoreValueCustom()
{
// A rare case when plugin was not loaded.
- if(!myFeature)
+ if (!myFeature)
return false;
- DataPtr aData = myFeature->data();
- AttributeSelectionListPtr aSelectionListAttr =
- std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(aData->attribute(attributeID()));
- if (aSelectionListAttr) {
+ AttributeSelectionListPtr aSelectionListAttr = myFeature->data()->selectionList(attributeID());
+ if (aSelectionListAttr.get()) {
// Restore shape type
if (!aSelectionListAttr->selectionType().empty())
setCurrentShapeType(ModuleBase_Tools::shapeType(aSelectionListAttr->selectionType().c_str()));
- updateSelectionList(aSelectionListAttr);
- return true;
}
- return false;
+ updateSelectionList();
+ return true;
}
//********************************************************************
void ModuleBase_WidgetMultiSelector::storeAttributeValue()
{
- myIsInValidate = true;
- DataPtr aData = myFeature->data();
- AttributeSelectionListPtr aSelectionListAttr =
- std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(aData->attribute(attributeID()));
- if (aSelectionListAttr.get() == NULL)
- return;
-
- mySelectionType = aSelectionListAttr->selectionType();
- mySelectionCount = aSelectionListAttr->size();
+ ModuleBase_WidgetValidated::storeAttributeValue();
+
+ AttributeSelectionListPtr aSelectionListAttr = myFeature->data()->selectionList(attributeID());
+ if (aSelectionListAttr.get()) {
+ mySelectionType = aSelectionListAttr->selectionType();
+ mySelectionCount = aSelectionListAttr->size();
+ }
+ else {
+ AttributeRefListPtr aRefListAttr = myFeature->data()->reflist(attributeID());
+ mySelectionCount = aRefListAttr->size();
+ }
}
//********************************************************************
-void ModuleBase_WidgetMultiSelector::clearAttribute()
+void ModuleBase_WidgetMultiSelector::restoreAttributeValue(bool theValid)
{
- DataPtr aData = myFeature->data();
- AttributeSelectionListPtr aSelectionListAttr =
- std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(aData->attribute(attributeID()));
- aSelectionListAttr->clear();
+ ModuleBase_WidgetValidated::restoreAttributeValue(theValid);
+
+ // Store shape type
+ AttributeSelectionListPtr aSelectionListAttr = myFeature->data()->selectionList(attributeID());
+ if (aSelectionListAttr.get()) {
+ aSelectionListAttr->setSelectionType(mySelectionType);
+
+ // restore selection in the attribute. Indeed there is only one stored object
+ int aCountAppened = aSelectionListAttr->size() - mySelectionCount;
+ for (int i = 0; i < aCountAppened; i++)
+ aSelectionListAttr->removeLast();
+ }
+ else {
+ AttributeRefListPtr aRefListAttr = myFeature->data()->reflist(attributeID());
+ // restore objects in the attribute. Indeed there is only one stored object
+#ifdef DEBUG_REFLIST
+ int aCountAppened = aRefListAttr->size() - mySelectionCount;
+ for (int i = 0; i < aCountAppened; i++)
+ aRefListAttr->removeLast();
+#endif
+ }
}
//********************************************************************
-void ModuleBase_WidgetMultiSelector::setObject(ObjectPtr theSelectedObject,
- GeomShapePtr theShape)
+void ModuleBase_WidgetMultiSelector::clearAttribute()
{
- DataPtr aData = myFeature->data();
- AttributeSelectionListPtr aSelectionListAttr =
- std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(aData->attribute(attributeID()));
-
- int aSelCount = aSelectionListAttr->size();
- ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theSelectedObject);
- aSelectionListAttr->append(aResult, theShape, myIsInValidate);
+ AttributeSelectionListPtr aSelectionListAttr = myFeature->data()->selectionList(attributeID());
+ if (aSelectionListAttr.get())
+ aSelectionListAttr->clear();
+ else {
+ AttributeRefListPtr aRefListAttr = myFeature->data()->reflist(attributeID());
+ aRefListAttr->clear();
+ }
}
//********************************************************************
-void ModuleBase_WidgetMultiSelector::restoreAttributeValue(bool/* theValid*/)
+void ModuleBase_WidgetMultiSelector::setObject(ObjectPtr theSelectedObject,
+ GeomShapePtr theShape)
{
- myIsInValidate = false;
-
- // Store shape type
- DataPtr aData = myFeature->data();
- AttributeSelectionListPtr aSelectionListAttr =
- std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(aData->attribute(attributeID()));
- aSelectionListAttr->setSelectionType(mySelectionType);
-
- // restore selection in the attribute
- int aCountAppened = aSelectionListAttr->size() - mySelectionCount;
- for ( int i = 0; i < aCountAppened; i++)
- aSelectionListAttr->removeLast();
+ AttributeSelectionListPtr aSelectionListAttr = myFeature->data()->selectionList(attributeID());
+ if (aSelectionListAttr.get()) {
+ ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theSelectedObject);
+ aSelectionListAttr->append(aResult, theShape, myIsInValidate);
+ }
+ else {
+ AttributeRefListPtr aRefListAttr = myFeature->data()->reflist(attributeID());
+ aRefListAttr->append(theSelectedObject);
+ }
}
//********************************************************************
QList<ModuleBase_ViewerPrs> aSelected;
// Restore selection in the viewer by the attribute selection list
if(myFeature) {
- DataPtr aData = myFeature->data();
- AttributeSelectionListPtr aListAttr =
- std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(aData->attribute(attributeID()));
- if (aListAttr) {
- for (int i = 0; i < aListAttr->size(); i++) {
- AttributeSelectionPtr anAttr = aListAttr->value(i);
+ AttributeSelectionListPtr aSelectionListAttr = myFeature->data()->selectionList(attributeID());
+ if (aSelectionListAttr.get()) {
+ for (int i = 0; i < aSelectionListAttr->size(); i++) {
+ AttributeSelectionPtr anAttr = aSelectionListAttr->value(i);
ResultPtr anObject = anAttr->context();
if (anObject.get()) {
TopoDS_Shape aShape;
}
}
}
+ else {
+ AttributeRefListPtr aRefListAttr = myFeature->data()->reflist(attributeID());
+ if (aRefListAttr.get()) {
+ for (int i = 0; i < aRefListAttr->size(); i++) {
+ ObjectPtr anObject = aRefListAttr->object(i);
+ if (anObject.get()) {
+ aSelected.append(ModuleBase_ViewerPrs(anObject, TopoDS_Shape(), NULL));
+ }
+ }
+ }
+ }
}
return aSelected;
}
//********************************************************************
-void ModuleBase_WidgetMultiSelector::updateSelectionList(AttributeSelectionListPtr theList)
+void ModuleBase_WidgetMultiSelector::updateSelectionList()
{
myListControl->clear();
- for (int i = 0; i < theList->size(); i++) {
- AttributeSelectionPtr aAttr = theList->value(i);
- myListControl->addItem(aAttr->namingName().c_str());
+
+ AttributeSelectionListPtr aSelectionListAttr = myFeature->data()->selectionList(attributeID());
+ if (aSelectionListAttr.get()) {
+ for (int i = 0; i < aSelectionListAttr->size(); i++) {
+ AttributeSelectionPtr aAttr = aSelectionListAttr->value(i);
+ myListControl->addItem(aAttr->namingName().c_str());
+ }
+ }
+ else {
+ AttributeRefListPtr aRefListAttr = myFeature->data()->reflist(attributeID());
+ for (int i = 0; i < aRefListAttr->size(); i++) {
+ ObjectPtr anObject = aRefListAttr->object(i);
+ if (anObject.get())
+ myListControl->addItem(anObject->data()->name().c_str());
+ }
}
// We have to call repaint because sometimes the List control is not updated
myListControl->repaint();
#include <GeomAPI_Shape.h>
#include <ModelAPI_Result.h>
-#include <ModelAPI_AttributeSelectionList.h>
#include <NCollection_List.hxx>
#include <TopoDS_Shape.hxx>
/// a shape. If the attribute do not uses the shape, it is empty
virtual QList<ModuleBase_ViewerPrs> getAttributeSelection() const;
- /// Update selection list
- void updateSelectionList(AttributeSelectionListPtr);
+ /// Fills the list control by the attribute values
+ void updateSelectionList();
/// Converts the XML defined type choice to the validator type
/// For example, the "Edges" is converted to "edge"
/// Variable of GeomSelection
int mySelectionCount; // number of elements in the attribute selection list when store
- bool myIsInValidate; // the widget is in validation mode: store is performed, restore is not
bool myIsUseChoice;
};
//********************************************************************
void ModuleBase_WidgetShapeSelector::storeAttributeValue()
{
+ ModuleBase_WidgetValidated::storeAttributeValue();
+
DataPtr aData = myFeature->data();
AttributePtr anAttribute = myFeature->attribute(attributeID());
//********************************************************************
void ModuleBase_WidgetShapeSelector::restoreAttributeValue(bool theValid)
{
+ ModuleBase_WidgetValidated::restoreAttributeValue(theValid);
+
DataPtr aData = myFeature->data();
AttributePtr anAttribute = myFeature->attribute(attributeID());
const Config_WidgetAPI* theData,
const std::string& theParentId)
: ModuleBase_ModelWidget(theParent, theData, theParentId),
- myWorkshop(theWorkshop)
+ myWorkshop(theWorkshop), myIsInValidate(false)
{
}
return myPresentedObject;
}
+//********************************************************************
+void ModuleBase_WidgetValidated::storeAttributeValue()
+{
+ myIsInValidate = true;
+}
+
+//********************************************************************
+void ModuleBase_WidgetValidated::restoreAttributeValue(const bool theValid)
+{
+ myIsInValidate = false;
+}
+
//********************************************************************
bool ModuleBase_WidgetValidated::isValidInFilters(const ModuleBase_ViewerPrs& thePrs)
{
/// Creates a backup of the current values of the attribute
/// It should be realized in the specific widget because of different
/// parameters of the current attribute
- virtual void storeAttributeValue() = 0;
+ virtual void storeAttributeValue();
/// Creates a backup of the current values of the attribute
/// It should be realized in the specific widget because of different
/// parameters of the current attribute
/// \param theValid a boolean flag, if restore happens for valid parameters
- virtual void restoreAttributeValue(const bool theValid) = 0;
+ virtual void restoreAttributeValue(const bool theValid);
/// Checks the widget validity. By default, it returns true.
/// \param theValue a selected presentation in the view
protected:
ModuleBase_IWorkshop* myWorkshop; /// Reference to workshop
+ bool myIsInValidate; // the widget is in validation mode: store is performed, restore is not
private:
ObjectPtr myPresentedObject; /// back up of the filtered object
#include <GeomValidators_Tools.h>
-#include <ModelAPI_Attribute.h>
-#include <ModelAPI_AttributeSelectionList.h>
-
#include <Config_PropManager.h>
#include <AIS_InteractiveContext.hxx>
ObjectPtr PartSet_ExternalObjectsMgr::externalObject(const ObjectPtr& theSelectedObject,
const GeomShapePtr& theShape,
- const CompositeFeaturePtr& theSketch)
+ const CompositeFeaturePtr& theSketch,
+ const bool theTemporary)
{
- ObjectPtr aSelectedObject = PartSet_Tools::findFixedObjectByExternal(theShape->impl<TopoDS_Shape>(),
- theSelectedObject, theSketch);
+ ObjectPtr aSelectedObject = PartSet_Tools::findFixedObjectByExternal(
+ theShape->impl<TopoDS_Shape>(), theSelectedObject, theSketch);
if (!aSelectedObject.get()) {
// Processing of external (non-sketch) object
aSelectedObject = PartSet_Tools::createFixedObjectByExternal(theShape->impl<TopoDS_Shape>(),
- theSelectedObject, theSketch);
- if (aSelectedObject.get())
- myExternalObjects.append(aSelectedObject);
+ theSelectedObject, theSketch, theTemporary);
+ if (aSelectedObject.get()) {
+ if (theTemporary)
+ myExternalObjectValidated = aSelectedObject;
+ else
+ myExternalObjects.append(aSelectedObject);
+ }
}
return aSelectedObject;
}
//********************************************************************
-ObjectPtr PartSet_ExternalObjectsMgr::externalObjectValidated(const ObjectPtr& theSelectedObject,
+/*ObjectPtr PartSet_ExternalObjectsMgr::externalObjectValidated(const ObjectPtr& theSelectedObject,
const GeomShapePtr& theShape,
const CompositeFeaturePtr& theSketch)
{
myExternalObjectValidated = aSelectedObject;
}
return aSelectedObject;
-}
+}*/
//********************************************************************
void PartSet_ExternalObjectsMgr::removeExternal(const CompositeFeaturePtr& theSketch,
const FeaturePtr& theFeature,
- ModuleBase_IWorkshop* theWorkshop)
+ ModuleBase_IWorkshop* theWorkshop,
+ const bool theTemporary)
{
- QObjectPtrList::const_iterator anIt = myExternalObjects.begin(), aLast = myExternalObjects.end();
- for (; anIt != aLast; anIt++) {
- ObjectPtr anObject = *anIt;
- if (anObject.get()) {
- DocumentPtr aDoc = anObject->document();
- FeaturePtr aFeature = ModelAPI_Feature::feature(anObject);
- if (aFeature.get() != NULL) {
- QObjectPtrList anObjects;
- anObjects.append(aFeature);
- // the external feature should be removed with all references, sketch feature should be ignored
- std::set<FeaturePtr> anIgnoredFeatures;
- // the current feature should be ignored, because it can use the external feature in the
- // attributes and, therefore have a references to it. So, the delete functionality tries
- // to delete this feature. Test case is creation of a constraint on external point,
- // use in this control after an external point, the point of the sketch.
- anIgnoredFeatures.insert(theFeature);
- workshop(theWorkshop)->deleteFeatures(anObjects, anIgnoredFeatures);
- }
+ if (theTemporary)
+ removeExternalObject(myExternalObjectValidated, theSketch, theFeature, theWorkshop);
+ else{
+ QObjectPtrList::const_iterator anIt = myExternalObjects.begin(), aLast = myExternalObjects.end();
+ for (; anIt != aLast; anIt++) {
+ ObjectPtr anObject = *anIt;
+ removeExternalObject(anObject, theSketch, theFeature, theWorkshop);
}
- //removeExternalObject(anObject, theSketch, theFeature);
+ myExternalObjects.clear();
}
- myExternalObjects.clear();
}
//********************************************************************
}
//********************************************************************
-void PartSet_ExternalObjectsMgr::removeExternalValidated(const CompositeFeaturePtr& theSketch,
+/*void PartSet_ExternalObjectsMgr::removeExternalValidated(const CompositeFeaturePtr& theSketch,
const FeaturePtr& theFeature,
ModuleBase_IWorkshop* theWorkshop)
{
// TODO(nds): unite with removeExternal(), remove parameters
removeExternalObject(myExternalObjectValidated, theSketch, theFeature, theWorkshop);
myExternalObjectValidated = ObjectPtr();
-}
+}*/
void PartSet_ExternalObjectsMgr::removeExternalObject(const ObjectPtr& theObject,
const CompositeFeaturePtr& theSketch,
/// \param theSelectedObject an object
/// \param theShape a selected shape, which is used in the selection attribute
/// \param theSketch a current sketch
+ /// \param theTemporary the created external object is temporary, execute is not performed for it
/// \return the object
ObjectPtr externalObject(const ObjectPtr& theSelectedObject, const GeomShapePtr& theShape,
- const CompositeFeaturePtr& theSketch);
+ const CompositeFeaturePtr& theSketch, const bool theTemporary = false);
- ObjectPtr externalObjectValidated(const ObjectPtr& theSelectedObject, const GeomShapePtr& theShape,
- const CompositeFeaturePtr& theSketch);
+ //ObjectPtr externalObjectValidated(const ObjectPtr& theSelectedObject, const GeomShapePtr& theShape,
+ // const CompositeFeaturePtr& theSketch);
// Removes the external presentation from the model
/// \param theSketch a current sketch
/// \param theFeature a current feature
/// \param theFeature a current workshop
+ /// \param theTemporary if true, a temporary external object is removed overwise all ext objects
void removeExternal(const CompositeFeaturePtr& theSketch,
const FeaturePtr& theFeature,
- ModuleBase_IWorkshop* theWorkshop);
+ ModuleBase_IWorkshop* theWorkshop,
+ const bool theTemporary);
- void removeExternalValidated(const CompositeFeaturePtr& theSketch,
- const FeaturePtr& theFeature,
- ModuleBase_IWorkshop* theWorkshop);
+ //void removeExternalVali+dated(const CompositeFeaturePtr& theSketch,
+ // const FeaturePtr& theFeature,
+ // ModuleBase_IWorkshop* theWorkshop);
void removeUnusedExternalObjects(const QObjectPtrList& theIgnoreObjects,
const CompositeFeaturePtr& theSketch,
#include <ModelAPI_Session.h>
#include <ModelAPI_ShapeValidator.h>
#include <ModelAPI_ResultBody.h>
-#include <ModelAPI_ResultCompSolid.h>
#include <GeomDataAPI_Point2D.h>
#include <GeomDataAPI_Point.h>
#include <QDebug>
#endif
-#define DEBUG_COMPOSOLID
-
-
/*!Create and return new instance of XGUI_Module*/
extern "C" PARTSET_EXPORT ModuleBase_IModule* createModule(ModuleBase_IWorkshop* theWshop)
{
bool PartSet_Module::canDisplayObject(const ObjectPtr& theObject) const
{
-#ifdef DEBUG_COMPOSOLID
- ResultCompSolidPtr aCompSolid = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>
- (theObject);
- if (aCompSolid.get() && aCompSolid->numberOfSubs() > 0)
- return false;
-#endif
-
// the sketch manager put the restriction to the objects display
return mySketchMgr->canDisplayObject(theObject);
}
#include <ModelAPI_AttributeReference.h>
#include <ModelAPI_AttributeSelection.h>
#include <ModelAPI_AttributeSelectionList.h>
+#include <ModelAPI_AttributeRefList.h>
+
#include <GeomValidators_Tools.h>
continue;
TopoDS_Shape aShape = aGeomShape->impl<TopoDS_Shape>();
// change deviation coefficient to provide more precise circle
- //aDrawer->SetDeviationCoefficient(ModuleBase_Tools::defaultDeviationCoefficient());
+ ModuleBase_Tools::setDefaultDeviationCoefficient(aShape, aDrawer);
StdPrs_WFDeflectionShape::Add(thePresentation, aShape, aDrawer);
}
}
addValue(aResult, aShape, myFeature, theObjectShapes);
}
}
+ if (anAttrType == ModelAPI_AttributeRefList::typeId()) {
+ std::shared_ptr<ModelAPI_AttributeRefList> aCurSelList =
+ std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(anAttribute);
+ for (int i = 0; i < aCurSelList->size(); i++) {
+ GeomShapePtr aShape;
+ addValue(aCurSelList->object(i), aShape, myFeature, theObjectShapes);
+ }
+ }
else {
ObjectPtr anObject;
GeomShapePtr aShape;
std::string anAttrType = theAttribute->attributeType();
return anAttrType == ModelAPI_AttributeSelectionList::typeId() ||
+ anAttrType == ModelAPI_AttributeRefList::typeId() ||
anAttrType == ModelAPI_AttributeRefAttr::typeId() ||
anAttrType == ModelAPI_AttributeSelection::typeId() ||
anAttrType == ModelAPI_AttributeReference::typeId();
}
ResultPtr PartSet_Tools::createFixedObjectByExternal(const TopoDS_Shape& theShape,
- const ObjectPtr& theObject,
- CompositeFeaturePtr theSketch)
+ const ObjectPtr& theObject,
+ CompositeFeaturePtr theSketch,
+ const bool theTemporary)
{
if (theShape.ShapeType() == TopAbs_EDGE) {
Standard_Real aStart, aEnd;
anEdge->setImpl(new TopoDS_Shape(theShape));
anAttr->setValue(aRes, anEdge);
+ if (!theTemporary) {
+ aMyFeature->execute();
- aMyFeature->execute();
-
- // fix this edge
- FeaturePtr aFix = theSketch->addFeature(SketchPlugin_ConstraintRigid::ID());
- aFix->data()->refattr(SketchPlugin_Constraint::ENTITY_A())->
- setObject(aMyFeature->lastResult());
-
+ // fix this edge
+ FeaturePtr aFix = theSketch->addFeature(SketchPlugin_ConstraintRigid::ID());
+ aFix->data()->refattr(SketchPlugin_Constraint::ENTITY_A())->
+ setObject(aMyFeature->lastResult());
+ }
return aMyFeature->lastResult();
}
}
aVert->setImpl(new TopoDS_Shape(theShape));
anAttr->setValue(aRes, aVert);
- aMyFeature->execute();
-
- // fix this edge
- FeaturePtr aFix = theSketch->addFeature(SketchPlugin_ConstraintRigid::ID());
- aFix->data()->refattr(SketchPlugin_Constraint::ENTITY_A())->
- setObject(aMyFeature->lastResult());
+ if (theTemporary) {
+ aMyFeature->execute();
+ // fix this edge
+ FeaturePtr aFix = theSketch->addFeature(SketchPlugin_ConstraintRigid::ID());
+ aFix->data()->refattr(SketchPlugin_Constraint::ENTITY_A())->
+ setObject(aMyFeature->lastResult());
+ }
return aMyFeature->lastResult();
}
}
/// \param theShape an edge
/// \param theObject a selected result object
/// \param theSketch a sketch feature
+ /// \param theTemporary the created external object is temporary, execute is not performed for it
/// \return result of created feature
static ResultPtr createFixedObjectByExternal(const TopoDS_Shape& theShape,
const ObjectPtr& theObject,
- CompositeFeaturePtr theSketch);
+ CompositeFeaturePtr theSketch,
+ const bool theTemporary = false);
/// Checks whether the list of selected presentations contains the given one
/// \param theSelected a list of presentations
#include <ModelAPI_AttributeSelection.h>
#include <ModelAPI_AttributeReference.h>
#include <ModelAPI_AttributeSelectionList.h>
+#include <ModelAPI_AttributeRefList.h>
#include <ModelAPI_Object.h>
#include <ModelAPI_Session.h>
}
}
}
+ else if (anAttrType == ModelAPI_AttributeRefList::typeId()) {
+ std::shared_ptr<ModelAPI_AttributeRefList> aCurSelList =
+ std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(theAttribute);
+ anAttrs = aFeature->data()->attributes(ModelAPI_AttributeRefList::typeId());
+ if (anAttrs.size() > 0) {
+ std::list<std::shared_ptr<ModelAPI_Attribute>>::iterator anAttrItr = anAttrs.begin();
+ for (; anAttrItr != anAttrs.end(); anAttrItr++){
+ if ((*anAttrItr).get() && (*anAttrItr)->id() != theAttribute->id()){
+ std::shared_ptr<ModelAPI_AttributeRefList> aRefSelList =
+ std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(*anAttrItr);
+ for (int i = 0; i < aCurSelList->size(); i++) {
+ ObjectPtr aCurSelObject = aCurSelList->object(i);
+ for (int j = 0; j < aRefSelList->size(); j++) {
+ if (aCurSelObject == aRefSelList->object(j)) {
+ return false;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
return !featureHasReferences(theAttribute);
}
if (anAttributeType == ModelAPI_AttributeSelectionList::typeId()) {
AttributeSelectionListPtr aSelectionListAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
- // it filters only selection list attributes
- std::string aType = aSelectionListAttr->selectionType().c_str();
// all context objects should be sketch entities
- int aSize = aSelectionListAttr->size();
- for (int i = 0; i < aSelectionListAttr->size() && isSketchEntities; i++) {
+ for (int i = 0, aSize = aSelectionListAttr->size(); i < aSize && isSketchEntities; i++) {
AttributeSelectionPtr aSelectAttr = aSelectionListAttr->value(i);
ObjectPtr anObject = aSelectAttr->context();
// a context of the selection attribute is a feature result. It can be a case when the result
}
}
}
+ if (anAttributeType == ModelAPI_AttributeRefList::typeId()) {
+ AttributeRefListPtr aRefListAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(theAttribute);
+ // all context objects should be sketch entities
+ for (int i = 0, aSize = aRefListAttr->size(); i < aSize && isSketchEntities; i++) {
+ ObjectPtr anObject = aRefListAttr->object(i);
+ // a context of the selection attribute is a feature result. It can be a case when the result
+ // of the feature is null, e.g. the feature is modified and has not been executed yet.
+ // The validator returns an invalid result here. The case is an extrusion built on a sketch
+ // feature. A new sketch element creation leads to an empty result.
+ if (!anObject.get())
+ isSketchEntities = false;
+ else {
+ FeaturePtr aFeature = ModelAPI_Feature::feature(anObject);
+ isSketchEntities = anEntityKinds.find(aFeature->getKind()) != anEntityKinds.end();
+ }
+ }
+ }
if (anAttributeType == ModelAPI_AttributeRefAttr::typeId()) {
std::shared_ptr<ModelAPI_AttributeRefAttr> aRef =
std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
#include "PartSet_WidgetMultiSelector.h"
#include <ModelAPI_AttributeRefAttr.h>
+#include <ModelAPI_AttributeSelectionList.h>
+#include <ModelAPI_AttributeRefList.h>
#include <ModelAPI_Session.h>
#include <ModelAPI_Validator.h>
// TODO(nds): unite with externalObject(), remove parameters
//myFeature->execute();
- DataPtr aData = myFeature->data();
- AttributeSelectionListPtr aSelectionListAttr =
- std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(aData->attribute(attributeID()));
-
QObjectPtrList aListOfAttributeObjects;
- for (int i = 0; i < aSelectionListAttr->size(); i++) {
- AttributeSelectionPtr anAttr = aSelectionListAttr->value(i);
- aListOfAttributeObjects.append(anAttr->context());
+
+ AttributePtr anAttribute = myFeature->data()->attribute(attributeID());
+ if (anAttribute->attributeType() == ModelAPI_AttributeSelectionList::typeId()) {
+ AttributeSelectionListPtr aSelectionListAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(anAttribute);
+ for (int i = 0; i < aSelectionListAttr->size(); i++) {
+ AttributeSelectionPtr anAttr = aSelectionListAttr->value(i);
+ aListOfAttributeObjects.append(anAttr->context());
+ }
}
+ else if (anAttribute->attributeType() == ModelAPI_AttributeRefList::typeId()) {
+ AttributeRefListPtr aRefListAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(anAttribute);
+ for (int i = 0; i < aRefListAttr->size(); i++) {
+ aListOfAttributeObjects.append(aRefListAttr->object(i));
+ }
+ }
+
myExternalObjectMgr->removeUnusedExternalObjects(aListOfAttributeObjects, sketch(), myFeature);
}
return aSucceed;
{
ModuleBase_WidgetMultiSelector::restoreAttributeValue(theValid);
- myExternalObjectMgr->removeExternalValidated(sketch(), myFeature, myWorkshop);
+ myExternalObjectMgr->removeExternal/*Validated*/(sketch(), myFeature, myWorkshop, true);
}
void PartSet_WidgetMultiSelector::getGeomSelection(const ModuleBase_ViewerPrs& thePrs,
aShape = aResult->shape();
}
if (aShape.get() != NULL && !aShape->isNull()) {
- if (myIsInValidate)
- theObject = myExternalObjectMgr->externalObjectValidated(theObject, aShape, sketch());
- else
- theObject = myExternalObjectMgr->externalObject(theObject, aShape, sketch());
+ //if (myIsInValidate)
+ // theObject = myExternalObjectMgr->externalObjectValidated(theObject, aShape, sketch());
+ //else
+ theObject = myExternalObjectMgr->externalObject(theObject, aShape, sketch(), myIsInValidate);
}
}
}
aShape = aResult->shape();
}
if (aShape.get() != NULL && !aShape->isNull())
- theObject = myExternalObjectMgr->externalObject(theObject, aShape, sketch());
+ theObject = myExternalObjectMgr->externalObject(theObject, aShape, sketch(), myIsInValidate);
}
}
void PartSet_WidgetShapeSelector::restoreAttributeValue(const bool theValid)
{
ModuleBase_WidgetShapeSelector::restoreAttributeValue(theValid);
- myExternalObjectMgr->removeExternal(sketch(), myFeature, myWorkshop);
+ myExternalObjectMgr->removeExternal(sketch(), myFeature, myWorkshop, true);
}
//********************************************************************
{
CompositeFeaturePtr aSketch = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(myFeature);
return PartSet_Tools::sketchPlane(aSketch);
-
}
bool PartSet_WidgetSketchLabel::focusTo()
void PartSet_WidgetSketchLabel::storeAttributeValue()
{
+ ModuleBase_WidgetValidated::storeAttributeValue();
}
void PartSet_WidgetSketchLabel::restoreAttributeValue(const bool theValid)
{
+ ModuleBase_WidgetValidated::restoreAttributeValue(theValid);
+
// it is not necessary to save the previous plane value because the plane is chosen once
DataPtr aData = feature()->data();
AttributeSelectionPtr aSelAttr = std::dynamic_pointer_cast<ModelAPI_AttributeSelection>
#include <ModelAPI_Data.h>
#include <ModelAPI_ResultConstruction.h>
#include <ModelAPI_AttributeRefList.h>
-#include <ModelAPI_AttributeSelectionList.h>
#include <ModelAPI_Events.h>
#include <ModelAPI_Session.h>
#include <ModelAPI_Validator.h>
data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::typeId());
data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), ModelAPI_AttributeRefList::typeId());
data()->addAttribute(SketchPlugin_Constraint::ENTITY_C(), ModelAPI_AttributeRefList::typeId());
- AttributeSelectionListPtr aSelection =
- std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(data()->addAttribute(
- SketchPlugin_ConstraintMirror::MIRROR_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()));
- aSelection->setSelectionType("EDGE");
+ data()->addAttribute(SketchPlugin_ConstraintMirror::MIRROR_LIST_ID(), ModelAPI_AttributeRefList::typeId());
ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), SketchPlugin_Constraint::ENTITY_B());
ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), SketchPlugin_Constraint::ENTITY_C());
}
void SketchPlugin_ConstraintMirror::execute()
{
- AttributeSelectionListPtr aMirrorObjectRefs =
- selectionList(SketchPlugin_ConstraintMirror::MIRROR_LIST_ID());
+ AttributeRefListPtr aMirrorObjectRefs = reflist(SketchPlugin_ConstraintMirror::MIRROR_LIST_ID());
// Wait all objects being created, then send update events
static Events_ID anUpdateEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED);
std::vector<bool> isUsed(anInitialList.size(), false);
// add new items to the list
for(int anInd = 0; anInd < aMirrorObjectRefs->size(); anInd++) {
- std::shared_ptr<ModelAPI_AttributeSelection> aSelect = aMirrorObjectRefs->value(anInd);
+ ObjectPtr anObject = aMirrorObjectRefs->object(anInd);
std::list<ObjectPtr>::const_iterator anIt = anInitialList.begin();
std::vector<bool>::iterator aUsedIt = isUsed.begin();
for (; anIt != anInitialList.end(); anIt++, aUsedIt++)
- if (*anIt == aSelect->context()) {
+ if (*anIt == anObject) {
*aUsedIt = true;
break;
}
if (anIt == anInitialList.end())
- aRefListOfShapes->append(aSelect->context());
+ aRefListOfShapes->append(anObject);
}
// remove unused items
std::list<ObjectPtr>::iterator anInitIter = anInitialList.begin();
void SketchPlugin_ConstraintMirror::attributeChanged(const std::string& theID)
{
if (theID == MIRROR_LIST_ID()) {
- AttributeSelectionListPtr aMirrorObjectRefs = selectionList(MIRROR_LIST_ID());
+ AttributeRefListPtr aMirrorObjectRefs = reflist(MIRROR_LIST_ID());
if (aMirrorObjectRefs->size() == 0) {
// Clear list of objects
AttributeRefListPtr aRefListOfMirrored = std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(
#include <ModelAPI_Data.h>
#include <ModelAPI_ResultConstruction.h>
#include <ModelAPI_AttributeRefList.h>
-#include <ModelAPI_AttributeSelectionList.h>
#include <ModelAPI_Events.h>
#include <ModelAPI_Session.h>
#include <ModelAPI_Validator.h>
data()->addAttribute(NUMBER_OF_COPIES_ID(), ModelAPI_AttributeInteger::typeId());
data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefList::typeId());
data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), ModelAPI_AttributeRefList::typeId());
- AttributeSelectionListPtr aSelection =
- std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(data()->addAttribute(
- ROTATION_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()));
- aSelection->setSelectionType("EDGE");
+ data()->addAttribute(ROTATION_LIST_ID(), ModelAPI_AttributeRefList::typeId());
ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), SketchPlugin_Constraint::ENTITY_A());
ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), SketchPlugin_Constraint::ENTITY_B());
}
return;
}
- AttributeSelectionListPtr aRotationObjectRefs = selectionList(ROTATION_LIST_ID());
+ AttributeRefListPtr aRotationObjectRefs = reflist(ROTATION_LIST_ID());
int aNbCopies = integer(NUMBER_OF_COPIES_ID())->value();
// Obtain center and angle of rotation
aRefListOfRotated->size() / aRefListOfShapes->size() - 1 : 0;
std::list<ObjectPtr> anInitialList = aRefListOfShapes->list();
std::list<ObjectPtr> aTargetList = aRefListOfRotated->list();
- std::list<ResultPtr> anAddition;
+ std::list<ObjectPtr> anAddition;
std::vector<bool> isUsed(anInitialList.size(), false);
// collect new items and check the items to remove
for(int anInd = 0; anInd < aRotationObjectRefs->size(); anInd++) {
- std::shared_ptr<ModelAPI_AttributeSelection> aSelect = aRotationObjectRefs->value(anInd);
+ ObjectPtr anObject = aRotationObjectRefs->object(anInd);
std::list<ObjectPtr>::const_iterator anIt = anInitialList.begin();
std::vector<bool>::iterator aUsedIt = isUsed.begin();
for (; anIt != anInitialList.end(); anIt++, aUsedIt++)
- if (*anIt == aSelect->context()) {
+ if (*anIt == anObject) {
*aUsedIt = true;
break;
}
if (anIt == anInitialList.end())
- anAddition.push_back(aSelect->context());
+ anAddition.push_back(anObject);
}
// remove unused items
std::list<ObjectPtr>::iterator anInitIter = anInitialList.begin();
aRefListOfRotated->append(*aTargetIter);
}
// add new items
- std::list<ResultPtr>::iterator anAddIter = anAddition.begin();
+ std::list<ObjectPtr>::iterator anAddIter = anAddition.begin();
for (; anAddIter != anAddition.end(); anAddIter++) {
aRefListOfShapes->append(*anAddIter);
aRefListOfRotated->append(*anAddIter);
void SketchPlugin_MultiRotation::attributeChanged(const std::string& theID)
{
if (theID == ROTATION_LIST_ID()) {
- AttributeSelectionListPtr aRotationObjectRefs = selectionList(ROTATION_LIST_ID());
+ AttributeRefListPtr aRotationObjectRefs = reflist(ROTATION_LIST_ID());
if (aRotationObjectRefs->size() == 0) {
int aNbCopies = integer(NUMBER_OF_COPIES_ID())->value();
// Clear list of objects
#include <ModelAPI_Data.h>
#include <ModelAPI_ResultConstruction.h>
#include <ModelAPI_AttributeRefList.h>
-#include <ModelAPI_AttributeSelectionList.h>
#include <ModelAPI_Events.h>
#include <ModelAPI_Session.h>
#include <ModelAPI_Validator.h>
data()->addAttribute(NUMBER_OF_COPIES_ID(), ModelAPI_AttributeInteger::typeId());
data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefList::typeId());
data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), ModelAPI_AttributeRefList::typeId());
- AttributeSelectionListPtr aSelection =
- std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(data()->addAttribute(
- TRANSLATION_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()));
- aSelection->setSelectionType("EDGE");
+ data()->addAttribute(TRANSLATION_LIST_ID(), ModelAPI_AttributeRefList::typeId());
ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), SketchPlugin_Constraint::ENTITY_A());
ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), SketchPlugin_Constraint::ENTITY_B());
}
return;
}
- AttributeSelectionListPtr aTranslationObjectRefs = selectionList(TRANSLATION_LIST_ID());
+ AttributeRefListPtr aTranslationObjectRefs = reflist(TRANSLATION_LIST_ID());
int aNbCopies = integer(NUMBER_OF_COPIES_ID())->value();
// Calculate shift vector
aRefListOfTranslated->size() / aRefListOfShapes->size() - 1 : 0;
std::list<ObjectPtr> anInitialList = aRefListOfShapes->list();
std::list<ObjectPtr> aTargetList = aRefListOfTranslated->list();
- std::list<ResultPtr> anAddition;
+ std::list<ObjectPtr> anAddition;
std::vector<bool> isUsed(anInitialList.size(), false);
// collect new items and check the items to remove
for(int anInd = 0; anInd < aTranslationObjectRefs->size(); anInd++) {
- std::shared_ptr<ModelAPI_AttributeSelection> aSelect = aTranslationObjectRefs->value(anInd);
+ //std::shared_ptr<ModelAPI_AttributeSelection> aSelect = aTranslationObjectRefs->value(anInd);
+ ObjectPtr anObject = aTranslationObjectRefs->object(anInd);
std::list<ObjectPtr>::const_iterator anIt = anInitialList.begin();
std::vector<bool>::iterator aUsedIt = isUsed.begin();
for (; anIt != anInitialList.end(); anIt++, aUsedIt++)
- if (*anIt == aSelect->context()) {
+ if (*anIt == anObject) {
*aUsedIt = true;
break;
}
if (anIt == anInitialList.end())
- anAddition.push_back(aSelect->context());
+ anAddition.push_back(anObject);
}
// remove unused items
std::list<ObjectPtr>::iterator anInitIter = anInitialList.begin();
aRefListOfTranslated->append(*aTargetIter);
}
// add new items
- std::list<ResultPtr>::iterator anAddIter = anAddition.begin();
+ std::list<ObjectPtr>::iterator anAddIter = anAddition.begin();
for (; anAddIter != anAddition.end(); anAddIter++) {
aRefListOfShapes->append(*anAddIter);
aRefListOfTranslated->append(*anAddIter);
void SketchPlugin_MultiTranslation::attributeChanged(const std::string& theID)
{
if (theID == TRANSLATION_LIST_ID()) {
- AttributeSelectionListPtr aTranslationObjectRefs = selectionList(TRANSLATION_LIST_ID());
+ AttributeRefListPtr aTranslationObjectRefs = reflist(TRANSLATION_LIST_ID());
if (aTranslationObjectRefs->size() == 0) {
int aNbCopies = integer(NUMBER_OF_COPIES_ID())->value();
// Clear list of objects
std::string& theError) const
{
FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theAttribute->owner());
- AttributeSelectionListPtr aSelAttr =
- std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
+ AttributeRefListPtr aSelAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(theAttribute);
if (!aSelAttr)
return false;
std::list<ObjectPtr> aMirroredObjects = aRefListOfMirrored->list();
for(int anInd = 0; anInd < aSelAttr->size(); anInd++) {
- std::shared_ptr<ModelAPI_AttributeSelection> aSelect = aSelAttr->value(anInd);
+ ObjectPtr aSelObject = aSelAttr->object(anInd);
std::list<ObjectPtr>::iterator aMirIter = aMirroredObjects.begin();
for (; aMirIter != aMirroredObjects.end(); aMirIter++)
- if (aSelect->context() == *aMirIter)
+ if (aSelObject == *aMirIter)
return false;
}
return true;
std::string& theError) const
{
FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theAttribute->owner());
- AttributeSelectionListPtr aSelAttr =
- std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
+ AttributeRefListPtr aSelAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(theAttribute);
if (!aSelAttr)
return false;
std::list<ObjectPtr>::iterator anObjIter;
for(int anInd = 0; anInd < aSelAttr->size(); anInd++) {
- std::shared_ptr<ModelAPI_AttributeSelection> aSelect = aSelAttr->value(anInd);
+ ObjectPtr aSelObject = aSelAttr->object(anInd);
anObjIter = anInitialObjects.begin();
for (; anObjIter != anInitialObjects.end(); anObjIter++)
- if (aSelect->context() == *anObjIter)
+ if (aSelObject == *anObjIter)
break;
if (anObjIter != anInitialObjects.end())
continue;
anObjIter = aCopiedObjects.begin();
for (; anObjIter != aCopiedObjects.end(); anObjIter++)
- if (aSelect->context() == *anObjIter)
+ if (aSelObject == *anObjIter)
return false;
}
return true;
#include <ModelAPI_Data.h>
#include <ModelAPI_ResultBody.h>
#include <ModelAPI_ResultCompSolid.h>
+#include <ModelAPI_Tools.h>
#include <Events_Loop.h>
#include <Events_Error.h>
#include <iostream>
#endif
-//#define DEBUG_CANDISPLAY
//#define DEBUG_FEATURE_CREATED
//#define DEBUG_FEATURE_REDISPLAY
// in order to avoid the check whether the object can be redisplayed, the exact method
// of redisplay is called. This modification is made in order to have the line is updated
// by creation of a horizontal constraint on the line by preselection
- /*ResultCompSolidPtr aCompSolid = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>
- (aObj);
- if (aCompSolid.get() && aCompSolid->numberOfSubs() > 0) {
+ if (ModelAPI_Tools::hasSubResults(std::dynamic_pointer_cast<ModelAPI_Result>(aObj))) {
aDisplayer->erase(aObj, false);
- }*/
-
- aDisplayer->redisplay(aObj, false);
- // Deactivate object of current operation from selection
- aWorkshop->deactivateActiveObject(aObj, false);
+ }
+ else {
+ aDisplayer->redisplay(aObj, false);
+ // Deactivate object of current operation from selection
+ aWorkshop->deactivateActiveObject(aObj, false);
+ }
} else { // display object if the current operation has it
if (displayObject(aObj)) {
// Deactivate object of current operation from selection
if (!aHide) {
// setDisplayed has to be called in order to synchronize internal state of the object
// with list of displayed objects
-#ifdef DEBUG_CANDISPLAY
- if (displayObject(anObject)/*myWorkshop->module()->canDisplayObject(anObject)*/) {
- anObject->setDisplayed(true);
- //isDisplayed = displayObject(anObject);
-#else
- if (myWorkshop->module()->canDisplayObject(anObject)) {
+ if (displayObject(anObject)) {
anObject->setDisplayed(true);
- isDisplayed = displayObject(anObject);
-#endif
} else
anObject->setDisplayed(false);
}
//**************************************************************
bool XGUI_WorkshopListener::displayObject(ObjectPtr theObj)
{
- XGUI_Workshop* aWorkshop = workshop();
- if (!aWorkshop->module()->canDisplayObject(theObj))
+ XGUI_Workshop* aWorkshop = workshop();
+ if (ModelAPI_Tools::hasSubResults(std::dynamic_pointer_cast<ModelAPI_Result>(theObj)) ||
+ !aWorkshop->module()->canDisplayObject(theObj))
return false;
XGUI_Displayer* aDisplayer = aWorkshop->displayer();