--- /dev/null
+
+
+SET(GUI_ROOT_DIR $ENV{GUI_ROOT_DIR} CACHE PATH "Path to the Salome GUI directory")
+IF(EXISTS ${GUI_ROOT_DIR})
+ SET(HAVE_SALOME YES)
+
+ FIND_LIBRARY(LightApp LightApp ${GUI_ROOT_DIR}/lib/salome)
+ FIND_LIBRARY(OCCViewer OCCViewer ${GUI_ROOT_DIR}/lib/salome)
+
+ SET(SALOME_GUI_INCLUDE ${GUI_ROOT_DIR}/include/salome)
+ ADD_DEFINITIONS( -DHAVE_SALOME )
+ENDIF(EXISTS ${GUI_ROOT_DIR})
INCLUDE(Common)
INCLUDE(FindQt)
+INCLUDE(FindBoost)
INCLUDE(FindPython)
+INCLUDE(FindSalome)
IF(UNIX)
IF(CMAKE_COMPILER_IS_GNUCC)
ADD_SUBDIRECTORY (src/PyInterp)
ADD_SUBDIRECTORY (src/XGUI)
ADD_SUBDIRECTORY (src/GeomApp)
+
+#IF(${HAVE_SALOME})
+# ADD_SUBDIRECTORY (src/SalomeModule)
+#ENDIF(${HAVE_SALOME})
--- /dev/null
+@ECHO OFF
+
+REM Find absolute path to ROOT_DIR
+@SET PARENT_DIR=%~dp0..
+@SET ROOT_DIR=
+pushd %PARENT_DIR%
+@SET ROOT_DIR=%CD%
+popd
+
+@SET SRC_DIR=%ROOT_DIR%\sources
+@SET OCC_LIB_PREFIX=d
+
+call %SRC_DIR%\msvc9_env_Salome.bat
+mkdir %ROOT_DIR%\build
+cd %ROOT_DIR%\build
+
+cmake %SRC_DIR% -G "Visual Studio 9 2008" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX:PATH=%ROOT_DIR%\install
+
+start "" %MSVC_EXE% NewGEOM.sln
@SET PATH=%PDIR%\swig-2.0.9\bin;%PATH%
@REM -------------------------
-@REM -------------------------
@REM BOOST
@SET BOOST_ROOT_DIR=%PDIR%\boost-1.52.0
@SET PATH=%BOOST_ROOT_DIR%\lib;%PATH%
@SET NEW_GEOM_CONFIG_FILE=%ROOT_DIR%\install\plugins
@SET PATH=%ROOT_DIR%\install\plugins;%PATH%
+@REM -------------------------
+if "%GUI_ROOT_DIR%" == "" (
+ @SET GUI_ROOT_DIR=%ROOT_DIR%\SALOME\GUI\DEBUG\GUI_INSTALL
+)
+@REM -------------------------
+
+
rem -------- Visual Studio --------------------
rem Detect Visual Studio (either commercial or Express edition)
if "%VS100COMNTOOLS%" == "" (
--- /dev/null
+@echo off
+
+IF NOT EXIST "%VS90COMNTOOLS%..\..\VC\vcvarsall.bat" GOTO ERROR1
+
+@REM Load local settings from file localenv.bat that should be located in the root directory
+if "%ROOT_DIR%" == "" (
+ set ROOT_DIR=%~dp0..
+)
+
+if exist "%ROOT_DIR%\localenv.bat" (
+ echo Setting local environment from %ROOT_DIR%\localenv.bat
+ call "%ROOT_DIR%\localenv.bat"
+) else (
+ echo Warning: file %ROOT_DIR%\localenv.bat does not exist; using default environment
+)
+
+if "%SALOME_ROOT_DIR%" == "" (
+ set SALOME_ROOT_DIR=%ROOT_DIR%\SALOME
+)
+
+call "%SALOME_ROOT_DIR%\WORK\set_env.bat"
+call "%PDIR%\env_compile.bat"
+
+@REM -------------------------
+@REM Python
+@SET PYTHON_LIB_DIR=%PYTHON_ROOT_DIR%\libs
+@SET PYTHON_INC_DIR=%PYTHON_ROOT_DIR%\include
+@REM -------------------------
+
+@REM -------------------------
+@REM CASCADE
+@SET PATH=%CASROOT%;%CASROOT%\win32\bin%OCC_LIB_PREFIX%;%PATH%
+@SET LIB=%CASROOT%\win32\lib%OCC_LIB_PREFIX%;%LIB%
+@set CSF_MDTVFontDirectory=%CASROOT%\src\FontMFT
+@set CSF_LANGUAGE=us
+@set MMGT_CLEAR=1
+@set CSF_EXCEPTION_PROMPT=1
+@set CSF_SHMessage=%CASROOT%\src\SHMessage
+@set CSF_MDTVTexturesDirectory=%CASROOT%\src\Textures
+@set CSF_XSMessage=%CASROOT%\src\XSMessage
+@set CSF_StandardDefaults=%CASROOT%\src\StdResource
+@set CSF_PluginDefaults=%CASROOT%\src\StdResource
+@set CSF_XCAFDefaults=%CASROOT%\src\StdResource
+@set CSF_StandardLiteDefaults=%CASROOT%\src\StdResource
+@set CSF_UnitsLexicon=%CASROOT%\src\UnitsAPI\Lexi_Expr.dat
+@set CSF_UnitsDefinition=%CASROOT%\src\UnitsAPI\Units.dat
+@set CSF_IGESDefaults=%CASROOT%\src\XSTEPResource
+@set CSF_STEPDefaults=%CASROOT%\src\XSTEPResource
+@set CSF_XmlOcafResource=%CASROOT%\src\XmlOcafResource
+@REM -------------------------
+
+@REM -------------------------
+@REM Create launch path
+@SET PATH=%LIBXML2_ROOT_DIR%\bin;%PATH%
+@SET PATH=%PDIR%\tbb\bin;%PATH%
+@SET PATH=%PDIR%\freeimage-3.15.4\bin;%PATH%
+@SET PATH=%PDIR%\ftgl-2.1.3\bin;%PATH%
+@SET PATH=%PDIR%\freetype-2.4.11\bin;%PATH%
+@SET PATH=%PDIR%\gl2ps-1.3.8\bin;%PATH%
+@REM -------------------------
+
+IF "%ARCH%" == "Win64" (
+ call "%VS90COMNTOOLS%..\..\VC\vcvarsall.bat" x64
+) ELSE (
+ IF "%ARCH%" == "Win32" (
+ call "%VS90COMNTOOLS%..\..\VC\vcvarsall.bat" x86
+ ) ELSE (
+ echo Wrong architecture is used. Win32 or Win64 architecture is allowed only.
+ echo Refer to the set_env.bat script.
+ )
+)
ModelAPI_PluginManager::get()->registerPlugin(this);
}
-shared_ptr<ModelAPI_Feature> ConstructionPlugin_Plugin::createFeature(string theFeatureID)
+boost::shared_ptr<ModelAPI_Feature> ConstructionPlugin_Plugin::createFeature(string theFeatureID)
{
if (theFeatureID == "Point") {
- return shared_ptr<ModelAPI_Feature>(new ConstructionPlugin_Point);
+ return boost::shared_ptr<ModelAPI_Feature>(new ConstructionPlugin_Point);
}
// feature of such kind is not found
- return shared_ptr<ModelAPI_Feature>();
+ return boost::shared_ptr<ModelAPI_Feature>();
}
{
public:
/// Creates the feature object of this plugin by the feature string ID
- virtual std::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID);
+ virtual boost::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID);
public:
/// Is needed for python wrapping by swig
Model_Events.cxx
)
-ADD_DEFINITIONS(-DMODEL_EXPORTS ${CAS_DEFINITIONS})
+ADD_DEFINITIONS(-DMODEL_EXPORTS ${CAS_DEFINITIONS} ${BOOST_DEFINITIONS})
ADD_LIBRARY(Model SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS})
TARGET_LINK_LIBRARIES(Model ${PROJECT_LIBRARIES} ${CAS_OCAF} ModelAPI Event Config)
}
//=======================================================================
-const std::shared_ptr<Model_Document>& Model_Application::getDocument(string theDocID)
+const boost::shared_ptr<Model_Document>& Model_Application::getDocument(string theDocID)
{
if (myDocs.find(theDocID) != myDocs.end())
return myDocs[theDocID];
- std::shared_ptr<Model_Document> aNew(new Model_Document(theDocID));
+ boost::shared_ptr<Model_Document> aNew(new Model_Document(theDocID));
myDocs[theDocID] = aNew;
return myDocs[theDocID];
}
//! Retuns the application: one per process
MODEL_EXPORT static Handle_Model_Application getApplication();
//! Returns the main document (on first call creates it) by the string identifier
- MODEL_EXPORT const std::shared_ptr<Model_Document>& getDocument(std::string theDocID);
+ MODEL_EXPORT const boost::shared_ptr<Model_Document>& getDocument(std::string theDocID);
//! Returns true if document has been created
MODEL_EXPORT bool hasDocument(std::string theDocID);
//! Deletes the document from the application
private:
/// Map from string identifiers to created documents of an application
- std::map<std::string, std::shared_ptr<Model_Document> > myDocs;
+ std::map<std::string, boost::shared_ptr<Model_Document> > myDocs;
};
#endif
using namespace std;
-void Model_AttributeDocRef::setValue(std::shared_ptr<ModelAPI_Document> theDoc)
+void Model_AttributeDocRef::setValue(boost::shared_ptr<ModelAPI_Document> theDoc)
{
myComment->Set(TCollection_ExtendedString(theDoc->id().c_str()));
}
-std::shared_ptr<ModelAPI_Document> Model_AttributeDocRef::value()
+boost::shared_ptr<ModelAPI_Document> Model_AttributeDocRef::value()
{
if (myComment->Get().Length())
return Model_Application::getApplication()->getDocument(
TCollection_AsciiString(myComment->Get()).ToCString());
// not initialized
- return std::shared_ptr<ModelAPI_Document>();
+ return boost::shared_ptr<ModelAPI_Document>();
}
Model_AttributeDocRef::Model_AttributeDocRef(TDF_Label& theLabel)
Handle_TDataStd_Comment myComment; ///< reference to document is identified as string-id
public:
/// Defines the document referenced from this attribute
- MODEL_EXPORT virtual void setValue(std::shared_ptr<ModelAPI_Document> theDoc);
+ MODEL_EXPORT virtual void setValue(boost::shared_ptr<ModelAPI_Document> theDoc);
/// Returns document referenced from this attribute
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Document> value();
+ MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Document> value();
protected:
/// Initializes attibutes
anAttr = new Model_AttributeDouble(anAttrLab);
if (anAttr)
- myAttrs[theID] = std::shared_ptr<ModelAPI_Attribute>(anAttr);
+ myAttrs[theID] = boost::shared_ptr<ModelAPI_Attribute>(anAttr);
else
; // TODO: generate error on unknown attribute request and/or add mechanism for customization
}
-shared_ptr<ModelAPI_AttributeDocRef> Model_Data::docRef(const string theID)
+boost::shared_ptr<ModelAPI_AttributeDocRef> Model_Data::docRef(const string theID)
{
- map<string, shared_ptr<ModelAPI_Attribute> >::iterator aFound = myAttrs.find(theID);
+ map<string, boost::shared_ptr<ModelAPI_Attribute> >::iterator aFound = myAttrs.find(theID);
if (aFound == myAttrs.end()) {
// TODO: generate error on unknown attribute request and/or add mechanism for customization
- return std::shared_ptr<ModelAPI_AttributeDocRef>();
+ return boost::shared_ptr<ModelAPI_AttributeDocRef>();
}
- shared_ptr<ModelAPI_AttributeDocRef> aRes =
- dynamic_pointer_cast<ModelAPI_AttributeDocRef>(aFound->second);
+ boost::shared_ptr<ModelAPI_AttributeDocRef> aRes =
+ boost::dynamic_pointer_cast<ModelAPI_AttributeDocRef>(aFound->second);
if (!aRes) {
// TODO: generate error on invalid attribute type request
}
return aRes;
}
-shared_ptr<ModelAPI_AttributeDouble> Model_Data::real(const string theID)
+boost::shared_ptr<ModelAPI_AttributeDouble> Model_Data::real(const string theID)
{
- map<string, shared_ptr<ModelAPI_Attribute> >::iterator aFound = myAttrs.find(theID);
+ map<string, boost::shared_ptr<ModelAPI_Attribute> >::iterator aFound = myAttrs.find(theID);
if (aFound == myAttrs.end()) {
// TODO: generate error on unknown attribute request and/or add mechanism for customization
- return std::shared_ptr<ModelAPI_AttributeDouble>();
+ return boost::shared_ptr<ModelAPI_AttributeDouble>();
}
- shared_ptr<ModelAPI_AttributeDouble> aRes =
- dynamic_pointer_cast<ModelAPI_AttributeDouble>(aFound->second);
+ boost::shared_ptr<ModelAPI_AttributeDouble> aRes =
+ boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(aFound->second);
if (!aRes) {
// TODO: generate error on invalid attribute type request
}
{
TDF_Label myLab; ///< label of the feature in the document
/// All attributes of the object identified by the attribute ID
- std::map<std::string, std::shared_ptr<ModelAPI_Attribute> > myAttrs;
+ std::map<std::string, boost::shared_ptr<ModelAPI_Attribute> > myAttrs;
- std::shared_ptr<ModelAPI_Document> myDoc; ///< document this feature belongs to
+ boost::shared_ptr<ModelAPI_Document> myDoc; ///< document this feature belongs to
Model_Data();
/// Defines the name of the feature visible by the user in the object browser
MODEL_EXPORT virtual void setName(std::string theName);
/// Returns the attribute that references to another document
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeDocRef> docRef(const std::string theID);
+ MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_AttributeDocRef> docRef(const std::string theID);
/// Returns the attribute that contains real value with double precision
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeDouble> real(const std::string theID);
+ MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_AttributeDouble> real(const std::string theID);
/// Initializes object by the attributes: must be called just after the object is created
/// for each attribute of the object
MODEL_EXPORT virtual void addAttribute(std::string theID, std::string theAttrType);
/// Returns the document of this data
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Document> document() {return myDoc;}
+ MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Document> document() {return myDoc;}
/// Puts feature to the document data sub-structure
MODEL_EXPORT void setLabel(TDF_Label& theLab);
/// Sets the document of this data
- MODEL_EXPORT virtual void setDocument(const std::shared_ptr<ModelAPI_Document>& theDoc) {myDoc = theDoc;}
+ MODEL_EXPORT virtual void setDocument(const boost::shared_ptr<ModelAPI_Document>& theDoc) {myDoc = theDoc;}
};
#endif
subDocument(*aSubIter)->redo();
}
-shared_ptr<ModelAPI_Feature> Model_Document::addFeature(string theID)
+boost::shared_ptr<ModelAPI_Feature> Model_Document::addFeature(string theID)
{
- shared_ptr<ModelAPI_Feature> aFeature = ModelAPI_PluginManager::get()->createFeature(theID);
+ boost::shared_ptr<ModelAPI_Feature> aFeature = ModelAPI_PluginManager::get()->createFeature(theID);
if (aFeature) {
- dynamic_pointer_cast<Model_Document>(aFeature->documentToAdd())->addFeature(aFeature);
+ boost::dynamic_pointer_cast<Model_Document>(aFeature->documentToAdd())->addFeature(aFeature);
} else {
// TODO: generate error that feature is not created
}
return aFeature;
}
-void Model_Document::addFeature(const std::shared_ptr<ModelAPI_Feature> theFeature)
+void Model_Document::addFeature(const boost::shared_ptr<ModelAPI_Feature> theFeature)
{
const std::string& aGroup = theFeature->getGroup();
TDF_Label aGroupLab = groupLabel(aGroup);
TDF_Label anObjLab = aGroupLab.NewChild();
- std::shared_ptr<Model_Data> aData(new Model_Data);
+ boost::shared_ptr<Model_Data> aData(new Model_Data);
aData->setLabel(anObjLab);
- shared_ptr<ModelAPI_Document> aThis = Model_Application::getApplication()->getDocument(myID);
+ boost::shared_ptr<ModelAPI_Document> aThis = Model_Application::getApplication()->getDocument(myID);
aData->setDocument(aThis);
theFeature->setData(aData);
setUniqueName(theFeature);
Event_Loop::loop()->send(aMsg);
}
-shared_ptr<ModelAPI_Feature> Model_Document::feature(TDF_Label& theLabel)
+boost::shared_ptr<ModelAPI_Feature> Model_Document::feature(TDF_Label& theLabel)
{
Handle(TDataStd_Integer) aFeatureIndex;
if (theLabel.FindAttribute(TDataStd_Integer::GetID(), aFeatureIndex)) {
return myFeatures[aGroup][aFeatureIndex->Get()];
}
}
- return std::shared_ptr<ModelAPI_Feature>(); // not found
+ return boost::shared_ptr<ModelAPI_Feature>(); // not found
}
-int Model_Document::featureIndex(shared_ptr<ModelAPI_Feature> theFeature)
+int Model_Document::featureIndex(boost::shared_ptr<ModelAPI_Feature> theFeature)
{
if (theFeature->data()->document().get() != this) {
return theFeature->data()->document()->featureIndex(theFeature);
}
- shared_ptr<Model_Data> aData = dynamic_pointer_cast<Model_Data>(theFeature->data());
+ boost::shared_ptr<Model_Data> aData = boost::dynamic_pointer_cast<Model_Data>(theFeature->data());
Handle(TDataStd_Integer) aFeatureIndex;
if (aData->label().FindAttribute(TDataStd_Integer::GetID(), aFeatureIndex)) {
return aFeatureIndex->Get();
return -1; // not found
}
-shared_ptr<ModelAPI_Document> Model_Document::subDocument(string theDocID)
+boost::shared_ptr<ModelAPI_Document> Model_Document::subDocument(string theDocID)
{
// just store sub-document identifier here to manage it later
if (mySubs.find(theDocID) == mySubs.end())
return Model_Application::getApplication()->getDocument(theDocID);
}
-shared_ptr<ModelAPI_Iterator> Model_Document::featuresIterator(const string theGroup)
+boost::shared_ptr<ModelAPI_Iterator> Model_Document::featuresIterator(const string theGroup)
{
- shared_ptr<Model_Document> aThis(Model_Application::getApplication()->getDocument(myID));
+ boost::shared_ptr<Model_Document> aThis(Model_Application::getApplication()->getDocument(myID));
// create an empty iterator for not existing group
// (to avoidance of attributes management outside the transaction)
if (myGroups.find(theGroup) == myGroups.end())
- return shared_ptr<ModelAPI_Iterator>(new Model_Iterator());
- return shared_ptr<ModelAPI_Iterator>(new Model_Iterator(aThis, groupLabel(theGroup)));
+ return boost::shared_ptr<ModelAPI_Iterator>(new Model_Iterator());
+ return boost::shared_ptr<ModelAPI_Iterator>(new Model_Iterator(aThis, groupLabel(theGroup)));
}
-shared_ptr<ModelAPI_Feature> Model_Document::feature(const string& theGroupID, const int theIndex)
+boost::shared_ptr<ModelAPI_Feature> Model_Document::feature(const string& theGroupID, const int theIndex)
{
// TODO: optimize this method
- shared_ptr<ModelAPI_Iterator> anIter = featuresIterator(theGroupID);
+ boost::shared_ptr<ModelAPI_Iterator> anIter = featuresIterator(theGroupID);
for(int a = 0; a != theIndex && anIter->more(); anIter->next()) a++;
- return anIter->more() ? anIter->current() : shared_ptr<ModelAPI_Feature>();
+ return anIter->more() ? anIter->current() : boost::shared_ptr<ModelAPI_Feature>();
}
const vector<string>& Model_Document::getGroups() const
myGroupsNames.push_back(theGroup);
// set to the group label the group idntifier to restore on "open"
TDataStd_Comment::Set(myGroups[theGroup], theGroup.c_str());
- myFeatures[theGroup] = vector<shared_ptr<ModelAPI_Feature> >();
+ myFeatures[theGroup] = vector<boost::shared_ptr<ModelAPI_Feature> >();
}
return myGroups[theGroup];
}
-void Model_Document::setUniqueName(
- shared_ptr<ModelAPI_Feature> theFeature)
+void Model_Document::setUniqueName(boost::shared_ptr<ModelAPI_Feature> theFeature)
{
// first count all objects of such kind to start with index = count + 1
int aNumObjects = 0;
- shared_ptr<ModelAPI_Iterator> anIter = featuresIterator(theFeature->getGroup());
+ boost::shared_ptr<ModelAPI_Iterator> anIter = featuresIterator(theFeature->getGroup());
for(; anIter->more(); anIter->next()) {
if (anIter->currentKind() == theFeature->getKind())
aNumObjects++;
void Model_Document::synchronizeFeatures()
{
- shared_ptr<ModelAPI_Document> aThis = Model_Application::getApplication()->getDocument(myID);
+ boost::shared_ptr<ModelAPI_Document> aThis = Model_Application::getApplication()->getDocument(myID);
// iterate groups labels
TDF_ChildIDIterator aGroupsIter(myDoc->Main().FindChild(TAG_OBJECTS),
TDataStd_Comment::GetID(), Standard_False);
aGroupsIter.Value())->Get()).ToCString();
myGroupsNames.push_back(aGroupName);
myGroups[aGroupName] = aGroupsIter.Value()->Label();
- myFeatures[aGroupName] = vector<shared_ptr<ModelAPI_Feature> >();
+ myFeatures[aGroupName] = vector<boost::shared_ptr<ModelAPI_Feature> >();
}
// update features group by group
aGroupsIter.Initialize(myDoc->Main().FindChild(TAG_OBJECTS),
string aGroupName = TCollection_AsciiString(Handle(TDataStd_Comment)::DownCast(
aGroupsIter.Value())->Get()).ToCString();
// iterate features in internal container
- vector<shared_ptr<ModelAPI_Feature> >& aFeatures = myFeatures[aGroupName];
- vector<shared_ptr<ModelAPI_Feature> >::iterator aFIter = aFeatures.begin();
+ vector<boost::shared_ptr<ModelAPI_Feature> >& aFeatures = myFeatures[aGroupName];
+ vector<boost::shared_ptr<ModelAPI_Feature> >::iterator aFIter = aFeatures.begin();
// and in parallel iterate labels of features
TDF_ChildIDIterator aFLabIter(
aGroupsIter.Value()->Label(), TDataStd_Comment::GetID(), Standard_False);
static const int INFINITE_TAG = INT_MAX; // no label means that it exists somwhere in infinite
int aFeatureTag = INFINITE_TAG;
if (aFIter != aFeatures.end()) { // existing tag for feature
- shared_ptr<Model_Data> aData = dynamic_pointer_cast<Model_Data>((*aFIter)->data());
+ boost::shared_ptr<Model_Data> aData = boost::dynamic_pointer_cast<Model_Data>((*aFIter)->data());
aFeatureTag = aData->label().Tag();
}
int aDSTag = INFINITE_TAG;
Event_Loop::loop()->send(aMsg);
} else if (aDSTag < aFeatureTag) { // a new feature is inserted
// create a feature
- shared_ptr<ModelAPI_Feature> aFeature = ModelAPI_PluginManager::get()->createFeature(
+ boost::shared_ptr<ModelAPI_Feature> aFeature = ModelAPI_PluginManager::get()->createFeature(
TCollection_AsciiString(Handle(TDataStd_Comment)::DownCast(
aFLabIter.Value())->Get()).ToCString());
- std::shared_ptr<Model_Data> aData(new Model_Data);
+ boost::shared_ptr<Model_Data> aData(new Model_Data);
TDF_Label aLab = aFLabIter.Value()->Label();
aData->setLabel(aLab);
aData->setDocument(Model_Application::getApplication()->getDocument(myID));
//! Adds to the document the new feature of the given feature id
//! \param creates feature and puts it in the document
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Feature> addFeature(std::string theID);
+ MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Feature> addFeature(std::string theID);
//! Returns the existing feature by the label
//! \param theLabel base label of the feature
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Feature> feature(TDF_Label& theLabel);
+ MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Feature> feature(TDF_Label& theLabel);
//! Adds a new sub-document by the identifier, or returns existing one if it is already exist
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Document> subDocument(std::string theDocID);
+ MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Document> subDocument(std::string theDocID);
//! Creates an iterator of the features by the specific groups
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Iterator> featuresIterator(
+ MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Iterator> featuresIterator(
const std::string theGroup);
MODEL_EXPORT virtual const std::string& id() const {return myID;}
//! Returns the feature in the group by the index (started from zero)
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Feature>
+ MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Feature>
feature(const std::string& theGroupID, const int theIndex);
///! Returns the vector of groups already added to the document
//! Returns the index of feature in the group (zero based)
//! \retruns -1 if not found
- MODEL_EXPORT virtual int featureIndex(std::shared_ptr<ModelAPI_Feature> theFeature);
+ MODEL_EXPORT virtual int featureIndex(boost::shared_ptr<ModelAPI_Feature> theFeature);
protected:
//! Initializes feature with a unique name in this group (unique name is generated as
//! feature type + "_" + index
- void setUniqueName(std::shared_ptr<ModelAPI_Feature> theFeature);
+ void setUniqueName(boost::shared_ptr<ModelAPI_Feature> theFeature);
//! Adds to the document the new feature
- void addFeature(const std::shared_ptr<ModelAPI_Feature> theFeature);
+ void addFeature(const boost::shared_ptr<ModelAPI_Feature> theFeature);
//! Synchronizes myGroups, myGroupsNames, myFeatures and mySubs list with the updated document
void synchronizeFeatures();
std::map<std::string, TDF_Label> myGroups;
std::vector<std::string> myGroupsNames; ///< names of added groups to the document
/// Features managed by this document: by group name
- std::map<std::string, std::vector<std::shared_ptr<ModelAPI_Feature> > > myFeatures;
+ std::map<std::string, std::vector<boost::shared_ptr<ModelAPI_Feature> > > myFeatures;
std::set<std::string> mySubs; ///< set of identifiers of sub-documents of this document
/// transaction indexes (related to myTransactionsAfterSave) which were empty in this doc
std::map<int, bool> myIsEmptyTr;
#include <Event_Loop.h>
ModelAPI_FeatureUpdatedMessage::ModelAPI_FeatureUpdatedMessage(
- const std::shared_ptr<ModelAPI_Document>& theDoc,
- const std::shared_ptr<ModelAPI_Feature>& theFeature, const Event_ID& theEvent)
+ const boost::shared_ptr<ModelAPI_Document>& theDoc,
+ const boost::shared_ptr<ModelAPI_Feature>& theFeature, const Event_ID& theEvent)
: Event_Message(theEvent, 0), myFeature(theFeature), myDoc(theDoc)
{}
ModelAPI_FeatureDeletedMessage::ModelAPI_FeatureDeletedMessage(
- const std::shared_ptr<ModelAPI_Document>& theDoc, const std::string& theGroup)
+ const boost::shared_ptr<ModelAPI_Document>& theDoc, const std::string& theGroup)
: Event_Message(messageId(), 0), myDoc(theDoc), myGroup(theGroup)
{
#include <Model.h>
#include <Event_Message.h>
-#include <memory>
+#include <boost/shared_ptr.hpp>
#include <string>
class ModelAPI_Feature;
/// Message that feature was changed (used for Object Browser update)
class ModelAPI_FeatureUpdatedMessage : public Event_Message {
- std::shared_ptr<ModelAPI_Document> myDoc; ///< document owner of the feature
- std::shared_ptr<ModelAPI_Feature> myFeature; ///< which feature is changed
+ boost::shared_ptr<ModelAPI_Document> myDoc; ///< document owner of the feature
+ boost::shared_ptr<ModelAPI_Feature> myFeature; ///< which feature is changed
public:
/// sender is not important, all information is located in the feature
ModelAPI_FeatureUpdatedMessage(
- const std::shared_ptr<ModelAPI_Document>& theDoc,
- const std::shared_ptr<ModelAPI_Feature>& theFeature,
+ const boost::shared_ptr<ModelAPI_Document>& theDoc,
+ const boost::shared_ptr<ModelAPI_Feature>& theFeature,
const Event_ID& theEvent);
/// Returns the feature that has been updated
- std::shared_ptr<ModelAPI_Feature> feature() const {return myFeature;}
+ boost::shared_ptr<ModelAPI_Feature> feature() const {return myFeature;}
/// Returns the document that has been updated
- std::shared_ptr<ModelAPI_Document> document() const {return myDoc;}
+ boost::shared_ptr<ModelAPI_Document> document() const {return myDoc;}
};
/// Message that feature was deleted (used for Object Browser update)
class ModelAPI_FeatureDeletedMessage : public Event_Message {
- std::shared_ptr<ModelAPI_Document> myDoc; ///< document owner of the feature
+ boost::shared_ptr<ModelAPI_Document> myDoc; ///< document owner of the feature
std::string myGroup; ///< group identifier that contained the deleted feature
public:
/// creates a message by initialization of fields
- ModelAPI_FeatureDeletedMessage(const std::shared_ptr<ModelAPI_Document>& theDoc,
+ ModelAPI_FeatureDeletedMessage(const boost::shared_ptr<ModelAPI_Document>& theDoc,
const std::string& theGroup);
/// Returns the ID of this message (EVENT_FEATURE_DELETED)
static const Event_ID messageId();
/// Returns the feature that has been updated
- std::shared_ptr<ModelAPI_Document> document() const {return myDoc;}
+ boost::shared_ptr<ModelAPI_Document> document() const {return myDoc;}
/// Returns the group where the feature was deleted
const std::string& group() const {return myGroup;}
return myIter.More() == Standard_True;
}
-shared_ptr<ModelAPI_Feature> Model_Iterator::current()
+boost::shared_ptr<ModelAPI_Feature> Model_Iterator::current()
{
TDF_Label aLab = myIter.Value()->Label();
return myDoc->feature(aLab);
return aResult;
}
-bool Model_Iterator::isEqual(std::shared_ptr<ModelAPI_Feature> theFeature)
+bool Model_Iterator::isEqual(boost::shared_ptr<ModelAPI_Feature> theFeature)
{
return (myIter.Value()->Label() ==
- dynamic_pointer_cast<Model_Data>(theFeature->data())->label()) == Standard_True;
+ boost::dynamic_pointer_cast<Model_Data>(theFeature->data())->label()) == Standard_True;
}
{
}
-Model_Iterator::Model_Iterator(std::shared_ptr<Model_Document> theDoc, TDF_Label theLab)
+Model_Iterator::Model_Iterator(boost::shared_ptr<Model_Document> theDoc, TDF_Label theLab)
: myDoc(theDoc), myIter(theLab, TDataStd_Comment::GetID(), Standard_False)
{}
class Model_Iterator : public ModelAPI_Iterator
{
- std::shared_ptr<Model_Document> myDoc; ///< the document of iterated objects
+ boost::shared_ptr<Model_Document> myDoc; ///< the document of iterated objects
TDF_ChildIDIterator myIter; ///< iterator of the features-labels
public:
/// Iterates to the next feature
/// Returns true if the current iteration is valid and next iteration is possible
MODEL_EXPORT virtual bool more();
/// Returns the currently iterated feature
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Feature> current();
+ MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Feature> current();
/// Returns the kind of the current feature (faster than Current()->getKind())
MODEL_EXPORT virtual std::string currentKind();
/// Returns the name of the current feature (faster than Current()->getName())
/// Compares the current feature with the given one
/// \returns true if given feature equals to the current one
- MODEL_EXPORT virtual bool isEqual(std::shared_ptr<ModelAPI_Feature> theFeature);
+ MODEL_EXPORT virtual bool isEqual(boost::shared_ptr<ModelAPI_Feature> theFeature);
protected:
/// Creates an empty iterator that alway returns More false
/// Initializes iterator
/// \param theDoc document where the iteration is performed
/// \param theLab label of the features group to iterate
- Model_Iterator(std::shared_ptr<Model_Document> theDoc, TDF_Label theLab);
+ Model_Iterator(boost::shared_ptr<Model_Document> theDoc, TDF_Label theLab);
friend class Model_Document;
};
static Model_PluginManager* myImpl = new Model_PluginManager();
-shared_ptr<ModelAPI_Feature> Model_PluginManager::createFeature(string theFeatureID)
+boost::shared_ptr<ModelAPI_Feature> Model_PluginManager::createFeature(string theFeatureID)
{
if (this != myImpl) return myImpl->createFeature(theFeatureID);
loadLibrary(myCurrentPluginName);
}
if (myPluginObjs.find(myCurrentPluginName) != myPluginObjs.end()) {
- std::shared_ptr<ModelAPI_Feature> aCreated =
+ boost::shared_ptr<ModelAPI_Feature> aCreated =
myPluginObjs[myCurrentPluginName]->createFeature(theFeatureID);
return aCreated;
}
}
- return std::shared_ptr<ModelAPI_Feature>(); // return nothing
+ return boost::shared_ptr<ModelAPI_Feature>(); // return nothing
}
-std::shared_ptr<ModelAPI_Document> Model_PluginManager::rootDocument()
+boost::shared_ptr<ModelAPI_Document> Model_PluginManager::rootDocument()
{
- return std::shared_ptr<ModelAPI_Document>(
+ return boost::shared_ptr<ModelAPI_Document>(
Model_Application::getApplication()->getDocument("root"));
}
return Model_Application::getApplication()->hasDocument("root");
}
-shared_ptr<ModelAPI_Document> Model_PluginManager::currentDocument()
+boost::shared_ptr<ModelAPI_Document> Model_PluginManager::currentDocument()
{
if (!myCurrentDoc)
myCurrentDoc = rootDocument();
return myCurrentDoc;
}
-void Model_PluginManager::setCurrentDocument(shared_ptr<ModelAPI_Document> theDoc)
+void Model_PluginManager::setCurrentDocument(boost::shared_ptr<ModelAPI_Document> theDoc)
{
myCurrentDoc = theDoc;
}
//TODO(sbh): Implement static method to extract event id [SEID]
static Event_ID aFeatureEvent = Event_Loop::eventByName("FeatureRegisterEvent");
- ModelAPI_PluginManager::SetPluginManager(std::shared_ptr<ModelAPI_PluginManager>(this));
+ ModelAPI_PluginManager::SetPluginManager(boost::shared_ptr<ModelAPI_PluginManager>(this));
// register the configuration reading listener
Event_Loop* aLoop = Event_Loop::loop();
aLoop->registerListener(this, aFeatureEvent);
std::map<std::string, std::string> myPlugins;
std::map<std::string, ModelAPI_Plugin*> myPluginObjs; ///< instances of the already plugins
std::string myCurrentPluginName; ///< name of the plugin that must be loaded currently
- std::shared_ptr<ModelAPI_Document> myCurrentDoc; ///< current working document
+ boost::shared_ptr<ModelAPI_Document> myCurrentDoc; ///< current working document
public:
/// Returns the root document of the application (that may contains sub-documents)
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Document> rootDocument();
+ MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Document> rootDocument();
/// Return true if root document has been already created
MODEL_EXPORT virtual bool hasRootDocument();
/// Returns the current document that used for current work in the application
- MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Document> currentDocument();
+ MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Document> currentDocument();
/// Defines the current document that used for current work in the application
- MODEL_EXPORT virtual void setCurrentDocument(std::shared_ptr<ModelAPI_Document> theDoc);
+ MODEL_EXPORT virtual void setCurrentDocument(boost::shared_ptr<ModelAPI_Document> theDoc);
/// Registers the plugin that creates features.
/// It is obligatory for each plugin to call this function on loading to be found by
void LoadPluginsInfo();
/// Creates the feature object using plugins functionality
- virtual std::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID);
+ virtual boost::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID);
};
#endif
// standard definitions
%include "typemaps.i"
%include "std_string.i"
-%include <std_shared_ptr.i>
+//%include <std_shared_ptr.i>
// boost pointers
-// %include <boost_shared_ptr.i>
+%include <boost_shared_ptr.i>
%shared_ptr(ModelAPI_Document)
%shared_ptr(ModelAPI_PluginManager)
%shared_ptr(ModelAPI_Feature)
{
public:
/// Defines the document referenced from this attribute
- virtual void setValue(std::shared_ptr<ModelAPI_Document> theDoc) = 0;
+ virtual void setValue(boost::shared_ptr<ModelAPI_Document> theDoc) = 0;
/// Returns document referenced from this attribute
- virtual std::shared_ptr<ModelAPI_Document> value() = 0;
+ virtual boost::shared_ptr<ModelAPI_Document> value() = 0;
/// Returns the type of this class of attributes
static std::string type() {return "DocRef";}
#include "ModelAPI.h"
#include <string>
-#include <memory>
+#include <boost/shared_ptr.hpp>
class ModelAPI_AttributeDocRef;
class ModelAPI_AttributeDouble;
virtual void setName(std::string theName) = 0;
/// Returns the attribute that references to another document
- virtual std::shared_ptr<ModelAPI_AttributeDocRef> docRef(const std::string theID) = 0;
+ virtual boost::shared_ptr<ModelAPI_AttributeDocRef> docRef(const std::string theID) = 0;
/// Returns the attribute that contains real value with double precision
- virtual std::shared_ptr<ModelAPI_AttributeDouble> real(const std::string theID) = 0;
+ virtual boost::shared_ptr<ModelAPI_AttributeDouble> real(const std::string theID) = 0;
/// Initializes object by the attributes: must be called just after the object is created
/// for each attribute of the object
virtual void addAttribute(std::string theID, std::string theAttrType) = 0;
/// Returns the document of this data
- virtual std::shared_ptr<ModelAPI_Document> document() = 0;
+ virtual boost::shared_ptr<ModelAPI_Document> document() = 0;
/// To virtually destroy the fields of successors
virtual ~ModelAPI_Data() {}
#include <ModelAPI.h>
#include <string>
-#include <memory>
+#include <boost/shared_ptr.hpp>
#include <vector>
class ModelAPI_Feature;
//! Adds to the document the new feature of the given feature id
//! \param creates feature and puts it in the document
- MODELAPI_EXPORT virtual std::shared_ptr<ModelAPI_Feature> addFeature(std::string theID) = 0;
+ MODELAPI_EXPORT virtual boost::shared_ptr<ModelAPI_Feature> addFeature(std::string theID) = 0;
///! Adds a new sub-document by the identifier, or returns existing one if it is already exist
- MODELAPI_EXPORT virtual std::shared_ptr<ModelAPI_Document> subDocument(std::string theDocID) = 0;
+ MODELAPI_EXPORT virtual boost::shared_ptr<ModelAPI_Document> subDocument(std::string theDocID) = 0;
///! Creates an iterator of the features by the specific groups
- MODELAPI_EXPORT virtual std::shared_ptr<ModelAPI_Iterator> featuresIterator(
+ MODELAPI_EXPORT virtual boost::shared_ptr<ModelAPI_Iterator> featuresIterator(
const std::string theGroup) = 0;
///! Returns the id of hte document
MODELAPI_EXPORT virtual const std::string& id() const = 0;
//! Returns the feature in the group by the index (started from zero)
- MODELAPI_EXPORT virtual std::shared_ptr<ModelAPI_Feature>
+ MODELAPI_EXPORT virtual boost::shared_ptr<ModelAPI_Feature>
feature(const std::string& theGroupID, const int theIndex) = 0;
//! Returns the index of feature in the group (zero based)
- MODELAPI_EXPORT virtual int featureIndex(std::shared_ptr<ModelAPI_Feature> theFeature) = 0;
+ MODELAPI_EXPORT virtual int featureIndex(boost::shared_ptr<ModelAPI_Feature> theFeature) = 0;
///! Returns the vector of groups already added to the document
MODELAPI_EXPORT virtual const std::vector<std::string>& getGroups() const = 0;
#include "ModelAPI_PluginManager.h"
#include <string>
-#include <memory>
+#include <boost/shared_ptr.hpp>
class ModelAPI_Data;
class ModelAPI_Document;
*/
class ModelAPI_Feature
{
- std::shared_ptr<ModelAPI_Data> myData; ///< manager of the data model of a feature
+ boost::shared_ptr<ModelAPI_Data> myData; ///< manager of the data model of a feature
public:
/// Returns the kind of a feature (like "Point")
MODELAPI_EXPORT virtual void execute() = 0;
/// Returns the data manager of this feature
- MODELAPI_EXPORT virtual std::shared_ptr<ModelAPI_Data> data() {return myData;}
+ MODELAPI_EXPORT virtual boost::shared_ptr<ModelAPI_Data> data() {return myData;}
/// Must return document where the new feature must be added to
/// By default it is current document
- MODELAPI_EXPORT virtual std::shared_ptr<ModelAPI_Document> documentToAdd()
+ MODELAPI_EXPORT virtual boost::shared_ptr<ModelAPI_Document> documentToAdd()
{return ModelAPI_PluginManager::get()->currentDocument();}
/// To virtually destroy the fields of successors
{}
/// Sets the data manager of an object (document does)
- MODELAPI_EXPORT void setData(std::shared_ptr<ModelAPI_Data> theData) {myData = theData;}
+ MODELAPI_EXPORT void setData(boost::shared_ptr<ModelAPI_Data> theData) {myData = theData;}
friend class Model_Document;
};
#include "ModelAPI.h"
#include <string>
-#include <memory>
+#include <boost/shared_ptr.hpp>
class ModelAPI_Feature;
class ModelAPI_Document;
/// Returns true if the current iteration is valid and next iteration is possible
virtual bool more() = 0;
/// Returns the currently iterated feature
- virtual std::shared_ptr<ModelAPI_Feature> current() = 0;
+ virtual boost::shared_ptr<ModelAPI_Feature> current() = 0;
/// Returns the kind of the current feature (faster than Current()->getKind())
virtual std::string currentKind() = 0;
/// Returns the name of the current feature (faster than Current()->getName())
virtual int numIterationsLeft() = 0;
/// Compares the current feature with the given one
/// \returns true if given feature equals to the current one
- virtual bool isEqual(std::shared_ptr<ModelAPI_Feature> theFeature) = 0;
+ virtual bool isEqual(boost::shared_ptr<ModelAPI_Feature> theFeature) = 0;
/// To virtually destroy the fields of successors
virtual ~ModelAPI_Iterator() {}
#include "ModelAPI.h"
#include <string>
-#include <memory>
+#include <boost/shared_ptr.hpp>
class ModelAPI_Feature;
{
public:
/// Creates the feature object of this plugin by the feature string ID
- virtual std::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID) = 0;
+ virtual boost::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID) = 0;
/// To virtually destroy the fields of successors
virtual ~ModelAPI_Plugin() {}
string library(const string& theLibName);
/// Manager that will be initialized from Model package, one per application
-std::shared_ptr<ModelAPI_PluginManager> MY_MANAGER;
+boost::shared_ptr<ModelAPI_PluginManager> MY_MANAGER;
ModelAPI_PluginManager::ModelAPI_PluginManager()
{
}
void ModelAPI_PluginManager::SetPluginManager(
- std::shared_ptr<ModelAPI_PluginManager> theManager)
+ boost::shared_ptr<ModelAPI_PluginManager> theManager)
{
MY_MANAGER = theManager;
}
-std::shared_ptr<ModelAPI_PluginManager> ModelAPI_PluginManager::get()
+boost::shared_ptr<ModelAPI_PluginManager> ModelAPI_PluginManager::get()
{
if (!MY_MANAGER) { // import Model library that implements this interface of ModelAPI
loadLibrary("Model");
#include "ModelAPI.h"
#include <string>
-#include <memory>
+#include <boost/shared_ptr.hpp>
class ModelAPI_Feature;
class ModelAPI_Plugin;
{
public:
/// Returns the real implementation (the alone instance per application) of the plugin manager
- static std::shared_ptr<ModelAPI_PluginManager> get();
+ static boost::shared_ptr<ModelAPI_PluginManager> get();
/// Registers the plugin that creates features.
/// It is obligatory for each plugin to call this function on loading to be found by
virtual void registerPlugin(ModelAPI_Plugin* thePlugin) = 0;
/// Returns the root document of the application (that may contains sub-documents)
- virtual std::shared_ptr<ModelAPI_Document> rootDocument() = 0;
+ virtual boost::shared_ptr<ModelAPI_Document> rootDocument() = 0;
/// Return true if root document has been already created
virtual bool hasRootDocument() = 0;
/// Returns the current document that used for current work in the application
- virtual std::shared_ptr<ModelAPI_Document> currentDocument() = 0;
+ virtual boost::shared_ptr<ModelAPI_Document> currentDocument() = 0;
/// Defines the current document that used for current work in the application
- virtual void setCurrentDocument(std::shared_ptr<ModelAPI_Document> theDoc) = 0;
+ virtual void setCurrentDocument(boost::shared_ptr<ModelAPI_Document> theDoc) = 0;
/// loads the library with specific name, appends "lib*.dll" or "*.so" depending on the platform
static void loadLibrary(const std::string theLibName);
protected:
/// Creates the feature object using plugins functionality
- virtual std::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID) = 0;
+ virtual boost::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID) = 0;
- static void SetPluginManager(std::shared_ptr<ModelAPI_PluginManager> theManager);
+ static void SetPluginManager(boost::shared_ptr<ModelAPI_PluginManager> theManager);
friend class Model_Document;
};
return myOperationId;
}
-std::shared_ptr<ModelAPI_Feature> ModuleBase_Operation::feature() const
+boost::shared_ptr<ModelAPI_Feature> ModuleBase_Operation::feature() const
{
return myFeature;
}
/*
* Returns pointer to the root document.
*/
-std::shared_ptr<ModelAPI_Document> ModuleBase_Operation::document() const
+boost::shared_ptr<ModelAPI_Document> ModuleBase_Operation::document() const
{
return ModelAPI_PluginManager::get()->rootDocument();
}
return;
}
QString anId = sender()->objectName();
- std::shared_ptr<ModelAPI_Data> aData = myFeature->data();
- std::shared_ptr<ModelAPI_AttributeDouble> aReal = aData->real(anId.toStdString());
+ boost::shared_ptr<ModelAPI_Data> aData = myFeature->data();
+ boost::shared_ptr<ModelAPI_AttributeDouble> aReal = aData->real(anId.toStdString());
aReal->setValue(theValue);
}
*/
void ModuleBase_Operation::startOperation()
{
- std::shared_ptr<ModelAPI_Document> aDoc = ModelAPI_PluginManager::get()->rootDocument();
+ boost::shared_ptr<ModelAPI_Document> aDoc = ModelAPI_PluginManager::get()->rootDocument();
myFeature = aDoc->addFeature(myOperationId.toStdString());
if (myFeature) // TODO: generate an error if feature was not created
myFeature->execute();
#include <QObject>
#include <QString>
-#include <memory>
+#include <boost/shared_ptr.hpp>
class SUIT_Study;
class XGUI_Workshop;
// Operation processing.
virtual QString operationId() const;
- std::shared_ptr<ModelAPI_Feature> feature() const;
+ boost::shared_ptr<ModelAPI_Feature> feature() const;
OperationState state() const;
bool isRunning() const;
void setExecStatus(const int);
void setState(const OperationState);
- std::shared_ptr<ModelAPI_Document> document() const;
+ boost::shared_ptr<ModelAPI_Document> document() const;
private:
int myFlags; //!< Operation flags
//!< Next fields could be extracted into a subclass;
QString myOperationId;
QString myXmlRepr;
- std::shared_ptr<ModelAPI_Feature> myFeature;
+ boost::shared_ptr<ModelAPI_Feature> myFeature;
};
#endif
*/
const TopoDS_Shape& PartSet_OperationSketchBase::preview() const
{
- shared_ptr<SketchPlugin_Feature> aFeature = dynamic_pointer_cast<SketchPlugin_Feature>(feature());
+ boost::shared_ptr<SketchPlugin_Feature> aFeature = boost::dynamic_pointer_cast<SketchPlugin_Feature>(feature());
return aFeature->preview();
}
void PartSetPlugin_Part::execute()
{
- shared_ptr<ModelAPI_AttributeDocRef> aDocRef = data()->docRef(PART_ATTR_DOC_REF);
+ boost::shared_ptr<ModelAPI_AttributeDocRef> aDocRef = data()->docRef(PART_ATTR_DOC_REF);
if (!aDocRef->value()) { // create a document if not yet created
- shared_ptr<ModelAPI_Document> aPartSetDoc = ModelAPI_PluginManager::get()->rootDocument();
+ boost::shared_ptr<ModelAPI_Document> aPartSetDoc = ModelAPI_PluginManager::get()->rootDocument();
aDocRef->setValue(aPartSetDoc->subDocument(data()->getName()));
}
}
-shared_ptr<ModelAPI_Document> PartSetPlugin_Part::documentToAdd() {
+boost::shared_ptr<ModelAPI_Document> PartSetPlugin_Part::documentToAdd() {
return ModelAPI_PluginManager::get()->rootDocument();
}
/// Request for initialization of data model of the feature: adding all attributes
PARTSETPLUGIN_EXPORT virtual void initAttributes();
- PARTSETPLUGIN_EXPORT virtual std::shared_ptr<ModelAPI_Document> documentToAdd();
+ PARTSETPLUGIN_EXPORT virtual boost::shared_ptr<ModelAPI_Document> documentToAdd();
/// Use plugin manager for features creation
PartSetPlugin_Part();
ModelAPI_PluginManager::get()->registerPlugin(this);
}
-shared_ptr<ModelAPI_Feature> PartSetPlugin_Plugin::createFeature(string theFeatureID)
+boost::shared_ptr<ModelAPI_Feature> PartSetPlugin_Plugin::createFeature(string theFeatureID)
{
if (theFeatureID == "Part") {
- return shared_ptr<ModelAPI_Feature>(new PartSetPlugin_Part);
+ return boost::shared_ptr<ModelAPI_Feature>(new PartSetPlugin_Part);
}
// feature of such kind is not found
- return shared_ptr<ModelAPI_Feature>();
+ return boost::shared_ptr<ModelAPI_Feature>();
}
{
public:
/// Creates the feature object of this plugin by the feature string ID
- virtual std::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID);
+ virtual boost::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID);
public:
/// Is needed for python wrapping by swig
--- /dev/null
+SET(CMAKE_AUTOMOC ON)
+
+SET(PROJECT_HEADERS
+ SalomeModule.h
+ SalomeModule_Module.h
+)
+
+SET(PROJECT_AUTOMOC
+ ${CMAKE_CURRENT_BINARY_DIR}/XGUI_automoc.cpp
+)
+
+SET(PROJECT_SOURCES
+ SalomeModule_Module.cpp
+)
+
+
+SET(PROJECT_LIBRARIES
+ Event
+ Config
+ ${QT_LIBRARIES}
+ XGUI
+)
+
+ADD_DEFINITIONS( -DSalomeModule_EXPORTS ${CAS_DEFINITIONS} )
+
+INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/src/XGUI
+ ${SALOME_GUI_INCLUDE}
+ ${CAS_INCLUDE_DIRS}
+)
+
+ADD_LIBRARY(SalomeModule SHARED
+ ${PROJECT_SOURCES}
+ ${PROJECT_HEADERS}
+)
+
+ADD_DEPENDENCIES(SalomeModule XGUI)
+
+# The Qt5Widgets_LIBRARIES variable also includes QtGui and QtCore
+TARGET_LINK_LIBRARIES(SalomeModule ${PROJECT_LIBRARIES})
+
+INSTALL(TARGETS SalomeModule DESTINATION bin)
--- /dev/null
+#ifndef SalomeModule_H
+#define SalomeModule_H
+
+#if defined SalomeModule_EXPORTS
+#if defined WIN32
+#define SalomeModule_EXPORT __declspec( dllexport )
+#else
+#define SalomeModule_EXPORT
+#endif
+#else
+#if defined WIN32
+#define SalomeModule_EXPORT __declspec( dllimport )
+#else
+#define SalomeModule_EXPORT
+#endif
+#endif
+
+#endif
+
+
+
--- /dev/null
+
+
+#include "SalomeModule_Module.h"
+
+#include <LightApp_Application.h>
+#include <OCCViewer_ViewModel.h>
+
+
+
+SalomeModule_Module::SalomeModule_Module()
+: LightApp_Module( "NewGeom" )
+{
+}
+
+
+SalomeModule_Module::~SalomeModule_Module()
+{
+}
+
+void SalomeModule_Module::initialize(CAM_Application* theApp)
+{
+}
+
+void SalomeModule_Module::windows(QMap<int, int>& theWndMap) const
+{
+ theWndMap.insert( LightApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
+}
+
+void SalomeModule_Module::viewManagers(QStringList& theList) const
+{
+ theList.append( OCCViewer_Viewer::Type() );
+}
+
+bool SalomeModule_Module::activateModule(SUIT_Study* theStudy)
+{
+ return LightApp_Module::activateModule(theStudy);
+}
+
+bool SalomeModule_Module::deactivateModule(SUIT_Study* theStudy)
+{
+ return LightApp_Module::deactivateModule(theStudy);
+}
+
+
--- /dev/null
+
+
+#ifndef SalomeModule_Module_H
+#define SalomeModule_Module_H
+
+#include <LightApp_Module.h>
+
+class SalomeModule_Module: public LightApp_Module
+{
+ Q_OBJECT
+public:
+ SalomeModule_Module();
+ virtual ~SalomeModule_Module();
+
+ virtual void initialize( CAM_Application* theApp);
+ virtual void windows( QMap<int, int>& theWndMap) const;
+ virtual void viewManagers( QStringList& theList) const;
+
+public slots:
+ bool activateModule( SUIT_Study* theStudy);
+ bool deactivateModule( SUIT_Study* theStudy);
+
+private:
+
+};
+
+#endif
ModelAPI_PluginManager::get()->registerPlugin(this);
}
-shared_ptr<ModelAPI_Feature> SketchPlugin_Plugin::createFeature(string theFeatureID)
+boost::shared_ptr<ModelAPI_Feature> SketchPlugin_Plugin::createFeature(string theFeatureID)
{
if (theFeatureID == "Sketch") {
- return shared_ptr<ModelAPI_Feature>(new SketchPlugin_Sketch);
+ return boost::shared_ptr<ModelAPI_Feature>(new SketchPlugin_Sketch);
}
/*else if (theFeatureID == "Point") {
return shared_ptr<ModelAPI_Feature>(new SketchPlugin_Point);
}*/
// feature of such kind is not found
- return shared_ptr<ModelAPI_Feature>();
+ return boost::shared_ptr<ModelAPI_Feature>();
}
{
public:
/// Creates the feature object of this plugin by the feature string ID
- virtual std::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID);
+ virtual boost::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID);
public:
/// Is needed for python wrapping by swig
typedef QList<double> QDoubleList; //!< list of double values
//! Pointer on feature object
-typedef std::shared_ptr<ModelAPI_Feature> FeaturePtr;
+typedef boost::shared_ptr<ModelAPI_Feature> FeaturePtr;
typedef QList<FeaturePtr> QFeatureList; //!< List of features
namespace XGUI
class XGUI_EXPORT XGUI_FeaturesModel : public QAbstractItemModel
{
public:
- XGUI_FeaturesModel(const std::shared_ptr<ModelAPI_Document>& theDocument, QObject* theParent):
+ XGUI_FeaturesModel(const boost::shared_ptr<ModelAPI_Document>& theDocument, QObject* theParent):
QAbstractItemModel(theParent), myDocument(theDocument) {}
//! Returns Feature object by the given Model index.
virtual FeaturePtr feature(const QModelIndex& theIndex) const = 0;
//! Returns parent index of the given feature
- virtual QModelIndex findParent(const std::shared_ptr<ModelAPI_Feature>& theFeature) const = 0;
+ virtual QModelIndex findParent(const boost::shared_ptr<ModelAPI_Feature>& theFeature) const = 0;
//! Returns index corresponded to the group
virtual QModelIndex findGroup(const std::string& theGroup) const = 0;
protected:
- std::shared_ptr<ModelAPI_Document> myDocument;
+ boost::shared_ptr<ModelAPI_Document> myDocument;
};
class XGUI_PartModel : public XGUI_FeaturesModel
{
public:
- XGUI_PartModel(const std::shared_ptr<ModelAPI_Document>& theDocument, QObject* theParent):
+ XGUI_PartModel(const boost::shared_ptr<ModelAPI_Document>& theDocument, QObject* theParent):
XGUI_FeaturesModel(theDocument, theParent) {}
void setPartId(int theId) { myId = theId; }
//! Returns true if the given document is a sub-document of this tree
- virtual bool hasDocument(const std::shared_ptr<ModelAPI_Document>& theDoc) const = 0;
+ virtual bool hasDocument(const boost::shared_ptr<ModelAPI_Document>& theDoc) const = 0;
protected:
//! Id of the current part object in the document
* Display the feature
* \param theFeature a feature instance
*/
-void XGUI_Displayer::Display(std::shared_ptr<ModelAPI_Feature> theFeature)
+void XGUI_Displayer::Display(boost::shared_ptr<ModelAPI_Feature> theFeature)
{
}
* \param theFeature a feature instance
* \param theFeature a shape
*/
-void XGUI_Displayer::Display(std::shared_ptr<ModelAPI_Feature> theFeature,
+void XGUI_Displayer::Display(boost::shared_ptr<ModelAPI_Feature> theFeature,
const TopoDS_Shape& theShape)
{
Handle(AIS_InteractiveContext) aContext = myViewer->AISContext();
#include "XGUI.h"
#include <QString>
+#include <boost/shared_ptr.hpp>
#include <TopoDS_Shape.hxx>
XGUI_Displayer(XGUI_Viewer* theViewer);
virtual ~XGUI_Displayer();
- void Display(std::shared_ptr<ModelAPI_Feature> theFeature);
+ void Display(boost::shared_ptr<ModelAPI_Feature> theFeature);
- void Display(std::shared_ptr<ModelAPI_Feature> theFeature, const TopoDS_Shape& theShape);
+ void Display(boost::shared_ptr<ModelAPI_Feature> theFeature, const TopoDS_Shape& theShape);
protected:
XGUI_Viewer* myViewer; ///< the viewer
: QAbstractItemModel(theParent)
{
// Find Document object
- std::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
+ boost::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
myDocument = aMgr->currentDocument();
// Register in event loop
// Created object event *******************
if (QString(theMessage->eventID().eventText()) == EVENT_FEATURE_CREATED) {
const ModelAPI_FeatureUpdatedMessage* aUpdMsg = dynamic_cast<const ModelAPI_FeatureUpdatedMessage*>(theMessage);
- std::shared_ptr<ModelAPI_Document> aDoc = aUpdMsg->document();
- std::shared_ptr<ModelAPI_Feature> aFeature = aUpdMsg->feature();
+ boost::shared_ptr<ModelAPI_Document> aDoc = aUpdMsg->document();
+ boost::shared_ptr<ModelAPI_Feature> aFeature = aUpdMsg->feature();
if (aDoc == myDocument) { // If root objects
if (aFeature->getGroup().compare(PARTS_GROUP) == 0) { // Updsate only Parts group
// Deteted object event ***********************
} else if (QString(theMessage->eventID().eventText()) == EVENT_FEATURE_DELETED) {
const ModelAPI_FeatureDeletedMessage* aUpdMsg = dynamic_cast<const ModelAPI_FeatureDeletedMessage*>(theMessage);
- std::shared_ptr<ModelAPI_Document> aDoc = aUpdMsg->document();
+ boost::shared_ptr<ModelAPI_Document> aDoc = aUpdMsg->document();
if (aDoc == myDocument) { // If root objects
if (aUpdMsg->group().compare(PARTS_GROUP) == 0) { // Updsate only Parts group
bool hasSubModel(const QAbstractItemModel* theModel) const;
//! Document
- std::shared_ptr<ModelAPI_Document> myDocument;
+ boost::shared_ptr<ModelAPI_Document> myDocument;
//! Data model of top part of data tree (not parts object)
XGUI_TopDataModel* myModel;
#include <QIcon>
-XGUI_TopDataModel::XGUI_TopDataModel(const std::shared_ptr<ModelAPI_Document>& theDocument, QObject* theParent)
+XGUI_TopDataModel::XGUI_TopDataModel(const boost::shared_ptr<ModelAPI_Document>& theDocument, QObject* theParent)
: XGUI_FeaturesModel(theDocument, theParent)
{
}
return tr("Parameters");
case ParamObject:
{
- std::shared_ptr<ModelAPI_Feature> aFeature = myDocument->feature(PARAMETERS_GROUP, theIndex.row());
+ boost::shared_ptr<ModelAPI_Feature> aFeature = myDocument->feature(PARAMETERS_GROUP, theIndex.row());
if (aFeature)
return aFeature->data()->getName().c_str();
}
return tr("Constructions");
case ConstructObject:
{
- std::shared_ptr<ModelAPI_Feature> aFeature = myDocument->feature(CONSTRUCTIONS_GROUP, theIndex.row());
+ boost::shared_ptr<ModelAPI_Feature> aFeature = myDocument->feature(CONSTRUCTIONS_GROUP, theIndex.row());
if (aFeature)
return aFeature->data()->getName().c_str();
}
}
-QModelIndex XGUI_TopDataModel::findParent(const std::shared_ptr<ModelAPI_Feature>& theFeature) const
+QModelIndex XGUI_TopDataModel::findParent(const boost::shared_ptr<ModelAPI_Feature>& theFeature) const
{
QString aGroup(theFeature->getGroup().c_str());
//******************************************************************
//******************************************************************
//******************************************************************
-XGUI_PartDataModel::XGUI_PartDataModel(const std::shared_ptr<ModelAPI_Document>& theDocument, QObject* theParent)
+XGUI_PartDataModel::XGUI_PartDataModel(const boost::shared_ptr<ModelAPI_Document>& theDocument, QObject* theParent)
: XGUI_PartModel(theDocument, theParent)
{
}
switch (theIndex.internalId()) {
case MyRoot:
{
- std::shared_ptr<ModelAPI_Feature> aFeature = myDocument->feature(PARTS_GROUP, myId);
+ boost::shared_ptr<ModelAPI_Feature> aFeature = myDocument->feature(PARTS_GROUP, myId);
if (aFeature)
return aFeature->data()->getName().c_str();
}
return tr("Constructions");
case ParamObject:
{
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ boost::shared_ptr<ModelAPI_Feature> aFeature =
featureDocument()->feature(PARAMETERS_GROUP, theIndex.row());
if (aFeature)
return aFeature->data()->getName().c_str();
}
case ConstructObject:
{
- std::shared_ptr<ModelAPI_Feature> aFeature =
+ boost::shared_ptr<ModelAPI_Feature> aFeature =
featureDocument()->feature(CONSTRUCTIONS_GROUP, theIndex.row());
if (aFeature)
return aFeature->data()->getName().c_str();
}
-std::shared_ptr<ModelAPI_Document> XGUI_PartDataModel::featureDocument() const
+boost::shared_ptr<ModelAPI_Document> XGUI_PartDataModel::featureDocument() const
{
- std::shared_ptr<ModelAPI_Feature> aFeature = myDocument->feature(PARTS_GROUP, myId);
+ boost::shared_ptr<ModelAPI_Feature> aFeature = myDocument->feature(PARTS_GROUP, myId);
return aFeature->data()->docRef("PartDocument")->value();
}
return FeaturePtr();
}
-bool XGUI_PartDataModel::hasDocument(const std::shared_ptr<ModelAPI_Document>& theDoc) const
+bool XGUI_PartDataModel::hasDocument(const boost::shared_ptr<ModelAPI_Document>& theDoc) const
{
return (featureDocument() == theDoc);
}
-QModelIndex XGUI_PartDataModel::findParent(const std::shared_ptr<ModelAPI_Feature>& theFeature) const
+QModelIndex XGUI_PartDataModel::findParent(const boost::shared_ptr<ModelAPI_Feature>& theFeature) const
{
QString aGroup(theFeature->getGroup().c_str());
{
Q_OBJECT
public:
- XGUI_TopDataModel(const std::shared_ptr<ModelAPI_Document>& theDocument, QObject* theParent);
+ XGUI_TopDataModel(const boost::shared_ptr<ModelAPI_Document>& theDocument, QObject* theParent);
virtual ~XGUI_TopDataModel();
// Reimplementation from QAbstractItemModel
virtual FeaturePtr feature(const QModelIndex& theIndex) const;
//! Returns parent index of the given feature
- virtual QModelIndex findParent(const std::shared_ptr<ModelAPI_Feature>& theFeature) const;
+ virtual QModelIndex findParent(const boost::shared_ptr<ModelAPI_Feature>& theFeature) const;
//! Returns index corresponded to the group
virtual QModelIndex findGroup(const std::string& theGroup) const;
{
Q_OBJECT
public:
- XGUI_PartDataModel(const std::shared_ptr<ModelAPI_Document>& theDocument, QObject* theParent);
+ XGUI_PartDataModel(const boost::shared_ptr<ModelAPI_Document>& theDocument, QObject* theParent);
virtual ~XGUI_PartDataModel();
// Reimplementation from QAbstractItemModel
virtual FeaturePtr feature(const QModelIndex& theIndex) const;
//! Returns true if the given document is a sub-document of this tree
- virtual bool hasDocument(const std::shared_ptr<ModelAPI_Document>& theDoc) const;
+ virtual bool hasDocument(const boost::shared_ptr<ModelAPI_Document>& theDoc) const;
//! Returns parent index of the given feature
- virtual QModelIndex findParent(const std::shared_ptr<ModelAPI_Feature>& theFeature) const;
+ virtual QModelIndex findParent(const boost::shared_ptr<ModelAPI_Feature>& theFeature) const;
//! Returns index corresponded to the group
virtual QModelIndex findGroup(const std::string& theGroup) const;
private:
- std::shared_ptr<ModelAPI_Document> featureDocument() const;
+ boost::shared_ptr<ModelAPI_Document> featureDocument() const;
//! Types of QModelIndexes
enum DataIds {
if (mySelectedData.size() > 0) {
FeaturePtr aFeature = mySelectedData.first();
- std::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
- std::shared_ptr<ModelAPI_AttributeDocRef> aDocRef = aFeature->data()->docRef("PartDocument");
+ boost::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
+ boost::shared_ptr<ModelAPI_AttributeDocRef> aDocRef = aFeature->data()->docRef("PartDocument");
if (aDocRef)
aMgr->setCurrentDocument(aDocRef->value());
}
updateCommandStatus();
onNew();
// Testing of document creation
- //std::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
- //std::shared_ptr<ModelAPI_Feature> aPoint1 = aMgr->rootDocument()->addFeature("Point");
- //std::shared_ptr<ModelAPI_Feature> aPart = aMgr->rootDocument()->addFeature("Part");
+ //boost::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
+ //boost::shared_ptr<ModelAPI_Feature> aPoint1 = aMgr->rootDocument()->addFeature("Point");
+ //boost::shared_ptr<ModelAPI_Feature> aPart = aMgr->rootDocument()->addFeature("Part");
//aPart->execute();
//aMgr->setCurrentDocument(aPart->data()->docRef("PartDocument")->value());
- //std::shared_ptr<ModelAPI_Feature> aPoint2 = aMgr->rootDocument()->addFeature("Point");
+ //boost::shared_ptr<ModelAPI_Feature> aPoint2 = aMgr->rootDocument()->addFeature("Point");
//aPoint2 = aMgr->rootDocument()->addFeature("Point");
//aPart = aMgr->rootDocument()->addFeature("Part");
void XGUI_Workshop::onUndo()
{
myMainWindow->objectBrowser()->setCurrentIndex(QModelIndex());
- std::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
- std::shared_ptr<ModelAPI_Document> aDoc = aMgr->rootDocument();
+ boost::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
+ boost::shared_ptr<ModelAPI_Document> aDoc = aMgr->rootDocument();
aDoc->undo();
updateCommandStatus();
}
void XGUI_Workshop::onRedo()
{
myMainWindow->objectBrowser()->setCurrentIndex(QModelIndex());
- std::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
- std::shared_ptr<ModelAPI_Document> aDoc = aMgr->rootDocument();
+ boost::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
+ boost::shared_ptr<ModelAPI_Document> aDoc = aMgr->rootDocument();
aDoc->redo();
updateCommandStatus();
}
QList<XGUI_Command*> aCommands = aMenuBar->features();
QList<XGUI_Command*>::const_iterator aIt;
- std::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
+ boost::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
if (aMgr->hasRootDocument()) {
XGUI_Command* aUndoCmd;
XGUI_Command* aRedoCmd;
else // Enable all commands
(*aIt)->enable();
}
- std::shared_ptr<ModelAPI_Document> aDoc = aMgr->rootDocument();
+ boost::shared_ptr<ModelAPI_Document> aDoc = aMgr->rootDocument();
aUndoCmd->setEnabled(aDoc->canUndo());
aRedoCmd->setEnabled(aDoc->canRedo());
} else {