ENDIF(CMAKE_COMPILER_IS_GNUCC)
ENDIF(UNIX)
-IF(CMAKE_BUILD_TYPE MATCHES RELEASE)
+#IF(CMAKE_BUILD_TYPE MATCHES Release)
ADD_SUBDIRECTORY (doc)
-ENDIF(CMAKE_BUILD_TYPE MATCHES RELEASE)
+#ENDIF(CMAKE_BUILD_TYPE MATCHES Release)
ADD_SUBDIRECTORY (src/Config)
ADD_SUBDIRECTORY (src/Events)
ADD_SUBDIRECTORY (src/Model)
@SET PATH=%PDIR%\swig-2.0.9\bin;%PATH%
@REM -------------------------
-@REM BOOST
-@REM @SET BOOST_ROOT_DIR=%PDIR%\boost-1.52.0
-@REM @SET PATH=%BOOST_ROOT_DIR%\lib;%PATH%
-@REM -------------------------
-
@REM -------------------------
@SET SOLVESPACE_ROOT_DIR=%PDIR%\solvespace-2.0
@SET PATH=%SOLVESPACE_ROOT_DIR%\lib;%PATH%
@SET PATH=%PDIR%\pthreads-2.9.1\lib;%PATH%
@REM -------------------------
+@REM -------------------------
+@REM DOXYGEN
+@SET DOXYGEN_ROOT_DIR=%PDIR%\doxygen-1.8.3.1
+@SET PATH=%DOXYGEN_ROOT_DIR%\bin;%PATH%
+@REM -------------------------
@REM -------------------------
@REM SUIT
{
thePrs->setColor(0, 0, 0);
thePrs->setLineStyle(3);
+ thePrs->redisplay();
}
\ No newline at end of file
icon=":icons/point.png"
tooltip="Select a first point"
shape_types="vertex">
+ <selection_filter id="NoConstructionSubShapesFilter"/>
</shape_selector>
<shape_selector id="secondPoint"
label="Second point"
icon=":icons/point.png"
tooltip="Select a second point"
shape_types="vertex">
+ <selection_filter id="NoConstructionSubShapesFilter"/>
+ <validator id="PartSet_DifferentObjects"/>
</shape_selector>
</source>
}
}
+void GeomAPI_AISObject::redisplay()
+{
+ Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
+ if (!anAIS.IsNull()) {
+ Handle(AIS_InteractiveContext) aContext = anAIS->GetContext();
+ aContext->Redisplay(anAIS, false);
+ }
+}
void GeomAPI_AISObject::setColor(const int& theColor)
void createFixed(std::shared_ptr<GeomAPI_Shape> theShape,
std::shared_ptr<GeomAPI_Pln> thePlane);
+ /** \brief Redisplays the current AIS object in the context
+ */
+ void redisplay();
+
/** \brief Assigns the color for the shape
* \param[in] theColor index of the color
*/
#include <GeomAlgoAPI_PointBuilder.h>
#include <GeomAPI_Pnt.h>
#include <GeomAPI_Shape.h>
+#include <GeomAPI_Vertex.h>
#include <BRepBuilderAPI_MakeVertex.hxx>
#include <BRep_Tool.hxx>
#include <TopoDS_Vertex.hxx>
const gp_Pnt& aPnt = thePoint->impl<gp_Pnt>();
BRepBuilderAPI_MakeVertex aMaker(aPnt);
TopoDS_Vertex aVertex = aMaker.Vertex();
- std::shared_ptr<GeomAPI_Shape> aRes(new GeomAPI_Shape);
+ std::shared_ptr<GeomAPI_Vertex> aRes(new GeomAPI_Vertex);
aRes->setImpl(new TopoDS_Shape(aVertex));
return aRes;
}
#include <Model_ResultBody.h>
#include <Model_ResultGroup.h>
#include <ModelAPI_Validator.h>
+#include <ModelAPI_CompositeFeature.h>
#include <Events_Loop.h>
#include <Events_Error.h>
}
}
// update results of thefeatures (after features created because they may be connected, like sketch and sub elements)
+ std::list<FeaturePtr> aComposites; // composites must be updated after their subs (issue 360)
TDF_ChildIDIterator aLabIter2(featuresLabel(), TDataStd_Comment::GetID());
for (; aLabIter2.More(); aLabIter2.Next()) {
TDF_Label aFeatureLabel = aLabIter2.Value()->Label();
if (myObjs.IsBound(aFeatureLabel)) { // a new feature is inserted
FeaturePtr aFeature = myObjs.Find(aFeatureLabel);
+ if (std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aFeature).get())
+ aComposites.push_back(aFeature);
updateResults(aFeature);
}
}
+ std::list<FeaturePtr>::iterator aComposite = aComposites.begin();
+ for(; aComposite != aComposites.end(); aComposite++) {
+ updateResults(*aComposite);
+ }
// check all features are checked: if not => it was removed
NCollection_DataMap<TDF_Label, FeaturePtr>::Iterator aFIter(myObjs);
#include <Config_AttributeMessage.h>
#include <Config_ValidatorMessage.h>
#include <Config_ModuleReader.h>
+#include <ModelAPI_ResultPart.h>
#include <TDF_CopyTool.hxx>
#include <TDF_DataSet.hxx>
ModelAPI_Session::setSession(std::shared_ptr<ModelAPI_Session>(this));
// register the configuration reading listener
Events_Loop* aLoop = Events_Loop::loop();
- static const Events_ID kFeatureEvent = Events_Loop::eventByName(Config_FeatureMessage::MODEL_EVENT());
+ static const Events_ID kFeatureEvent =
+ Events_Loop::eventByName(Config_FeatureMessage::MODEL_EVENT());
aLoop->registerListener(this, kFeatureEvent);
aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_CREATED), 0, true);
aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_UPDATED), 0, true);
void Model_Session::processEvent(const std::shared_ptr<Events_Message>& theMessage)
{
- static const Events_ID kFeatureEvent = Events_Loop::eventByName(Config_FeatureMessage::MODEL_EVENT());
+ static const Events_ID kFeatureEvent =
+ Events_Loop::eventByName(Config_FeatureMessage::MODEL_EVENT());
static const Events_ID kValidatorEvent = Events_Loop::eventByName(EVENT_VALIDATOR_LOADED);
if (theMessage->eventID() == kFeatureEvent) {
const std::shared_ptr<Config_FeatureMessage> aMsg =
} else { // create/update/delete
if (myCheckTransactions && !isOperation())
Events_Error::send("Modification of data structure outside of the transaction");
+ // if part is deleted, make the root as the current document (on undo of Parts creations)
+ static const Events_ID kDeletedEvent = Events_Loop::eventByName(EVENT_OBJECT_DELETED);
+ if (theMessage->eventID() == kDeletedEvent) {
+ std::shared_ptr<ModelAPI_ObjectDeletedMessage> aDeleted =
+ std::dynamic_pointer_cast<ModelAPI_ObjectDeletedMessage>(theMessage);
+ if (aDeleted &&
+ aDeleted->groups().find(ModelAPI_ResultPart::group()) != aDeleted->groups().end())
+ {
+ setActiveDocument(moduleDocument());
+ }
+ }
}
}
SET(PROJECT_HEADERS
ModuleBase.h
ModuleBase_Filter.h
+ ModuleBase_FilterCustom.h
ModuleBase_FilterFace.h
ModuleBase_FilterFactory.h
ModuleBase_FilterLinearEdge.h
- ModuleBase_FilterMulti.h
- ModuleBase_FilterShapeType.h
+ ModuleBase_FilterMulti.h
+ ModuleBase_FilterNoConsructionSubShapes.h
+ ModuleBase_FilterShapeType.h
ModuleBase_Tools.h
ModuleBase_IModule.h
ModuleBase_Operation.h
SET(PROJECT_SOURCES
ModuleBase_Filter.cpp
+ ModuleBase_FilterCustom.cpp
ModuleBase_FilterFace.cpp
ModuleBase_FilterFactory.cpp
ModuleBase_FilterLinearEdge.cpp
- ModuleBase_FilterMulti.cpp
- ModuleBase_FilterShapeType.cpp
+ ModuleBase_FilterMulti.cpp
+ ModuleBase_FilterNoConsructionSubShapes.cpp
+ ModuleBase_FilterShapeType.cpp
ModuleBase_Tools.cpp
ModuleBase_IModule.cpp
ModuleBase_IWorkshop.cpp
)
SET(PROJECT_LIBRARIES
- Config
- ModelAPI
+ Config
+ ModelAPI
GeomAPI
GeomAlgoAPI
- ${QT_LIBRARIES}
+ ${QT_LIBRARIES}
${CAS_VIEWER}
${CAS_KERNEL}
${CAS_SHAPE}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: ModuleBase_FilterCustom.cpp
+// Created: 10 Dec 2014
+// Author: Natalia ERMOLAEVA
+
+
+#include "ModuleBase_FilterCustom.h"
+
+#include <StdSelect_EdgeFilter.hxx>
+#include <StdSelect_TypeOfEdge.hxx>
+
+#include <Events_Error.h>
+
+#include <QString>
+#include <QMap>
+
+ModuleBase_FilterCustom::ModuleBase_FilterCustom(Handle(SelectMgr_Filter) theFilter)
+: ModuleBase_Filter()
+{
+ myFilter = theFilter;
+}
+
+void ModuleBase_FilterCustom::createFilter()
+{
+}
+
+void ModuleBase_FilterCustom::setArguments(const std::list<std::string>& theArguments)
+{
+}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: ModuleBase_FilterCustom.h
+// Created: 10 Dec 2014
+// Author: Natalia ERMOLAEVA
+
+#ifndef ModuleBase_FilterCustom_H
+#define ModuleBase_FilterCustom_H
+
+#include "ModuleBase.h"
+
+#include "ModuleBase_Filter.h"
+
+/**
+* This is a child of ModuleBase_Filter to be used in the factory of filters. Despite of other
+* child it does not create the internal filter itself, it get it from the constructor argument.
+* This is useful for custom filters, which are not the standard OCC filters. It is not necessary
+* to redefine the ModuleBase_Filter. The filter is realized and put here as the class parameter.
+*/
+
+class ModuleBase_FilterCustom: public ModuleBase_Filter
+{
+public:
+ /**
+ * Constructor
+ * \param theFilter an OCC filter to be used in the parent base filter
+ */
+ MODULEBASE_EXPORT ModuleBase_FilterCustom(Handle(SelectMgr_Filter) theFilter);
+
+ /**
+ * Sets the arguments to the filter. Currently it is not used in this filter.
+ * \param theArguments a list of arguments
+ */
+ MODULEBASE_EXPORT virtual void setArguments(const std::list<std::string>& theArguments);
+
+protected:
+ /**
+ * It creates an OCC filter. The realization is empty because the filter is set through the constructor
+ */
+ virtual void createFilter();
+
+};
+
+#endif //ModuleBase_FilterCustom
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: ModuleBase_ViewerFilters.cpp
+// Created: 07 Okt 2014
+// Author: Vitaly SMETANNIKOV
+
+
+#include "ModuleBase_FilterNoConsructionSubShapes.h"
+#include "ModuleBase_IWorkshop.h"
+
+#include <ModelAPI_Session.h>
+#include <ModelAPI_Document.h>
+#include <ModelAPI_ResultConstruction.h>
+
+#include <AIS_InteractiveObject.hxx>
+#include <AIS_Shape.hxx>
+
+#include <StdSelect_BRepOwner.hxx>
+
+#include <BRep_Tool.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Edge.hxx>
+#include <Geom_Curve.hxx>
+
+#include <ModelAPI_CompositeFeature.h>
+#include <GeomAPI_ICustomPrs.h>
+
+
+IMPLEMENT_STANDARD_HANDLE(ModuleBase_FilterNoConsructionSubShapes, SelectMgr_Filter);
+IMPLEMENT_STANDARD_RTTIEXT(ModuleBase_FilterNoConsructionSubShapes, SelectMgr_Filter);
+
+Standard_Boolean ModuleBase_FilterNoConsructionSubShapes::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const
+{
+ // global selection should be ignored, the filter processes only selected sub-shapes
+ Handle(StdSelect_BRepOwner) aShapeOwner = Handle(StdSelect_BRepOwner)::DownCast(theOwner);
+ if (!aShapeOwner.IsNull()) {
+ if (!aShapeOwner->ComesFromDecomposition())
+ return Standard_True;
+ }
+
+ if (theOwner->HasSelectable()) {
+ Handle(AIS_InteractiveObject) aAisObj =
+ Handle(AIS_InteractiveObject)::DownCast(theOwner->Selectable());
+ if (!aAisObj.IsNull()) {
+ std::shared_ptr<GeomAPI_AISObject> aAISObj = AISObjectPtr(new GeomAPI_AISObject());
+ aAISObj->setImpl(new Handle(AIS_InteractiveObject)(aAisObj));
+ ObjectPtr aObj = myWorkshop->findPresentedObject(aAISObj);
+
+ ResultConstructionPtr aConstr =
+ std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aObj);
+ if (aConstr != NULL) {
+ // it provides selection only on compositie features, construction without composite
+ // feature is not selectable
+ FeaturePtr aFeature = ModelAPI_Feature::feature(aConstr);
+ CompositeFeaturePtr aComposite =
+ std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aFeature);
+ return aComposite && aComposite->numberOfSubs() > 0;
+ }
+ }
+ }
+ return Standard_False;
+}
+
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: ModuleBase_ViewerFilters.h
+// Created: 07 Okt 2014
+// Author: Vitaly SMETANNIKOV
+
+
+#ifndef ModuleBase_FilterNoConsructionSubShapes_H
+#define ModuleBase_FilterNoConsructionSubShapes_H
+
+#include <QStringList>
+
+#include <SelectMgr_Filter.hxx>
+#include <SelectMgr_EntityOwner.hxx>
+
+class ModuleBase_IWorkshop;
+
+/**
+* A filter which provides filtering of selection in 3d viewer.
+* Installing of this filter lets to select objects which belong to
+* currently active document or to global document
+*/
+DEFINE_STANDARD_HANDLE(ModuleBase_FilterNoConsructionSubShapes, SelectMgr_Filter);
+class ModuleBase_FilterNoConsructionSubShapes: public SelectMgr_Filter
+{
+public:
+ Standard_EXPORT ModuleBase_FilterNoConsructionSubShapes(ModuleBase_IWorkshop* theWorkshop):
+ SelectMgr_Filter(), myWorkshop(theWorkshop) {}
+
+ /**
+ * Returns true if the owner is computed from decomposition(it is global selection, not the sub-shapes)
+ * of if the selected result is a construction and the result feature is composite and has sub-elements.
+ * \param theOwner the result of selection
+ * \return whether the owner is selectable in the viewer
+ */
+ Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
+
+ DEFINE_STANDARD_RTTI(ModuleBase_FilterNoConsructionSubShapes)
+
+protected:
+ ModuleBase_IWorkshop* myWorkshop;
+};
+
+#endif
\ No newline at end of file
const Config_WidgetAPI* theData,
const std::string& theParentId)
: ModuleBase_ModelWidget(theParent, theData, theParentId),
- myWorkshop(theWorkshop), myIsActive(false), myUseSubShapes(false)
+ myWorkshop(theWorkshop), myIsActive(false)
{
myMainWidget = new QWidget(theParent);
QGridLayout* aMainLay = new QGridLayout(myMainWidget);
ModuleBase_IWorkshop* myWorkshop;
/// If true then local selector has to be activated in context
- bool myUseSubShapes;
bool myIsActive;
typedef QPair<ResultPtr, GeomShapePtr> GeomSelection;
//********************************************************************
void ModuleBase_WidgetShapeSelector::updateSelectionName()
{
- if (mySelectedObject) {
- std::string aName = mySelectedObject->data()->name();
- myTextLine->setText(QString::fromStdString(aName));
- } else {
- if (myIsActive) {
- myTextLine->setText("");
+ DataPtr aData = myFeature->data();
+ bool isNameUpdated = false;
+ if (aData.get() != NULL) {
+ AttributeSelectionPtr aSelect = aData->selection(attributeID());
+ if (aSelect) {
+ myTextLine->setText(QString::fromStdString(aSelect->namingName()));
+ isNameUpdated = true;
+ }
+ }
+ if (!isNameUpdated) {
+ if (mySelectedObject) {
+ std::string aName = mySelectedObject->data()->name();
+ myTextLine->setText(QString::fromStdString(aName));
+ } else {
+ if (myIsActive) {
+ myTextLine->setText("");
+ }
}
}
}
#include <ModuleBase_FilterLinearEdge.h>
#include <ModuleBase_FilterFace.h>
#include <ModuleBase_FilterMulti.h>
-
+#include <ModuleBase_FilterCustom.h>
+#include <ModuleBase_FilterNoConsructionSubShapes.h>
#include <ModelAPI_Object.h>
#include <ModelAPI_Events.h>
aFactory->registerFilter("EdgeFilter", new ModuleBase_FilterLinearEdge);
aFactory->registerFilter("FaceFilter", new ModuleBase_FilterFace);
aFactory->registerFilter("MultiFilter", new ModuleBase_FilterMulti);
+ Handle(SelectMgr_Filter) aSelectFilter = new ModuleBase_FilterNoConsructionSubShapes(workshop());
+ aFactory->registerFilter("NoConstructionSubShapesFilter",
+ new ModuleBase_FilterCustom(aSelectFilter));
}
void PartSet_Module::operationCommitted(ModuleBase_Operation* theOperation)
if (aRefAttr) {
TopoDS_Shape aShape = myShape->impl<TopoDS_Shape>();
AttributePtr aPntAttr = PartSet_Tools::findAttributeBy2dPoint(mySelectedObject, aShape, mySketch);
- if (mySelectedObject)
- aRefAttr->setObject(mySelectedObject);
+ // this is an alternative, whether the attribute should be set or object in the attribute
+ // the first check is the attribute because the object already exist
+ // the object is set only if there is no selected attribute
+ // test case is - preselection for distance operation, which contains two points selected on lines
if (aPntAttr)
aRefAttr->setAttr(aPntAttr);
-
+ else if (mySelectedObject)
+ aRefAttr->setObject(mySelectedObject);
updateObject(myFeature);
return true;
}
Handle(AIS_Shape) aShapePrs = Handle(AIS_Shape)::DownCast(aAISIO);
if (!aShapePrs.IsNull()) {
std::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(aResult);
- const TopoDS_Shape& aShape = aShapePrs->Shape();
- std::shared_ptr<GeomAPI_Shape> anAISShapePtr(new GeomAPI_Shape());
- anAISShapePtr->setImpl(new TopoDS_Shape(aShape));
+ if (aShapePtr.get()) {
+ const TopoDS_Shape& aShape = aShapePrs->Shape();
+ std::shared_ptr<GeomAPI_Shape> anAISShapePtr(new GeomAPI_Shape());
+ anAISShapePtr->setImpl(new TopoDS_Shape(aShape));
- if (aShapePtr->isEqual(anAISShapePtr))
- return;
+ if (aShapePtr->isEqual(anAISShapePtr))
+ return;
+ }
}
}
aContext->Redisplay(aAISIO, false);