NEED='BuildPlugin CollectionPlugin Config ConstructionPlugin Events ExchangePlugin FeaturesPlugin GDMLPlugin GeomData GeomDataAPLI GeomValidators InitializationPlugin Model_ ModelAPI ModelGeomAlgo ParametersPlugin PartSetPlugin PrimitivesPlugin Selector SketchPlugin SketchSolver'
for MASK in $ALL; do
if ! [[ " $NEED " =~ " $MASK " ]]; then
- lcov -r covElse *${MASK}API* --output-file covElse_res -q
+ lcov -r covElse *${MASK}* --output-file covElse_res -q
mv -f covElse_res covElse
fi
done
aSelectionList->setSelectionType(aSelectionType);
for (int anElementIndex = 0; anElementIndex < aXaoGroup->count(); ++anElementIndex) {
aSelectionList->append(aResultBody, GeomShapePtr());
- // complex conversion of element index to reference id
- int anElementID = aXaoGroup->get(anElementIndex);
- std::string aReferenceString =
- aXaoGeometry->getElementReference(aXaoGroup->getDimension(), anElementID);
- int aReferenceID = XAO::XaoUtils::stringToInt(aReferenceString);
-
- aSelectionList->value(anElementIndex)->setId(aReferenceID);
}
}
// Create new fields
}
}
-int Model_AttributeSelection::Id()
-{
- int anID = 0;
- std::shared_ptr<GeomAPI_Shape> aSelection = value();
- ResultPtr aContextRes = context();
- // support for compsolids:
- while(ModelAPI_Tools::bodyOwner(aContextRes).get()) {
- aContextRes = ModelAPI_Tools::bodyOwner(aContextRes);
- }
- std::shared_ptr<GeomAPI_Shape> aContext = aContextRes->shape();
-
-
- TopoDS_Shape aMainShape = aContext->impl<TopoDS_Shape>();
- const TopoDS_Shape& aSubShape = aSelection->impl<TopoDS_Shape>();
- // searching for the latest main shape
- if (aSelection && !aSelection->isNull() && aContext && !aContext->isNull())
- {
- std::shared_ptr<Model_Document> aDoc =
- std::dynamic_pointer_cast<Model_Document>(context()->document());
- if (aDoc.get()) {
- Handle(TNaming_NamedShape) aNS = TNaming_Tool::NamedShape(aMainShape, aDoc->generalLabel());
- if (!aNS.IsNull()) {
- aMainShape = TNaming_Tool::CurrentShape(aNS);
- }
- }
-
- TopTools_IndexedMapOfShape aSubShapesMap;
- TopExp::MapShapes(aMainShape, aSubShapesMap);
- anID = aSubShapesMap.FindIndex(aSubShape);
- }
- return anID;
-}
-
-void Model_AttributeSelection::setId(int theID)
-{
- std::shared_ptr<GeomAPI_Shape> aSelection;
-
- ResultPtr aContextRes = context();
- // support for compsolids:
- while(ModelAPI_Tools::bodyOwner(aContextRes).get()) {
- aContextRes = ModelAPI_Tools::bodyOwner(aContextRes);
- }
- std::shared_ptr<GeomAPI_Shape> aContext = aContextRes->shape();
-
- TopoDS_Shape aMainShape = aContext->impl<TopoDS_Shape>();
- // searching for the latest main shape
- if (theID > 0 && aContext && !aContext->isNull())
- {
- std::shared_ptr<Model_Document> aDoc =
- std::dynamic_pointer_cast<Model_Document>(aContextRes->document());
- if (aDoc.get()) {
- Handle(TNaming_NamedShape) aNS = TNaming_Tool::NamedShape(aMainShape, aDoc->generalLabel());
- if (!aNS.IsNull()) {
- aMainShape = TNaming_Tool::CurrentShape(aNS);
- }
- }
-
- TopTools_IndexedMapOfShape aSubShapesMap;
- TopExp::MapShapes(aMainShape, aSubShapesMap);
- const TopoDS_Shape& aSelShape = aSubShapesMap.FindKey(theID);
-
- std::shared_ptr<GeomAPI_Shape> aResult(new GeomAPI_Shape);
- aResult->setImpl(new TopoDS_Shape(aSelShape));
-
- aSelection = aResult;
- }
-
- setValue(aContextRes, aSelection);
-}
-
std::string Model_AttributeSelection::contextName(const ResultPtr& theContext) const
{
std::string aResult;
/// \param theDefaultValue a name, which is returned if the naming name can not be obtained
MODEL_EXPORT virtual std::string namingName(const std::string& theDefaultValue = "");
- /// Returns an Id of the selection
- /// NOTE: This method has been added for temporary export of groups towards old GEOM
- /// It should then be removed when a direct use of objects from SHAPER
- /// will be possible from SMESH module of SALOME.
- MODEL_EXPORT virtual int Id();
-
- /// Defines the sub-shape by Id
- /// NOTE: This method is opposite to Id() method.
- MODEL_EXPORT virtual void setId(int theID);
-
/// Selects (i.e. creates Naming data structure) of sub-shape specified by textual name
MODEL_EXPORT virtual void selectSubShape(const std::string& theType,
const std::string& theSubShapeName);
myFlags->SetValue(kFlagInHistory, Standard_True); // is in history by default is true
myFlags->SetValue(kFlagDisplayed, Standard_True); // is displayed by default is true
myFlags->SetValue(kFlagDeleted, Standard_False); // is deleted by default is false
- } else if (myFlags->Length() != 3) { // for old formats support
- Standard_Boolean aFlag0 = myFlags->Upper() >= 0 ? myFlags->Value(0) : Standard_True;
- Standard_Boolean aFlag1 = myFlags->Upper() >= 1 ? myFlags->Value(1) : Standard_True;
- Standard_Boolean aFlag2 = myFlags->Upper() >= 2 ? myFlags->Value(2) : Standard_True;
- Handle(TColStd_HArray1OfByte) aNewArray = new TColStd_HArray1OfByte(0, 2);
- myFlags->SetInternalArray(aNewArray);
- myFlags->SetValue(0, aFlag0);
- myFlags->SetValue(1, aFlag1);
- myFlags->SetValue(2, aFlag2);
}
}
if (myWasChangedButBlocked.empty() || *(myWasChangedButBlocked.rbegin()) != theAttr)
myWasChangedButBlocked.push_back(theAttr);
}
- } else {
- // trim: need to redisplay
- /*if (myObject) {
- static const Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY);
- ModelAPI_EventCreator::get()->sendUpdated(myObject, anEvent);
- }*/
}
}
STATE_INDEX_TRANSACTION = 2, // transaction ID
};
-/// Returns the label array, initialises it by default values if not exists
+/// Returns the label array, initializes it by default values if not exists
static Handle(TDataStd_IntegerArray) stateArray(TDF_Label& theLab)
{
Handle(TDataStd_IntegerArray) aStateArray;
return myLab.Father().Tag(); // tag of the feature label
}
-void Model_Data::eraseBackReferences()
-{
- myRefsToMe.clear();
- std::shared_ptr<ModelAPI_Result> aRes = std::dynamic_pointer_cast<ModelAPI_Result>(myObject);
- if (aRes) {
- aRes->setIsConcealed(false);
- }
-}
-
void Model_Data::removeBackReference(ObjectPtr theObject, std::string theAttrID)
{
AttributePtr anAttribute = theObject->data()->attribute(theAttrID);
myRefsToMe.erase(theAttr);
- // remove concealment immideately: on deselection it must be posible to reselect in GUI the same
+ // remove concealment immediately: on deselection it must be possible to reselect in GUI the same
FeaturePtr aFeatureOwner = std::dynamic_pointer_cast<ModelAPI_Feature>(theAttr->owner());
if (aFeatureOwner.get() &&
ModelAPI_Session::get()->validators()->isConcealed(aFeatureOwner->getKind(), theAttr->id())) {
// reinitialize Model_Attributes by TDF_Attributes set
std::shared_ptr<Model_Data> aTData = std::dynamic_pointer_cast<Model_Data>(theTarget);
aTData->myAttrs.clear();
- theTarget->owner()->initAttributes(); // reinit feature attributes
+ theTarget->owner()->initAttributes(); // reinitialize feature attributes
}
bool Model_Data::isInHistory()
MODEL_EXPORT virtual const std::string& id(const std::shared_ptr<ModelAPI_Attribute>& theAttr);
/// Returns true if data belongs to same features
MODEL_EXPORT virtual bool isEqual(const std::shared_ptr<ModelAPI_Data>& theData);
- /// Returns true if it is correctly connected t othe data model
+ /// Returns true if it is correctly connected to the data model
MODEL_EXPORT virtual bool isValid();
/// Returns the label where the shape must be stored (used in ResultBody)
MODEL_EXPORT virtual void referencesToObjects(
std::list<std::pair<std::string, std::list<ObjectPtr> > >& theRefs);
- /// Copies all atributes content into theTarget data
+ /// Copies all attributes content into theTarget data
MODEL_EXPORT virtual void copyTo(std::shared_ptr<ModelAPI_Data> theTarget);
- /// Returns the invalid data pointer (to avoid working with NULL shared ptrs in swig)
+ /// Returns the invalid data pointer (to avoid working with NULL shared pointers in swig)
MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Data> invalidPtr();
/// Returns the invalid data pointer: static method
/// Defines the custom "is in history" behavior
MODEL_EXPORT virtual void setIsInHistory(const bool theFlag);
- /// Returns true if the object is deleted, but some data is still keept in memory
+ /// Returns true if the object is deleted, but some data is still kept in memory
MODEL_EXPORT virtual bool isDeleted();
- /// Sets true if the object is deleted, but some data is still keept in memory
+ /// Sets true if the object is deleted, but some data is still kept in memory
MODEL_EXPORT virtual void setIsDeleted(const bool theFlag);
private:
- /// Removes all information about back references
- void eraseBackReferences();
/// Removes a back reference (with identifier which attribute references to this object)
/// \param theFeature feature referenced to this
/// \param theAttrID identifier of the attribute that is references from theFeature to this
/// Adds a back reference (with identifier which attribute references to this object
/// \param theFeature feature referenced to this
/// \param theAttrID identifier of the attribute that is references from theFeature to this
- /// \param theApplyConcealment applies consealment flag changes
+ /// \param theApplyConcealment applies concealment flag changes
void addBackReference(FeaturePtr theFeature, std::string theAttrID,
const bool theApplyConcealment = true);
/// Adds a back reference to an object
/// Returns true if object must be displayed in the viewer: flag is stored in the
/// data model, so on undo/redo, open/save or recreation of object by history-playing it keeps
- /// the original state i nthe current transaction.
+ /// the original state in the current transaction.
MODEL_EXPORT virtual bool isDisplayed();
/// Sets the displayed/hidden state of the object. If it is changed, sends the "redisplay"
#include <TDataStd_AsciiString.hxx>
#include <TDF_Reference.hxx>
#include <TDF_ChildIDIterator.hxx>
-#include <TDF_LabelMapHasher.hxx>
#include <TDF_Delta.hxx>
#include <TDF_AttributeDelta.hxx>
#include <TDF_AttributeDeltaList.hxx>
return myObjs->feature(theResult);
}
-Standard_Integer HashCode(const TDF_Label& theLab, const Standard_Integer theUpper)
-{
- return TDF_LabelMapHasher::HashCode(theLab, theUpper);
-
-}
-Standard_Boolean IsEqual(const TDF_Label& theLab1, const TDF_Label& theLab2)
-{
- return TDF_LabelMapHasher::IsEqual(theLab1, theLab2);
-}
-
FeaturePtr Model_Document::featureByLab(const TDF_Label& theLab) {
TDF_Label aCurrentLab = theLab;
while(aCurrentLab.Depth() > 3)
int aNewVal = transactionID() + 1;
TDataStd_Integer::Set(generalLabel().FindChild(TAG_CURRENT_TRANSACTION), aNewVal);
}
-void Model_Document::decrementTransactionID()
-{
- int aNewVal = transactionID() - 1;
- TDataStd_Integer::Set(generalLabel().FindChild(TAG_CURRENT_TRANSACTION), aNewVal);
-}
TDF_Label Model_Document::extConstructionsLabel() const
{
return myObjs->internalFeature(theIndex);
}
-std::shared_ptr<ModelAPI_Feature> Model_Document::featureById(const int theId)
-{
- return myObjs->featureById(theId);
-}
-
void Model_Document::synchronizeTransactions()
{
Model_Document* aRoot =
//! without this participation
MODEL_EXPORT virtual void synchronizeTransactions();
- //! Returns feature by the id of the feature (produced by the Data "featureId" method)
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Feature> featureById(const int theId);
-
-
/// Creates construction results
MODEL_EXPORT virtual std::shared_ptr<ModelAPI_ResultConstruction> createConstruction(
const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
MODEL_EXPORT virtual int transactionID();
/// Increases the transaction ID
MODEL_EXPORT virtual void incrementTransactionID();
- /// Decreases the transaction ID
- MODEL_EXPORT virtual void decrementTransactionID();
/// Returns true if document is opened and valid
MODEL_EXPORT virtual bool isOpened();
theObj->initAttributes();
}
-std::shared_ptr<ModelAPI_Feature> Model_Objects::featureById(const int theId)
-{
- if (theId > 0) {
- TDF_Label aLab = featuresLabel().FindChild(theId, Standard_False);
- return feature(aLab);
- }
- return std::shared_ptr<ModelAPI_Feature>(); // not found
-}
-
void Model_Objects::synchronizeFeatures(
const TDF_LabelList& theUpdated, const bool theUpdateReferences,
const bool theExecuteFeatures, const bool theOpen, const bool theFlush)
//! Returns the feature by zero-based index: features in the history or not
std::shared_ptr<ModelAPI_Feature> internalFeature(const int theIndex);
- //! Returns feature by the id of the feature (produced by the Data "featureId" method)
- std::shared_ptr<ModelAPI_Feature> featureById(const int theId);
-
-
/// Creates a construction result
std::shared_ptr<ModelAPI_ResultConstruction> createConstruction(
const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
data()->addAttribute(DEFLECTION_ID(), ModelAPI_AttributeDouble::typeId());
data()->addAttribute(TRANSPARENCY_ID(), ModelAPI_AttributeDouble::typeId());
- if (aDocRef->isInitialized() && // initialized immideately means already exist and will be loaded
+ if (aDocRef->isInitialized() && // initialized immediately means already exist and will be loaded
!Model_Application::getApplication()->hasDocument(aDocRef->docId()))
Model_Application::getApplication()->setLoadByDemand(data()->name(), aDocRef->docId());
}
if (!myTrsf.get()) { // disable of base result part
DocumentPtr aDoc = Model_ResultPart::partDoc();
if (aDoc.get() && aDoc->isOpened()) {
- // make the current feature the last in any case: to update shapes defore deactivation too
+ // make the current feature the last in any case: to update shapes before deactivation too
int aSize = aDoc->size(ModelAPI_Feature::group());
FeaturePtr aLastFeature;
if (aSize)
std::shared_ptr<GeomAPI_Shape> aResult(new GeomAPI_Shape);
if (myShape.IsNull()) { // shape is not produced yet, create it
SessionPtr aMgr = ModelAPI_Session::get();
- bool aToSendUpdate = aMgr->isOperation(); // inside of operation may send an update evnet
+ bool aToSendUpdate = aMgr->isOperation(); // inside of operation may send an update event
if (myTrsf.get()) { // get shape of the base result and apply the transformation
ResultPtr anOrigResult = baseRef();
std::shared_ptr<GeomAPI_Shape> anOrigShape = anOrigResult->shape();
TestGeomNamingSketchPlane.py
TestGeomNamingBoxWithFillet.py
TestContainerSelector.py
- TestSaveOpen.py
+ TestSaveOpen1.py
+ TestSaveOpen2.py
)
%template(modelAPI_ResultBody) shared_ptr_cast<ModelAPI_ResultBody, ModelAPI_Result>;
%template(modelAPI_ResultPart) shared_ptr_cast<ModelAPI_ResultPart, ModelAPI_Result>;
%template(modelAPI_ResultParameter) shared_ptr_cast<ModelAPI_ResultParameter, ModelAPI_Result>;
-%template(modelAPI_ResultGroup) shared_ptr_cast<ModelAPI_ResultPart, ModelAPI_ResultGroup>;
-%template(modelAPI_ResultField) shared_ptr_cast<ModelAPI_ResultPart, ModelAPI_ResultField>;
+%template(modelAPI_ResultGroup) shared_ptr_cast<ModelAPI_ResultGroup, ModelAPI_Result>;
+%template(modelAPI_ResultField) shared_ptr_cast<ModelAPI_ResultField, ModelAPI_Result>;
// Attribute casts
%template(modelAPI_AttributeDocRef) shared_ptr_cast<ModelAPI_AttributeDocRef, ModelAPI_Attribute>;
/// Returns document referenced from this attribute
MODELAPI_EXPORT virtual std::shared_ptr<ModelAPI_Document> value() = 0;
- /// Returns the persisten ID of the document
+ /// Returns the persistent ID of the document
MODELAPI_EXPORT virtual int docId() = 0;
/// Returns the type of this class of attributes
/// \param theDefaultValue a value, which is used if the naming name can not be obtained
virtual std::string namingName(const std::string& theDefaultValue = "") = 0;
- /// Returns an id of the selection
- virtual int Id() = 0;
-
- /// Defines an id of the selection
- virtual void setId(int theID) = 0;
-
/// Selects sub-shape by the textual Name
virtual void selectSubShape(const std::string& theType, const std::string& theSubShapeName) = 0;
/// Copies all attributes content into theTarget data
virtual void copyTo(std::shared_ptr<ModelAPI_Data> theTarget) = 0;
- /// Returns the invalid data pointer (to avoid working with NULL shared ptrs in swig)
+ /// Returns the invalid data pointer (to avoid working with NULL shared pointers in swig)
virtual std::shared_ptr<ModelAPI_Data> invalidPtr() = 0;
/// Identifier of the transaction when object (feature or result) was updated last time.
/// This method is called by the updater.
virtual void setUpdateID(const int theID) = 0;
- /// Returns the owner of htis data
+ /// Returns the owner of this data
virtual std::shared_ptr<ModelAPI_Object> owner() = 0;
- /// Returns true if the object is deleted, but some data is still keept in memory
+ /// Returns true if the object is deleted, but some data is still kept in memory
virtual bool isDeleted() = 0;
- /// Sets true if the object is deleted, but some data is still keept in memory
+ /// Sets true if the object is deleted, but some data is still kept in memory
virtual void setIsDeleted(const bool theFlag) = 0;
/// Returns \c true if theAttribute1 is going earlier than theAttribute2 in the data
/// Returns true if object must be displayed in the viewer: flag is stored in the
/// data model, so on undo/redo, open/save or recreation of object by history-playing it keeps
- /// the original state i nthe current transaction.
+ /// the original state in the current transaction.
virtual bool isDisplayed() = 0;
/// Sets the displayed/hidden state of the object. If it is changed, sends the "redisplay"
/**\class ModelAPI_Document
* \ingroup DataModel
* \brief Document for internal data structure of any object storage.
- * Document contains all data that must be stored/retrived in the file.
- * Also it provides acces to this data: open/save, transactions management etc.
+ * Document contains all data that must be stored/retrieved in the file.
+ * Also it provides access to this data: open/save, transactions management etc.
*/
class ModelAPI_Document: public ModelAPI_Entity
{
virtual const std::string& kind() const = 0;
//! Removes document data
- //! \param theForever if it is false, document is just hiden
+ //! \param theForever if it is false, document is just hidden
//! (to keep possibility make it back on Undo/Redo)
virtual void close(const bool theForever = false) = 0;
//! Sets the current feature: all features below will be disabled, new features
//! will be appended after this one. This method does not flushes the events appeared:
//! it will be done by the finishOperation, or direct flushes
- //! \param theCurrent the selected feature as current: blow it everythin become disabled
+ //! \param theCurrent the selected feature as current: blow it everything become disabled
//! \param theVisible use visible features only: flag is true for Object Browser functionality
virtual void setCurrentFeature(std::shared_ptr<ModelAPI_Feature> theCurrent,
const bool theVisible) = 0;
virtual std::shared_ptr<ModelAPI_Feature> internalFeature(const int theIndex) = 0;
//! Performs synchronization of transactions with the module document:
//! If some document is not active (by undo of activation) but in memory,
- //! on activation the transactions must be synchronised because all redos performed
- //! wihtout this participation
+ //! on activation the transactions must be synchronized because all redo-s performed
+ //! without this participation
virtual void synchronizeTransactions() = 0;
- //! Returns feature by the id of the feature (produced by the Data "featureId" method)
- virtual std::shared_ptr<ModelAPI_Feature> featureById(const int theId) = 0;
-
//! To virtually destroy the fields of successors
MODELAPI_EXPORT virtual ~ModelAPI_Document();
virtual std::shared_ptr<ModelAPI_Folder> findFolderBelow(
const std::list<std::shared_ptr<ModelAPI_Feature> >& theFeatures) = 0;
//! Search a folder containing the given feature.
- //! Addtionally calculates a zero-based index of the feature in this folder.
+ //! Additionally calculates a zero-based index of the feature in this folder.
//! \param theFeature feature to search
//! \param theIndexInFolder zero-based index in the folder or -1 if the feature is top-level.
//! \return the folder containing the feature or empty pointer if the feature is top-level.
int& theIndexInFolder) = 0;
//! Add a list of features to the folder. The correctness of the adding is not performed
//! (such checks have been done in corresponding find.. method).
- //! \return \c true if the movement is successfull
+ //! \return \c true if the movement is successful
virtual bool moveToFolder(const std::list<std::shared_ptr<ModelAPI_Feature> >& theFeatures,
const std::shared_ptr<ModelAPI_Folder>& theFolder) = 0;
//! Remove features from the folder
/// Normally is called outside of the transaction, just before "save".
MODELAPI_EXPORT virtual void storeNodesState(const std::list<bool>& theStates) = 0;
- /// Returns the stored nodes states. Normally it is calles just after "open".
+ /// Returns the stored nodes states. Normally it is calls just after "open".
/// Appends the values to theStates list.
MODELAPI_EXPORT virtual void restoreNodesState(std::list<bool>& theStates) const = 0;
return myBuilder->shape();
}
-bool ModelAPI_ResultBody::generated(const GeomShapePtr& theNewShape,
- const std::string& theName, const bool theCheckIsInResult)
-{
- return myBuilder->generated(theNewShape, theName, theCheckIsInResult);
-}
-
void ModelAPI_ResultBody::generated(const GeomShapePtr& theOldShape,
const GeomShapePtr& theNewShape,
const std::string& theName)
myBuilder->loadDeletedShapes(theAlgo, theOldShape, theShapeTypeToExplore, theShapesToExclude);
}
-void ModelAPI_ResultBody::loadModifiedShapes(const GeomMakeShapePtr& theAlgo,
- const GeomShapePtr& theOldShape,
- const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
- const std::string& theName)
-{
- myBuilder->loadModifiedShapes(theAlgo, theOldShape, theShapeTypeToExplore, theName);
-}
-
-void ModelAPI_ResultBody::loadGeneratedShapes(const GeomMakeShapePtr& theAlgo,
- const GeomShapePtr& theOldShape,
- const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
- const std::string& theName)
-{
- myBuilder->loadGeneratedShapes(theAlgo, theOldShape, theShapeTypeToExplore, theName);
-}
-
void ModelAPI_ResultBody::loadFirstLevel(GeomShapePtr theShape,
const std::string& theName)
{
/// As an example, consider the case of a face generated in construction of a box.
/// Returns true if it is stored correctly (the final shape contains this new sub-shape)
MODELAPI_EXPORT virtual bool generated(const GeomShapePtr& theNewShape,
- const std::string& theName, const bool theCheckIsInResult = true);
+ const std::string& theName, const bool theCheckIsInResult = true) = 0;
/// Records the shape newShape which was generated from the shape oldShape during a topological
/// construction. As an example, consider the case of a face generated from an edge in
virtual void loadModifiedShapes(const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgo,
const GeomShapePtr& theOldShape,
const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
- const std::string& theName = "");
+ const std::string& theName = "") = 0;
/// load and orient generated shapes
MODELAPI_EXPORT
virtual void loadGeneratedShapes(const std::shared_ptr<GeomAlgoAPI_MakeShape>& theAlgo,
const GeomShapePtr& theOldShape,
const GeomAPI_Shape::ShapeType theShapeTypeToExplore,
- const std::string& theName = "");
+ const std::string& theName = "") = 0;
/// load shapes of the first level (to be used during shape import)
MODELAPI_EXPORT virtual void loadFirstLevel(GeomShapePtr theShape,
+++ /dev/null
-## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
-##
-## This library is free software; you can redistribute it and/or
-## modify it under the terms of the GNU Lesser General Public
-## License as published by the Free Software Foundation; either
-## version 2.1 of the License, or (at your option) any later version.
-##
-## This library is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-## Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public
-## License along with this library; if not, write to the Free Software
-## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-##
-## See http:##www.salome-platform.org/ or
-## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
-##
-
-# -*- coding: utf-8 -*-
-
-from salome.shaper import model
-from ModelAPI import *
-
-model.begin()
-partSet = model.moduleDocument()
-Point_2 = model.addPoint(partSet, 1, 2, 3)
-Point_name = Point_2.name()
-model.end()
-
-# check save document in a current folder
-aSession = ModelAPI_Session.get()
-aFiles = StringList()
-aSession.save(".", aFiles)
-assert(len(aFiles) == 1)
-
-# check open of the same document
-assert(aSession.load(".") == False) # error because this document is already opened
-
-# close the current document
-aSession.closeAll()
-
-# open again: it must be correct now
-assert(aSession.load("."))
-
-# check the created point is opened
-partSet = model.moduleDocument()
-assert(partSet.size("Features") == 1)
-assert(partSet.object("Features", 0).data().name() == Point_name)
--- /dev/null
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from salome.shaper import model
+from ModelAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Point_2 = model.addPoint(partSet, 1, 2, 3)
+Point_name = Point_2.name()
+model.end()
+
+# check save document in a current folder
+aSession = ModelAPI_Session.get()
+aFiles = StringList()
+aSession.save(".", aFiles)
+assert(len(aFiles) == 1)
+
+# check open of the same document
+assert(aSession.load(".") == False) # error because this document is already opened
+
+# close the current document
+aSession.closeAll()
+
+# open again: it must be correct now
+assert(aSession.load("."))
+
+# check the created point is opened
+partSet = model.moduleDocument()
+assert(partSet.size("Features") == 1)
+assert(partSet.object("Features", 0).data().name() == Point_name)
--- /dev/null
+## Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+# -*- coding: utf-8 -*-
+
+from salome.shaper import model
+from ModelAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Box_1 = model.addBox(Part_1_doc, 10, 10, 10)
+Group_1 = model.addGroup(Part_1_doc, [model.selection("EDGE", "[Box_1_1/Back][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Front][Box_1_1/Top]")])
+Field_1 = model.addField(Part_1_doc, 1, "DOUBLE", 1, ["Comp 1"], [model.selection("EDGE", "[Box_1_1/Left][Box_1_1/Top]"), model.selection("EDGE", "[Box_1_1/Right][Box_1_1/Top]")])
+Field_1.addStep(0, 5, [[0], [3], [4]])
+model.do()
+Translation_1 = model.addTranslation(partSet, [model.selection("COMPOUND", "Part_1/")], model.selection("EDGE", "OY"), 20)
+model.end()
+
+# check save document in a current folder
+aSession = ModelAPI_Session.get()
+aFiles = StringList()
+aSession.save(".", aFiles)
+assert(len(aFiles) == 3)
+
+# check open of the same document
+assert(aSession.load(".") == False) # error because this document is already opened
+
+# close the current document
+aSession.closeAll()
+
+# open again: it must be correct now
+assert(aSession.load("."))
+
+# activate the Part of session
+model.begin()
+partSet = model.moduleDocument()
+assert(partSet.size("Features") == 2)
+aPart = objectToFeature(partSet.object("Features", 0))
+aPartResult = modelAPI_ResultPart(aPart.results()[0])
+aPartResult.activate()
+aPartDoc = aPartResult.partDoc()
+aSession.setActiveDocument(aPartDoc, True)
+model.do()
+# check the field result data
+aFieldFeature = aPartDoc.objectByName("Features", "Field_1")
+aFieldResult = modelAPI_ResultField(objectToFeature(aFieldFeature).results()[0])
+assert(aFieldResult.textLine(0) == "5")
+aSession.setActiveDocument(partSet, True)
+aTranslation = objectToFeature(partSet.objectByName("Features", "Translation_1"))
+partSet.setCurrentFeature(aTranslation, True)
+model.end()
+
+# check the translation feature has a correct result
+assert(not aTranslation.firstResult().shape().isNull())
\ No newline at end of file