Events_ID aMenuItemEvent = Events_Loop::eventByName(myEventGenerated);
if (isNode(theNode, NODE_FEATURE, NULL)) {
storeAttribute(theNode, _ID);
- boost::shared_ptr<Config_FeatureMessage> aMessage(new Config_FeatureMessage(aMenuItemEvent, this));
+ std::shared_ptr<Config_FeatureMessage> aMessage(new Config_FeatureMessage(aMenuItemEvent, this));
fillFeature(theNode, aMessage);
myFeatures.push_back(getProperty(theNode, _ID));
//If a feature has xml definition for it's widget:
storeAttribute(theNode, _ID);
storeAttribute(theNode, WORKBENCH_DOC);
} else if (myIsProcessWidgets && isWidgetNode(theNode)) {
- boost::shared_ptr<Config_AttributeMessage> aMessage(new Config_AttributeMessage(aMenuItemEvent, this));
+ std::shared_ptr<Config_AttributeMessage> aMessage(new Config_AttributeMessage(aMenuItemEvent, this));
aMessage->setFeatureId(restoreAttribute(NODE_FEATURE, _ID));
std::string anAttributeID = getProperty(theNode, _ID);
if (!anAttributeID.empty()) {
}
void Config_FeatureReader::fillFeature(xmlNodePtr theNode,
- const boost::shared_ptr<Config_FeatureMessage>& outFeatureMessage)
+ const std::shared_ptr<Config_FeatureMessage>& outFeatureMessage)
{
outFeatureMessage->setId(getProperty(theNode, _ID));
outFeatureMessage->setPluginLibrary(myLibraryName);
#include <Config_def.h>
#include <Config_XMLReader.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <string>
#include <list>
bool processChildren(xmlNodePtr aNode);
void fillFeature(xmlNodePtr theRoot,
- const boost::shared_ptr<Config_FeatureMessage>& outFeatureMessage);
+ const std::shared_ptr<Config_FeatureMessage>& outFeatureMessage);
void storeAttribute(xmlNodePtr theNode, const char* theNodeAttribute);
std::string restoreAttribute(xmlNodePtr theNode, const char* theNodeAttribute);
if (theValue != myValue) {
myValue = theValue;
static const Events_ID aChangedEvent = Events_Loop::loop()->eventByName("PreferenceChanged");
- Events_Loop::loop()->send(boost::shared_ptr<Events_Message>(
+ Events_Loop::loop()->send(std::shared_ptr<Events_Message>(
new Events_Message(aChangedEvent, this)));
}
}
{
Events_ID aValidatoEvent = Events_Loop::eventByName(EVENT_VALIDATOR_LOADED);
Events_Loop* aEvLoop = Events_Loop::loop();
- boost::shared_ptr<Config_ValidatorMessage>
+ std::shared_ptr<Config_ValidatorMessage>
aMessage(new Config_ValidatorMessage(aValidatoEvent, this));
std::string aValidatorId;
std::list<std::string> aValidatorParameters;
void ConstructionPlugin_Point::execute()
{
- boost::shared_ptr<GeomAPI_Pnt> aPnt(
+ std::shared_ptr<GeomAPI_Pnt> aPnt(
new GeomAPI_Pnt(data()->real(POINT_ATTR_X)->value(), data()->real(POINT_ATTR_Y)->value(),
data()->real(POINT_ATTR_Z)->value()));
- boost::shared_ptr<ModelAPI_ResultConstruction> aConstr = document()->createConstruction(data());
+ std::shared_ptr<ModelAPI_ResultConstruction> aConstr = document()->createConstruction(data());
aConstr->setShape(GeomAlgoAPI_PointBuilder::point(aPnt));
setResult(aConstr);
}
void Events_Error::send(char* theDescription, const void* theSender)
{
- boost::shared_ptr<Events_Message> aNewOne =
- boost::shared_ptr<Events_Message>(new Events_Error(theDescription, theSender));
+ std::shared_ptr<Events_Message> aNewOne =
+ std::shared_ptr<Events_Message>(new Events_Error(theDescription, theSender));
Events_Loop::loop()->send(aNewOne);
}
#define Events_Listener_H_
#include <Events.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
class Events_Message;
public:
//! This method is called by loop when the event is started to process.
- virtual void processEvent(const boost::shared_ptr<Events_Message>& theMessage) = 0;
+ virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage) = 0;
};
#endif
MY_SENDERS[theSender]++;
if (toSend) {
- boost::shared_ptr<Events_Message> aNewOne =
- boost::shared_ptr<Events_Message>(new Events_LongOp(theSender));
+ std::shared_ptr<Events_Message> aNewOne =
+ std::shared_ptr<Events_Message>(new Events_LongOp(theSender));
Events_Loop::loop()->send(aNewOne);
}
}
MY_SENDERS[theSender] = aCount - 1;
}
if (MY_SENDERS.empty()) {
- boost::shared_ptr<Events_Message> aNewOne =
- boost::shared_ptr<Events_Message>(new Events_LongOp(theSender));
+ std::shared_ptr<Events_Message> aNewOne =
+ std::shared_ptr<Events_Message>(new Events_LongOp(theSender));
Events_Loop::loop()->send(aNewOne);
}
}
return Events_ID(aResult);
}
-void Events_Loop::send(const boost::shared_ptr<Events_Message>& theMessage, bool isGroup)
+void Events_Loop::send(const std::shared_ptr<Events_Message>& theMessage, bool isGroup)
{
if (myImmediateListeners.find(theMessage->eventID().eventText()) != myImmediateListeners.end()) {
myImmediateListeners[theMessage->eventID().eventText()]->processEvent(theMessage);
}
// if it is grouped message, just accumulate it
if (isGroup && myFlushed.find(theMessage->eventID().myID) == myFlushed.end()) {
- boost::shared_ptr<Events_MessageGroup> aGroup =
- boost::dynamic_pointer_cast<Events_MessageGroup>(theMessage);
+ std::shared_ptr<Events_MessageGroup> aGroup =
+ std::dynamic_pointer_cast<Events_MessageGroup>(theMessage);
if (aGroup) {
- std::map<char*, boost::shared_ptr<Events_Message> >::iterator aMyGroup = myGroups.find(
+ std::map<char*, std::shared_ptr<Events_Message> >::iterator aMyGroup = myGroups.find(
aGroup->eventID().eventText());
if (aMyGroup == myGroups.end()) { // create a new group of messages for accumulation
myGroups[aGroup->eventID().eventText()] = aGroup->newEmpty();
aMyGroup = myGroups.find(aGroup->eventID().eventText());
}
- boost::shared_ptr<Events_MessageGroup> aStored =
- boost::dynamic_pointer_cast<Events_MessageGroup>(aMyGroup->second);
+ std::shared_ptr<Events_MessageGroup> aStored =
+ std::dynamic_pointer_cast<Events_MessageGroup>(aMyGroup->second);
aStored->Join(aGroup);
return;
}
{
if (!myFlushActive)
return;
- std::map<char*, boost::shared_ptr<Events_Message>>::iterator aMyGroup =
+ std::map<char*, std::shared_ptr<Events_Message>>::iterator aMyGroup =
myGroups.find(theID.eventText());
if (aMyGroup != myGroups.end()) { // really sends
myFlushed.insert(theID.myID);
- boost::shared_ptr<Events_Message> aGroup = aMyGroup->second;
+ std::shared_ptr<Events_Message> aGroup = aMyGroup->second;
myGroups.erase(aMyGroup);
send(aGroup, false);
myFlushed.erase(myFlushed.find(theID.myID));
void Events_Loop::clear(const Events_ID& theID)
{
- std::map<char*, boost::shared_ptr<Events_Message>>::iterator aMyGroup =
+ std::map<char*, std::shared_ptr<Events_Message>>::iterator aMyGroup =
myGroups.find(theID.eventText());
if (aMyGroup != myGroups.end()) { // really sends
myGroups.erase(aMyGroup);
std::map<char*, Events_Listener*> myImmediateListeners;
/// map from event ID to groupped messages (accumulated on flush)
- std::map<char*, boost::shared_ptr<Events_Message> > myGroups;
+ std::map<char*, std::shared_ptr<Events_Message> > myGroups;
///< set of messages that are flushed right now, so they are not grouped
std::set<char*> myFlushed;
//! Allows to send an event
//! \param isGroup is true for grouping messages if possible
- EVENTS_EXPORT void send(const boost::shared_ptr<Events_Message>& theMessage, bool isGroup = true);
+ EVENTS_EXPORT void send(const std::shared_ptr<Events_Message>& theMessage, bool isGroup = true);
//! Registers (or adds if such listener is already registered) a listener
//! that will be called on the event and from the defined sender
#define Events_MessageGroup_H_
#include <Events_Message.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
/**\class Events_Message
* \ingroup EventsLoop
virtual ~Events_MessageGroup();
//! Creates a new empty group (to store it in the loop before flush)
- virtual boost::shared_ptr<Events_MessageGroup> newEmpty() = 0;
+ virtual std::shared_ptr<Events_MessageGroup> newEmpty() = 0;
//! Allows to join the given message with the current one
- virtual void Join(const boost::shared_ptr<Events_MessageGroup>& theJoined) = 0;
+ virtual void Join(const std::shared_ptr<Events_MessageGroup>& theJoined) = 0;
};
#endif
*/
void ExchangePlugin_ImportFeature::execute()
{
- AttributeStringPtr aFilePathAttr = boost::dynamic_pointer_cast<ModelAPI_AttributeString>(
+ AttributeStringPtr aFilePathAttr = std::dynamic_pointer_cast<ModelAPI_AttributeString>(
data()->attribute(ExchangePlugin_ImportFeature::FILE_PATH_ID()));
std::string aFilePath = aFilePathAttr->value();
if(aFilePath.empty())
// Pass the results into the model
std::string anObjectName = aPath.Name().ToCString();
data()->setName(anObjectName);
- boost::shared_ptr<ModelAPI_ResultBody> aResultBody = document()->createBody(data());
- boost::shared_ptr<GeomAPI_Shape> aGeomShape(new GeomAPI_Shape);
+ std::shared_ptr<ModelAPI_ResultBody> aResultBody = document()->createBody(data());
+ std::shared_ptr<GeomAPI_Shape> aGeomShape(new GeomAPI_Shape);
aGeomShape->setImpl(new TopoDS_Shape(aShape));
//LoadNamingDS of the imported shape
//============================================================================
void ExchangePlugin_ImportFeature::loadNamingDS(
- boost::shared_ptr<GeomAPI_Shape> theGeomShape,
- boost::shared_ptr<ModelAPI_ResultBody> theResultBody)
+ std::shared_ptr<GeomAPI_Shape> theGeomShape,
+ std::shared_ptr<ModelAPI_ResultBody> theResultBody)
{
//load result
theResultBody->store(theGeomShape);
private:
/// Loads Naming data structure to the document
- void loadNamingDS(boost::shared_ptr<GeomAPI_Shape> theGeomShape,
- boost::shared_ptr<ModelAPI_ResultBody> theResultBody);
+ void loadNamingDS(std::shared_ptr<GeomAPI_Shape> theGeomShape,
+ std::shared_ptr<ModelAPI_ResultBody> theResultBody);
};
#endif /* IMPORT_IMPORTFEATURE_H_ */
#include <ModelAPI_Session.h>
#include <ModelAPI_Validator.h>
-#include <boost/smart_ptr/shared_ptr.hpp>
+#include <memory>
using namespace std;
ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
if (theAttribute->isInitialized()) {
const AttributeStringPtr aStrAttr =
- boost::dynamic_pointer_cast<ModelAPI_AttributeString>(theAttribute);
+ std::dynamic_pointer_cast<ModelAPI_AttributeString>(theAttribute);
if(!aStrAttr)
return false;
std::string aFileName = aStrAttr->value();
data()->addAttribute(FeaturesPlugin_Boolean::TOOL_ID(), ModelAPI_AttributeReference::type());
}
-boost::shared_ptr<GeomAPI_Shape> FeaturesPlugin_Boolean::getShape(const std::string& theAttrName)
+std::shared_ptr<GeomAPI_Shape> FeaturesPlugin_Boolean::getShape(const std::string& theAttrName)
{
- boost::shared_ptr<ModelAPI_AttributeReference> aObjRef = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_AttributeReference> aObjRef = std::dynamic_pointer_cast<
ModelAPI_AttributeReference>(data()->attribute(theAttrName));
if (aObjRef) {
- boost::shared_ptr<ModelAPI_ResultBody> aConstr = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_ResultBody> aConstr = std::dynamic_pointer_cast<
ModelAPI_ResultBody>(aObjRef->value());
if (aConstr)
return aConstr->shape();
}
- return boost::shared_ptr<GeomAPI_Shape>();
+ return std::shared_ptr<GeomAPI_Shape>();
}
void FeaturesPlugin_Boolean::execute()
{
- boost::shared_ptr<ModelAPI_AttributeInteger> aTypeAttr = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_AttributeInteger> aTypeAttr = std::dynamic_pointer_cast<
ModelAPI_AttributeInteger>(data()->attribute(FeaturesPlugin_Boolean::TYPE_ID()));
if (!aTypeAttr)
return;
int aType = aTypeAttr->value();
- boost::shared_ptr<GeomAPI_Shape> anObject = this->getShape(FeaturesPlugin_Boolean::OBJECT_ID());
+ std::shared_ptr<GeomAPI_Shape> anObject = this->getShape(FeaturesPlugin_Boolean::OBJECT_ID());
if (!anObject)
return;
- boost::shared_ptr<GeomAPI_Shape> aTool = this->getShape(FeaturesPlugin_Boolean::TOOL_ID());
+ std::shared_ptr<GeomAPI_Shape> aTool = this->getShape(FeaturesPlugin_Boolean::TOOL_ID());
if (!aTool)
return;
- boost::shared_ptr<ModelAPI_ResultBody> aResultBody = document()->createBody(data());
+ std::shared_ptr<ModelAPI_ResultBody> aResultBody = document()->createBody(data());
GeomAlgoAPI_Boolean* aFeature = new GeomAlgoAPI_Boolean(anObject, aTool, aType);
if(aFeature && !aFeature->isDone()) {
//============================================================================
void FeaturesPlugin_Boolean::LoadNamingDS(GeomAlgoAPI_Boolean* theFeature,
- boost::shared_ptr<ModelAPI_ResultBody> theResultBody,
- boost::shared_ptr<GeomAPI_Shape> theObject,
- boost::shared_ptr<GeomAPI_Shape> theTool,
+ std::shared_ptr<ModelAPI_ResultBody> theResultBody,
+ std::shared_ptr<GeomAPI_Shape> theObject,
+ std::shared_ptr<GeomAPI_Shape> theTool,
int theType)
{
FeaturesPlugin_Boolean();
private:
- boost::shared_ptr<GeomAPI_Shape> getShape(const std::string& theAttrName);
+ std::shared_ptr<GeomAPI_Shape> getShape(const std::string& theAttrName);
/// Load Naming data structure of the feature to the document
void LoadNamingDS(GeomAlgoAPI_Boolean* theFeature,
- boost::shared_ptr<ModelAPI_ResultBody> theResultBody,
- boost::shared_ptr<GeomAPI_Shape> theObject,
- boost::shared_ptr<GeomAPI_Shape> theTool,
+ std::shared_ptr<ModelAPI_ResultBody> theResultBody,
+ std::shared_ptr<GeomAPI_Shape> theObject,
+ std::shared_ptr<GeomAPI_Shape> theTool,
int theType);
};
void FeaturesPlugin_Extrusion::execute()
{
- boost::shared_ptr<ModelAPI_AttributeSelection> aFaceRef = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_AttributeSelection> aFaceRef = std::dynamic_pointer_cast<
ModelAPI_AttributeSelection>(data()->attribute(FeaturesPlugin_Extrusion::FACE_ID()));
if (!aFaceRef)
return;
- boost::shared_ptr<GeomAPI_Shape> aFace =
- boost::dynamic_pointer_cast<GeomAPI_Shape>(aFaceRef->value());
+ std::shared_ptr<GeomAPI_Shape> aFace =
+ std::dynamic_pointer_cast<GeomAPI_Shape>(aFaceRef->value());
if (!aFace)
return;
- boost::shared_ptr<GeomAPI_Shape> aContext;
+ std::shared_ptr<GeomAPI_Shape> aContext;
ResultPtr aContextRes = aFaceRef->context();
if (aContextRes) {
if (aContextRes->groupName() == ModelAPI_ResultBody::group())
- aContext = boost::dynamic_pointer_cast<ModelAPI_ResultBody>(aContextRes)->shape();
+ aContext = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aContextRes)->shape();
else if (aContextRes->groupName() == ModelAPI_ResultConstruction::group())
- aContext = boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aContextRes)->shape();
+ aContext = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aContextRes)->shape();
}
if (!aContext) {
std::string aContextError = "The selection context is bad";
if (data()->boolean(FeaturesPlugin_Extrusion::REVERSE_ID())->value())
aSize = -aSize;
- boost::shared_ptr<ModelAPI_ResultBody> aResultBody = document()->createBody(data());
+ std::shared_ptr<ModelAPI_ResultBody> aResultBody = document()->createBody(data());
GeomAlgoAPI_Extrusion aFeature(aFace, aSize);
if(!aFeature.isDone()) {
std::string aFeatureError = "Extrusion algorithm failed";
//============================================================================
void FeaturesPlugin_Extrusion::LoadNamingDS(GeomAlgoAPI_Extrusion& theFeature,
- boost::shared_ptr<ModelAPI_ResultBody> theResultBody,
- boost::shared_ptr<GeomAPI_Shape> theBasis,
- boost::shared_ptr<GeomAPI_Shape> theContext)
+ std::shared_ptr<ModelAPI_ResultBody> theResultBody,
+ std::shared_ptr<GeomAPI_Shape> theBasis,
+ std::shared_ptr<GeomAPI_Shape> theContext)
{
theResultBody->loadAndOrientGeneratedShapes(theFeature.makeShape(), theBasis, EDGE,_LATERAL_TAG, *aSubShapes);
//Insert bottom face
- boost::shared_ptr<GeomAPI_Shape> aBottomFace = theFeature.firstShape();
+ std::shared_ptr<GeomAPI_Shape> aBottomFace = theFeature.firstShape();
if (!aBottomFace->isNull()) {
if (aSubShapes->isBound(aBottomFace)) {
aBottomFace = aSubShapes->find(aBottomFace);
//Insert top face
- boost::shared_ptr<GeomAPI_Shape> aTopFace = theFeature.lastShape();
+ std::shared_ptr<GeomAPI_Shape> aTopFace = theFeature.lastShape();
if (!aTopFace->isNull()) {
if (aSubShapes->isBound(aTopFace)) {
aTopFace = aSubShapes->find(aTopFace);
FeaturesPlugin_Extrusion();
private:
/// Load Naming data structure of the feature to the document
- void LoadNamingDS(GeomAlgoAPI_Extrusion& theFeature, boost::shared_ptr<ModelAPI_ResultBody> theResultBody,
- boost::shared_ptr<GeomAPI_Shape> theBasis,
- boost::shared_ptr<GeomAPI_Shape> theContext);
+ void LoadNamingDS(GeomAlgoAPI_Extrusion& theFeature, std::shared_ptr<ModelAPI_ResultBody> theResultBody,
+ std::shared_ptr<GeomAPI_Shape> theBasis,
+ std::shared_ptr<GeomAPI_Shape> theContext);
};
#endif
#include <string>
-#include <boost/smart_ptr/shared_ptr.hpp>
+#include <memory>
using namespace std;
/* GeomAPI.i */
%module GeomAPI
%{
- #include "boost/shared_ptr.hpp"
#include "GeomAPI.h"
#include "GeomAPI_Interface.h"
#include "GeomAPI_Pnt.h"
// standard definitions
%include "typemaps.i"
%include "std_string.i"
-//%include <std_shared_ptr.i>
-%include <boost_shared_ptr.i>
+%include "std_shared_ptr.i"
-// boost pointers
-// %include <boost_shared_ptr.i>
+// shared pointers
%shared_ptr(GeomAPI_Interface)
%shared_ptr(GeomAPI_Pnt)
%shared_ptr(GeomAPI_Dir)
{
}
-void GeomAPI_AISObject::createShape(boost::shared_ptr<GeomAPI_Shape> theShape)
+void GeomAPI_AISObject::createShape(std::shared_ptr<GeomAPI_Shape> theShape)
{
const TopoDS_Shape& aTDS =
(theShape && theShape->implPtr<TopoDS_Shape>()) ?
setImpl(new Handle(AIS_InteractiveObject)(new AIS_Shape(aTDS)));
}
-void GeomAPI_AISObject::createDistance(boost::shared_ptr<GeomAPI_Pnt> theStartPoint,
- boost::shared_ptr<GeomAPI_Pnt> theEndPoint,
- boost::shared_ptr<GeomAPI_Pnt> theFlyoutPoint,
- boost::shared_ptr<GeomAPI_Pln> thePlane, double theDistance)
+void GeomAPI_AISObject::createDistance(std::shared_ptr<GeomAPI_Pnt> theStartPoint,
+ std::shared_ptr<GeomAPI_Pnt> theEndPoint,
+ std::shared_ptr<GeomAPI_Pnt> theFlyoutPoint,
+ std::shared_ptr<GeomAPI_Pln> thePlane, double theDistance)
{
double aFlyout = 0;
if (theFlyoutPoint) {
if (theStartPoint->distance(theEndPoint) < tolerance)
aDist = theStartPoint->distance(theFlyoutPoint);
else {
- boost::shared_ptr<GeomAPI_Lin> aLine = boost::shared_ptr<GeomAPI_Lin>(
+ std::shared_ptr<GeomAPI_Lin> aLine = std::shared_ptr<GeomAPI_Lin>(
new GeomAPI_Lin(theStartPoint, theEndPoint));
aDist = aLine->distance(theFlyoutPoint);
}
- boost::shared_ptr<GeomAPI_XYZ> aLineDir = theEndPoint->xyz()->decreased(theStartPoint->xyz());
- boost::shared_ptr<GeomAPI_XYZ> aFOutDir = theFlyoutPoint->xyz()->decreased(
+ std::shared_ptr<GeomAPI_XYZ> aLineDir = theEndPoint->xyz()->decreased(theStartPoint->xyz());
+ std::shared_ptr<GeomAPI_XYZ> aFOutDir = theFlyoutPoint->xyz()->decreased(
theStartPoint->xyz());
- boost::shared_ptr<GeomAPI_XYZ> aNorm = thePlane->direction()->xyz();
+ std::shared_ptr<GeomAPI_XYZ> aNorm = thePlane->direction()->xyz();
if (aLineDir->cross(aFOutDir)->dot(aNorm) < 0)
aDist = -aDist;
aFlyout = aDist;
}
}
-void GeomAPI_AISObject::createRadius(boost::shared_ptr<GeomAPI_Circ> theCircle,
- boost::shared_ptr<GeomAPI_Pnt> theFlyoutPoint,
+void GeomAPI_AISObject::createRadius(std::shared_ptr<GeomAPI_Circ> theCircle,
+ std::shared_ptr<GeomAPI_Pnt> theFlyoutPoint,
double theRadius)
{
- boost::shared_ptr<GeomAPI_Pnt> aCenter = theCircle->center();
+ std::shared_ptr<GeomAPI_Pnt> aCenter = theCircle->center();
// TODO: a bug in AIS_RadiusDimension:
// The anchor point can't be myCirc.Location() - an exception is raised.
// We want to show a radius dimension starting from the circle centre and
// ending at the user-defined point.
// Also, if anchor point coincides with myP2, the radius dimension is not displayed at all.
- boost::shared_ptr<GeomAPI_Pnt> anAnchor = theCircle->project(theFlyoutPoint);
- boost::shared_ptr<GeomAPI_XYZ> anAnchorXYZ = anAnchor->xyz();
+ std::shared_ptr<GeomAPI_Pnt> anAnchor = theCircle->project(theFlyoutPoint);
+ std::shared_ptr<GeomAPI_XYZ> anAnchorXYZ = anAnchor->xyz();
anAnchorXYZ = anAnchorXYZ->decreased(aCenter->xyz());
- boost::shared_ptr<GeomAPI_Dir> aDeltaDir(new GeomAPI_Dir(anAnchorXYZ));
+ std::shared_ptr<GeomAPI_Dir> aDeltaDir(new GeomAPI_Dir(anAnchorXYZ));
const double aDelta = 1e-3;
anAnchor->setX(anAnchor->x() + aDelta * aDeltaDir->x());
anAnchor->setY(anAnchor->y() + aDelta * aDeltaDir->y());
}
}
-void GeomAPI_AISObject::createParallel(boost::shared_ptr<GeomAPI_Shape> theLine1,
- boost::shared_ptr<GeomAPI_Shape> theLine2,
- boost::shared_ptr<GeomAPI_Pnt> theFlyoutPoint,
- boost::shared_ptr<GeomAPI_Pln> thePlane)
+void GeomAPI_AISObject::createParallel(std::shared_ptr<GeomAPI_Shape> theLine1,
+ std::shared_ptr<GeomAPI_Shape> theLine2,
+ std::shared_ptr<GeomAPI_Pnt> theFlyoutPoint,
+ std::shared_ptr<GeomAPI_Pln> thePlane)
{
Handle(Geom_Plane) aPlane = new Geom_Plane(thePlane->impl<gp_Pln>());
Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
}
}
-void GeomAPI_AISObject::createPerpendicular(boost::shared_ptr<GeomAPI_Shape> theLine1,
- boost::shared_ptr<GeomAPI_Shape> theLine2,
- boost::shared_ptr<GeomAPI_Pln> thePlane)
+void GeomAPI_AISObject::createPerpendicular(std::shared_ptr<GeomAPI_Shape> theLine1,
+ std::shared_ptr<GeomAPI_Shape> theLine2,
+ std::shared_ptr<GeomAPI_Pln> thePlane)
{
Handle(Geom_Plane) aPlane = new Geom_Plane(thePlane->impl<gp_Pln>());
Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
}
-void GeomAPI_AISObject::createFixed(boost::shared_ptr<GeomAPI_Shape> theShape,
- boost::shared_ptr<GeomAPI_Pln> thePlane)
+void GeomAPI_AISObject::createFixed(std::shared_ptr<GeomAPI_Shape> theShape,
+ std::shared_ptr<GeomAPI_Pln> thePlane)
{
Handle(Geom_Plane) aPlane = new Geom_Plane(thePlane->impl<gp_Pln>());
Handle(AIS_InteractiveObject) anAIS = impl<Handle(AIS_InteractiveObject)>();
#include <GeomAPI_Interface.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
class GeomAPI_Circ;
class GeomAPI_Lin;
GeomAPI_AISObject();
/// \brief Creates AIS_Shape object using specified shape
- void createShape(boost::shared_ptr<GeomAPI_Shape> theShape);
+ void createShape(std::shared_ptr<GeomAPI_Shape> theShape);
/** \brief Creates AIS_LengthDimension object
* \param[in] theStartPoint first point for dimension
* \param[in] thePlane the plane which contains all points above
* \param[in] theDistance value of the distance to be shown
*/
- void createDistance(boost::shared_ptr<GeomAPI_Pnt> theStartPoint,
- boost::shared_ptr<GeomAPI_Pnt> theEndPoint,
- boost::shared_ptr<GeomAPI_Pnt> theFlyoutPoint,
- boost::shared_ptr<GeomAPI_Pln> thePlane, double theDistance);
+ void createDistance(std::shared_ptr<GeomAPI_Pnt> theStartPoint,
+ std::shared_ptr<GeomAPI_Pnt> theEndPoint,
+ std::shared_ptr<GeomAPI_Pnt> theFlyoutPoint,
+ std::shared_ptr<GeomAPI_Pln> thePlane, double theDistance);
/** \brief Creates AIS_RadiusDimension object
* \param[in] theCircle the radius is created for this circle
* \param[in] theFlyoutPoint the flyout of dimension
* \param[in] theRadius value of the radius to be shown
*/
- void createRadius(boost::shared_ptr<GeomAPI_Circ> theCircle,
- boost::shared_ptr<GeomAPI_Pnt> theFlyoutPoint, double theRadius);
+ void createRadius(std::shared_ptr<GeomAPI_Circ> theCircle,
+ std::shared_ptr<GeomAPI_Pnt> theFlyoutPoint, double theRadius);
/** \brief Creates AIS_ParallelRelation object for two lines
* \param[in] theLine1 first parallel line
* \param[in] theFlyoutPoint the flyout point for relation
* \param[in] thePlane the plane which contains the lines
*/
- void createParallel(boost::shared_ptr<GeomAPI_Shape> theLine1,
- boost::shared_ptr<GeomAPI_Shape> theLine2,
- boost::shared_ptr<GeomAPI_Pnt> theFlyoutPoint,
- boost::shared_ptr<GeomAPI_Pln> thePlane);
+ void createParallel(std::shared_ptr<GeomAPI_Shape> theLine1,
+ std::shared_ptr<GeomAPI_Shape> theLine2,
+ std::shared_ptr<GeomAPI_Pnt> theFlyoutPoint,
+ std::shared_ptr<GeomAPI_Pln> thePlane);
/** \brief Creates AIS_PerpendicularRelation object for two lines
* \param[in] theLine1 first parallel line
* \param[in] theLine2 second parallel line
* \param[in] thePlane the plane which contains the lines
*/
- void createPerpendicular(boost::shared_ptr<GeomAPI_Shape> theLine1,
- boost::shared_ptr<GeomAPI_Shape> theLine2,
- boost::shared_ptr<GeomAPI_Pln> thePlane);
+ void createPerpendicular(std::shared_ptr<GeomAPI_Shape> theLine1,
+ std::shared_ptr<GeomAPI_Shape> theLine2,
+ std::shared_ptr<GeomAPI_Pln> thePlane);
/** \brief Creates AIS_FixedRelation object for an object
* \param[in] theShape the object
* \param[in] thePlane the plane which contains the lines
*/
- void createFixed(boost::shared_ptr<GeomAPI_Shape> theShape,
- boost::shared_ptr<GeomAPI_Pln> thePlane);
+ void createFixed(std::shared_ptr<GeomAPI_Shape> theShape,
+ std::shared_ptr<GeomAPI_Pln> thePlane);
/** \brief Assigns the color for the shape
* \param[in] theColor index of the color
};
//! Pointer on attribute object
-typedef boost::shared_ptr<GeomAPI_AISObject> AISObjectPtr;
+typedef std::shared_ptr<GeomAPI_AISObject> AISObjectPtr;
#endif
return new gp_Circ(gp_Ax2(theCenter, theDir), theRadius);
}
-GeomAPI_Circ::GeomAPI_Circ(const boost::shared_ptr<GeomAPI_Pnt>& theCenter,
- const boost::shared_ptr<GeomAPI_Dir>& theDir, double theRadius)
+GeomAPI_Circ::GeomAPI_Circ(const std::shared_ptr<GeomAPI_Pnt>& theCenter,
+ const std::shared_ptr<GeomAPI_Dir>& theDir, double theRadius)
: GeomAPI_Interface(newCirc(theCenter->impl<gp_Pnt>(), theDir->impl<gp_Dir>(), theRadius))
{
}
-const boost::shared_ptr<GeomAPI_Pnt> GeomAPI_Circ::project(
- const boost::shared_ptr<GeomAPI_Pnt>& thePoint) const
+const std::shared_ptr<GeomAPI_Pnt> GeomAPI_Circ::project(
+ const std::shared_ptr<GeomAPI_Pnt>& thePoint) const
{
- boost::shared_ptr<GeomAPI_Pnt> aResult;
+ std::shared_ptr<GeomAPI_Pnt> aResult;
if (!MY_CIRC)
return aResult;
aDistance = aNewPoint.Distance(aPoint);
if (!aMinDistance || aDistance < aMinDistance) {
aMinDistance = aDistance;
- aResult = boost::shared_ptr<GeomAPI_Pnt>(
+ aResult = std::shared_ptr<GeomAPI_Pnt>(
new GeomAPI_Pnt(aNewPoint.X(), aNewPoint.Y(), aNewPoint.Z()));
}
}
return aResult;
}
-const boost::shared_ptr<GeomAPI_Pnt> GeomAPI_Circ::center() const
+const std::shared_ptr<GeomAPI_Pnt> GeomAPI_Circ::center() const
{
const gp_Pnt& aCenter = MY_CIRC->Location();
- return boost::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aCenter.X(), aCenter.Y(), aCenter.Z()));
+ return std::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aCenter.X(), aCenter.Y(), aCenter.Z()));
}
double GeomAPI_Circ::radius() const
#define GeomAPI_Circ_H_
#include <GeomAPI_Interface.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
class GeomAPI_Pnt;
class GeomAPI_Dir;
{
public:
/// Creation of circle defined by center point, direction and circle radius
- GeomAPI_Circ(const boost::shared_ptr<GeomAPI_Pnt>& theCenter,
- const boost::shared_ptr<GeomAPI_Dir>& theDir, double theRadius);
+ GeomAPI_Circ(const std::shared_ptr<GeomAPI_Pnt>& theCenter,
+ const std::shared_ptr<GeomAPI_Dir>& theDir, double theRadius);
/// Return center of the circle
- const boost::shared_ptr<GeomAPI_Pnt> center() const;
+ const std::shared_ptr<GeomAPI_Pnt> center() const;
/// Return radius of the circle
double radius() const;
/// Project point on circle
- const boost::shared_ptr<GeomAPI_Pnt> project(
- const boost::shared_ptr<GeomAPI_Pnt>& thePoint) const;
+ const std::shared_ptr<GeomAPI_Pnt> project(
+ const std::shared_ptr<GeomAPI_Pnt>& thePoint) const;
};
#endif
return newCirc2d(theCenterX, theCenterY, aDir, aRadius);
}
-GeomAPI_Circ2d::GeomAPI_Circ2d(const boost::shared_ptr<GeomAPI_Pnt2d>& theCenter,
- const boost::shared_ptr<GeomAPI_Pnt2d>& theCirclePoint)
+GeomAPI_Circ2d::GeomAPI_Circ2d(const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
+ const std::shared_ptr<GeomAPI_Pnt2d>& theCirclePoint)
: GeomAPI_Interface(
newCirc2d(theCenter->x(), theCenter->y(), theCirclePoint->x(), theCirclePoint->y()))
{
}
-GeomAPI_Circ2d::GeomAPI_Circ2d(const boost::shared_ptr<GeomAPI_Pnt2d>& theCenter,
- const boost::shared_ptr<GeomAPI_Dir2d>& theDir, double theRadius)
+GeomAPI_Circ2d::GeomAPI_Circ2d(const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
+ const std::shared_ptr<GeomAPI_Dir2d>& theDir, double theRadius)
: GeomAPI_Interface(
newCirc2d(theCenter->x(), theCenter->y(), theDir->impl<gp_Dir2d>(), theRadius))
{
}
-const boost::shared_ptr<GeomAPI_Pnt2d> GeomAPI_Circ2d::project(
- const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint) const
+const std::shared_ptr<GeomAPI_Pnt2d> GeomAPI_Circ2d::project(
+ const std::shared_ptr<GeomAPI_Pnt2d>& thePoint) const
{
- boost::shared_ptr<GeomAPI_Pnt2d> aResult;
+ std::shared_ptr<GeomAPI_Pnt2d> aResult;
if (!MY_CIRC2D)
return aResult;
if (Abs(aDist - MY_CIRC2D->Radius()) < Precision::Confusion()) {
// Point on the circle
- aResult = boost::shared_ptr<GeomAPI_Pnt2d>(
+ aResult = std::shared_ptr<GeomAPI_Pnt2d>(
new GeomAPI_Pnt2d(thePoint->x(), thePoint->y()));
} else {
gp_Dir2d aDir(aPoint.XY() - aCenter.XY());
gp_XY aNewPoint = aCenter.XY() + aDir.XY() * MY_CIRC2D->Radius();
- aResult = boost::shared_ptr<GeomAPI_Pnt2d>(
+ aResult = std::shared_ptr<GeomAPI_Pnt2d>(
new GeomAPI_Pnt2d(aNewPoint.X(), aNewPoint.Y()));
}
return aResult;
}
-const boost::shared_ptr<GeomAPI_Pnt2d> GeomAPI_Circ2d::center() const
+const std::shared_ptr<GeomAPI_Pnt2d> GeomAPI_Circ2d::center() const
{
const gp_Pnt2d& aCenter = MY_CIRC2D->Location();
- return boost::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(aCenter.X(), aCenter.Y()));
+ return std::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(aCenter.X(), aCenter.Y()));
}
double GeomAPI_Circ2d::radius() const
#define GeomAPI_Circ2d_H_
#include <GeomAPI_Interface.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
class GeomAPI_Pnt2d;
class GeomAPI_Dir2d;
{
public:
/// Creation of circle defined by center point and circle radius
- GeomAPI_Circ2d(const boost::shared_ptr<GeomAPI_Pnt2d>& theCenter,
- const boost::shared_ptr<GeomAPI_Pnt2d>& theCirclePoint);
+ GeomAPI_Circ2d(const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
+ const std::shared_ptr<GeomAPI_Pnt2d>& theCirclePoint);
/// Creation of circle defined by center point, direction and circle radius
- GeomAPI_Circ2d(const boost::shared_ptr<GeomAPI_Pnt2d>& theCenter,
- const boost::shared_ptr<GeomAPI_Dir2d>& theDir, double theRadius);
+ GeomAPI_Circ2d(const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
+ const std::shared_ptr<GeomAPI_Dir2d>& theDir, double theRadius);
/// Return center of the circle
- const boost::shared_ptr<GeomAPI_Pnt2d> center() const;
+ const std::shared_ptr<GeomAPI_Pnt2d> center() const;
/// Return radius of the circle
double radius() const;
/// Project point on line
- const boost::shared_ptr<GeomAPI_Pnt2d> project(
- const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint) const;
+ const std::shared_ptr<GeomAPI_Pnt2d> project(
+ const std::shared_ptr<GeomAPI_Pnt2d>& thePoint) const;
};
#endif
{
}
-GeomAPI_Curve::GeomAPI_Curve(const boost::shared_ptr<GeomAPI_Shape>& theShape)
+GeomAPI_Curve::GeomAPI_Curve(const std::shared_ptr<GeomAPI_Shape>& theShape)
: GeomAPI_Interface(new Handle_Geom_Curve()) // initially it is null
{
const TopoDS_Shape& aShape = theShape->impl<TopoDS_Shape>();
#define GeomAPI_Curve_H_
#include <GeomAPI_Shape.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
/**\class GeomAPI_Curve
* \ingroup DataModel
GeomAPI_Curve();
/// Creates a curve from the shape (edge)
- GeomAPI_Curve(const boost::shared_ptr<GeomAPI_Shape>& theShape);
+ GeomAPI_Curve(const std::shared_ptr<GeomAPI_Shape>& theShape);
/// Returns true if curve is not initialized
bool isNull() const;
}
/// Adds the Key <K> to the Map <me> with the Item. Returns True if the Key was not already in the map
-bool GeomAPI_DataMapOfShapeShape::bind (boost::shared_ptr<GeomAPI_Shape> theKey, boost::shared_ptr<GeomAPI_Shape> theItem)
+bool GeomAPI_DataMapOfShapeShape::bind (std::shared_ptr<GeomAPI_Shape> theKey, std::shared_ptr<GeomAPI_Shape> theItem)
{
bool flag(false);
if(implPtr<TopTools_DataMapOfShapeShape>()->Bind(theKey->impl<TopoDS_Shape>(), theItem->impl<TopoDS_Shape>()))
}
/// Returns true if theKey is stored in the map.
-bool GeomAPI_DataMapOfShapeShape::isBound (boost::shared_ptr<GeomAPI_Shape> theKey)
+bool GeomAPI_DataMapOfShapeShape::isBound (std::shared_ptr<GeomAPI_Shape> theKey)
{
bool flag(false);
if(impl<TopTools_DataMapOfShapeShape>().IsBound(theKey->impl<TopoDS_Shape>()))
}
/// Returns the Item stored with the Key in the Map. To be checked before with isBound()
-const boost::shared_ptr<GeomAPI_Shape> GeomAPI_DataMapOfShapeShape::find(boost::shared_ptr<GeomAPI_Shape> theKey)
+const std::shared_ptr<GeomAPI_Shape> GeomAPI_DataMapOfShapeShape::find(std::shared_ptr<GeomAPI_Shape> theKey)
{
- boost::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
+ std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
aShape->setImpl(new TopoDS_Shape(impl<TopTools_DataMapOfShapeShape>().Find(theKey->impl<TopoDS_Shape>())));
return aShape;
}
/// Removes the Key from the map. Returns true if the Key was in the Map
-bool GeomAPI_DataMapOfShapeShape::unBind(boost::shared_ptr<GeomAPI_Shape> theKey)
+bool GeomAPI_DataMapOfShapeShape::unBind(std::shared_ptr<GeomAPI_Shape> theKey)
{
bool flag(false);
if(implPtr<TopTools_DataMapOfShapeShape>()->UnBind(theKey->impl<TopoDS_Shape>()))
#ifndef GeomAPI_DataMapOfShapeShape_H_
#define GeomAPI_DataMapOfShapeShape_H_
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <GeomAPI_Interface.h>
class GeomAPI_Pnt;
void clear();
/// Adds the Key <K> to the Map <me> with the Item. Returns True if the Key was not already in the map
- bool bind (boost::shared_ptr<GeomAPI_Shape> theKey, boost::shared_ptr<GeomAPI_Shape> theItem);
+ bool bind (std::shared_ptr<GeomAPI_Shape> theKey, std::shared_ptr<GeomAPI_Shape> theItem);
/// Returns true if theKey is stored in the map.
- bool isBound (boost::shared_ptr<GeomAPI_Shape> theKey);
+ bool isBound (std::shared_ptr<GeomAPI_Shape> theKey);
/// Returns the Item stored with the Key in the Map.
- const boost::shared_ptr<GeomAPI_Shape> find(boost::shared_ptr<GeomAPI_Shape> theKey);
+ const std::shared_ptr<GeomAPI_Shape> find(std::shared_ptr<GeomAPI_Shape> theKey);
/// Removes the Key from the map. Returns true if the Key was in the Map
- bool unBind(boost::shared_ptr<GeomAPI_Shape> theKey);
+ bool unBind(std::shared_ptr<GeomAPI_Shape> theKey);
/// Destructor
~GeomAPI_DataMapOfShapeShape();
{
}
-GeomAPI_Dir::GeomAPI_Dir(const boost::shared_ptr<GeomAPI_XYZ>& theCoords)
+GeomAPI_Dir::GeomAPI_Dir(const std::shared_ptr<GeomAPI_XYZ>& theCoords)
: GeomAPI_Interface(new gp_Dir(theCoords->x(), theCoords->y(), theCoords->z()))
{
}
return MY_DIR->Z();
}
-const boost::shared_ptr<GeomAPI_XYZ> GeomAPI_Dir::xyz()
+const std::shared_ptr<GeomAPI_XYZ> GeomAPI_Dir::xyz()
{
- return boost::shared_ptr<GeomAPI_XYZ>(new GeomAPI_XYZ(MY_DIR->X(), MY_DIR->Y(), MY_DIR->Z()));
+ return std::shared_ptr<GeomAPI_XYZ>(new GeomAPI_XYZ(MY_DIR->X(), MY_DIR->Y(), MY_DIR->Z()));
}
-double GeomAPI_Dir::dot(const boost::shared_ptr<GeomAPI_Dir>& theArg) const
+double GeomAPI_Dir::dot(const std::shared_ptr<GeomAPI_Dir>& theArg) const
{
return MY_DIR->Dot(theArg->impl<gp_Dir>());
}
-const boost::shared_ptr<GeomAPI_XYZ> GeomAPI_Dir::cross(
- const boost::shared_ptr<GeomAPI_Dir>& theArg) const
+const std::shared_ptr<GeomAPI_XYZ> GeomAPI_Dir::cross(
+ const std::shared_ptr<GeomAPI_Dir>& theArg) const
{
gp_XYZ aResult = MY_DIR->XYZ().Crossed(theArg->impl<gp_Dir>().XYZ());
- return boost::shared_ptr<GeomAPI_XYZ>(new GeomAPI_XYZ(aResult.X(), aResult.Y(), aResult.Z()));
+ return std::shared_ptr<GeomAPI_XYZ>(new GeomAPI_XYZ(aResult.X(), aResult.Y(), aResult.Z()));
}
#define GeomAPI_Dir_H_
#include <GeomAPI_Interface.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
class GeomAPI_XYZ;
/// Creation of direction by coordinates
GeomAPI_Dir(const double theX, const double theY, const double theZ);
/// Creation of direction by coordinates
- GeomAPI_Dir(const boost::shared_ptr<GeomAPI_XYZ>& theCoords);
+ GeomAPI_Dir(const std::shared_ptr<GeomAPI_XYZ>& theCoords);
/// returns X coordinate
double x() const;
double z() const;
/// returns coordinates of the direction
- const boost::shared_ptr<GeomAPI_XYZ> xyz();
+ const std::shared_ptr<GeomAPI_XYZ> xyz();
/// result is a scalar product of directions
- double dot(const boost::shared_ptr<GeomAPI_Dir>& theArg) const;
+ double dot(const std::shared_ptr<GeomAPI_Dir>& theArg) const;
/// result is a cross product of two directions
- const boost::shared_ptr<GeomAPI_XYZ> cross(const boost::shared_ptr<GeomAPI_Dir>& theArg) const;
+ const std::shared_ptr<GeomAPI_XYZ> cross(const std::shared_ptr<GeomAPI_Dir>& theArg) const;
};
#endif
{
}
-GeomAPI_Dir2d::GeomAPI_Dir2d(const boost::shared_ptr<GeomAPI_XY>& theCoords)
+GeomAPI_Dir2d::GeomAPI_Dir2d(const std::shared_ptr<GeomAPI_XY>& theCoords)
: GeomAPI_Interface(new gp_Dir2d(theCoords->x(), theCoords->y()))
{
}
return MY_DIR->Y();
}
-const boost::shared_ptr<GeomAPI_XY> GeomAPI_Dir2d::xy()
+const std::shared_ptr<GeomAPI_XY> GeomAPI_Dir2d::xy()
{
- return boost::shared_ptr<GeomAPI_XY>(new GeomAPI_XY(MY_DIR->X(), MY_DIR->Y()));
+ return std::shared_ptr<GeomAPI_XY>(new GeomAPI_XY(MY_DIR->X(), MY_DIR->Y()));
}
-double GeomAPI_Dir2d::dot(const boost::shared_ptr<GeomAPI_Dir2d>& theArg) const
+double GeomAPI_Dir2d::dot(const std::shared_ptr<GeomAPI_Dir2d>& theArg) const
{
return MY_DIR->Dot(theArg->impl<gp_Dir2d>());
}
-double GeomAPI_Dir2d::cross(const boost::shared_ptr<GeomAPI_Dir2d>& theArg) const
+double GeomAPI_Dir2d::cross(const std::shared_ptr<GeomAPI_Dir2d>& theArg) const
{
return MY_DIR->XY().Crossed(theArg->impl<gp_Dir2d>().XY());
}
#define GeomAPI_Dir2d_H_
#include <GeomAPI_Interface.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
class GeomAPI_XY;
/// Creation of direction by coordinates
GeomAPI_Dir2d(const double theX, const double theY);
/// Creation of direction by coordinates
- GeomAPI_Dir2d(const boost::shared_ptr<GeomAPI_XY>& theCoords);
+ GeomAPI_Dir2d(const std::shared_ptr<GeomAPI_XY>& theCoords);
/// returns X coordinate
double x() const;
double y() const;
/// returns coordinates of the direction
- const boost::shared_ptr<GeomAPI_XY> xy();
+ const std::shared_ptr<GeomAPI_XY> xy();
/// result is a scalar product of directions
- double dot(const boost::shared_ptr<GeomAPI_Dir2d>& theArg) const;
+ double dot(const std::shared_ptr<GeomAPI_Dir2d>& theArg) const;
/// result is a cross product of two directions
- double cross(const boost::shared_ptr<GeomAPI_Dir2d>& theArg) const;
+ double cross(const std::shared_ptr<GeomAPI_Dir2d>& theArg) const;
};
#endif
{
}
-GeomAPI_Edge::GeomAPI_Edge(const boost::shared_ptr<GeomAPI_Shape>& theShape)
+GeomAPI_Edge::GeomAPI_Edge(const std::shared_ptr<GeomAPI_Shape>& theShape)
{
if (!theShape->isNull() && theShape->isEdge()) {
setImpl(new TopoDS_Shape(theShape->impl<TopoDS_Shape>()));
return false;
}
-boost::shared_ptr<GeomAPI_Pnt> GeomAPI_Edge::firstPoint()
+std::shared_ptr<GeomAPI_Pnt> GeomAPI_Edge::firstPoint()
{
const TopoDS_Shape& aShape = const_cast<GeomAPI_Edge*>(this)->impl<TopoDS_Shape>();
double aFirst, aLast;
Handle(Geom_Curve) aCurve = BRep_Tool::Curve((const TopoDS_Edge&)aShape, aFirst, aLast);
gp_Pnt aPoint;
aCurve->D0(aFirst, aPoint);
- return boost::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aPoint.X(), aPoint.Y(), aPoint.Z()));
+ return std::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aPoint.X(), aPoint.Y(), aPoint.Z()));
}
-boost::shared_ptr<GeomAPI_Pnt> GeomAPI_Edge::lastPoint()
+std::shared_ptr<GeomAPI_Pnt> GeomAPI_Edge::lastPoint()
{
const TopoDS_Shape& aShape = const_cast<GeomAPI_Edge*>(this)->impl<TopoDS_Shape>();
double aFirst, aLast;
Handle(Geom_Curve) aCurve = BRep_Tool::Curve((const TopoDS_Edge&)aShape, aFirst, aLast);
gp_Pnt aPoint;
aCurve->D0(aLast, aPoint);
- return boost::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aPoint.X(), aPoint.Y(), aPoint.Z()));
+ return std::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aPoint.X(), aPoint.Y(), aPoint.Z()));
}
-boost::shared_ptr<GeomAPI_Circ> GeomAPI_Edge::circle()
+std::shared_ptr<GeomAPI_Circ> GeomAPI_Edge::circle()
{
const TopoDS_Shape& aShape = const_cast<GeomAPI_Edge*>(this)->impl<TopoDS_Shape>();
double aFirst, aLast;
Handle(Geom_Circle) aCirc = Handle(Geom_Circle)::DownCast(aCurve);
if (aCirc) {
gp_Pnt aLoc = aCirc->Location();
- boost::shared_ptr<GeomAPI_Pnt> aCenter(new GeomAPI_Pnt(aLoc.X(), aLoc.Y(), aLoc.Z()));
+ std::shared_ptr<GeomAPI_Pnt> aCenter(new GeomAPI_Pnt(aLoc.X(), aLoc.Y(), aLoc.Z()));
gp_Dir anAxis = aCirc->Axis().Direction();
- boost::shared_ptr<GeomAPI_Dir> aDir(new GeomAPI_Dir(anAxis.X(), anAxis.Y(), anAxis.Z()));
- return boost::shared_ptr<GeomAPI_Circ>(new GeomAPI_Circ(aCenter, aDir, aCirc->Radius()));
+ std::shared_ptr<GeomAPI_Dir> aDir(new GeomAPI_Dir(anAxis.X(), anAxis.Y(), anAxis.Z()));
+ return std::shared_ptr<GeomAPI_Circ>(new GeomAPI_Circ(aCenter, aDir, aCirc->Radius()));
}
}
- return boost::shared_ptr<GeomAPI_Circ>(); // not circle
+ return std::shared_ptr<GeomAPI_Circ>(); // not circle
}
-bool GeomAPI_Edge::isEqual(boost::shared_ptr<GeomAPI_Shape> theEdge)
+bool GeomAPI_Edge::isEqual(std::shared_ptr<GeomAPI_Shape> theEdge)
{
const TopoDS_Shape& aMyShape = const_cast<GeomAPI_Edge*>(this)->impl<TopoDS_Shape>();
const TopoDS_Shape& aInShape = theEdge->impl<TopoDS_Shape>();
GeomAPI_Edge();
/// Creation of edge by the edge-shape
- GeomAPI_Edge(const boost::shared_ptr<GeomAPI_Shape>& theShape);
+ GeomAPI_Edge(const std::shared_ptr<GeomAPI_Shape>& theShape);
/// Verifies that the edge is a line
bool isLine() const;
bool isArc() const;
/// Returns the first vertex coordinates of the edge
- boost::shared_ptr<GeomAPI_Pnt> firstPoint();
+ std::shared_ptr<GeomAPI_Pnt> firstPoint();
/// Returns the Last vertex coordinates of the edge
- boost::shared_ptr<GeomAPI_Pnt> lastPoint();
+ std::shared_ptr<GeomAPI_Pnt> lastPoint();
/// Returns a circle if edge is based on the cirsle curve
- boost::shared_ptr<GeomAPI_Circ> circle();
+ std::shared_ptr<GeomAPI_Circ> circle();
/// Returns true if the current edge is geometrically equal to the given edge
- bool isEqual(boost::shared_ptr<GeomAPI_Shape> theEdge);
+ bool isEqual(std::shared_ptr<GeomAPI_Shape> theEdge);
};
#endif
virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious) = 0;
};
-typedef boost::shared_ptr<GeomAPI_IPresentable> GeomPresentablePtr;
+typedef std::shared_ptr<GeomAPI_IPresentable> GeomPresentablePtr;
#endif
{
}
-GeomAPI_Lin::GeomAPI_Lin(const boost::shared_ptr<GeomAPI_Pnt>& theStart,
- const boost::shared_ptr<GeomAPI_Pnt>& theEnd)
+GeomAPI_Lin::GeomAPI_Lin(const std::shared_ptr<GeomAPI_Pnt>& theStart,
+ const std::shared_ptr<GeomAPI_Pnt>& theEnd)
: GeomAPI_Interface(
newLine(theStart->x(), theStart->y(), theStart->z(), theEnd->x(), theEnd->y(), theEnd->z()))
{
}
-double GeomAPI_Lin::distance(const boost::shared_ptr<GeomAPI_Pnt>& thePoint) const
+double GeomAPI_Lin::distance(const std::shared_ptr<GeomAPI_Pnt>& thePoint) const
{
return MY_LIN->Distance(thePoint->impl<gp_Pnt>());
}
-const boost::shared_ptr<GeomAPI_Pnt> GeomAPI_Lin::intersect(
- const boost::shared_ptr<GeomAPI_Lin>& theLine) const
+const std::shared_ptr<GeomAPI_Pnt> GeomAPI_Lin::intersect(
+ const std::shared_ptr<GeomAPI_Lin>& theLine) const
{
if (MY_LIN->SquareDistance(theLine->impl<gp_Lin>()) > Precision::Confusion())
- return boost::shared_ptr<GeomAPI_Pnt>();
+ return std::shared_ptr<GeomAPI_Pnt>();
const gp_Dir& aDir1 = MY_LIN->Direction();
const gp_Dir& aDir2 = theLine->impl<gp_Lin>().Direction();
IntAna2d_AnaIntersection anInter(aPrjLine1, aPrjLine1);
if (!anInter.IsDone() || anInter.IsEmpty())
- return boost::shared_ptr<GeomAPI_Pnt>();
+ return std::shared_ptr<GeomAPI_Pnt>();
const gp_Pnt2d& anIntPnt2d = anInter.Point(0).Value();
gp_Pnt aResult = ElSLib::Value(anIntPnt2d.X(), anIntPnt2d.Y(), aPlane);
- return boost::shared_ptr<GeomAPI_Pnt>(
+ return std::shared_ptr<GeomAPI_Pnt>(
new GeomAPI_Pnt(aResult.X(), aResult.Y(), aResult.Z()));
}
-const boost::shared_ptr<GeomAPI_Pnt> GeomAPI_Lin::project(
- const boost::shared_ptr<GeomAPI_Pnt>& thePoint) const
+const std::shared_ptr<GeomAPI_Pnt> GeomAPI_Lin::project(
+ const std::shared_ptr<GeomAPI_Pnt>& thePoint) const
{
const gp_XYZ& aDir = MY_LIN->Direction().XYZ();
const gp_XYZ& aLoc = MY_LIN->Location().XYZ();
double aParam = aDir.Dot(aPnt - aLoc);
gp_XYZ aResult = aPnt + aDir * aParam;
- return boost::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aResult.X(), aResult.Y(), aResult.Z()));
+ return std::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aResult.X(), aResult.Y(), aResult.Z()));
}
#define GeomAPI_Lin_H_
#include <GeomAPI_Interface.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
class GeomAPI_Pnt;
GeomAPI_Lin(const double theStartX, const double theStartY, const double theStartZ,
const double theEndX, const double theEndY, const double theEndZ);
/// Creation of line defined by start and end points
- GeomAPI_Lin(const boost::shared_ptr<GeomAPI_Pnt>& theStart,
- const boost::shared_ptr<GeomAPI_Pnt>& theEnd);
+ GeomAPI_Lin(const std::shared_ptr<GeomAPI_Pnt>& theStart,
+ const std::shared_ptr<GeomAPI_Pnt>& theEnd);
/// Distance between two points
- double distance(const boost::shared_ptr<GeomAPI_Pnt>& thePoint) const;
+ double distance(const std::shared_ptr<GeomAPI_Pnt>& thePoint) const;
/// Intersection of two lines
- const boost::shared_ptr<GeomAPI_Pnt> intersect(
- const boost::shared_ptr<GeomAPI_Lin>& theLine) const;
+ const std::shared_ptr<GeomAPI_Pnt> intersect(
+ const std::shared_ptr<GeomAPI_Lin>& theLine) const;
/// Project point on line
- const boost::shared_ptr<GeomAPI_Pnt> project(
- const boost::shared_ptr<GeomAPI_Pnt>& thePoint) const;
+ const std::shared_ptr<GeomAPI_Pnt> project(
+ const std::shared_ptr<GeomAPI_Pnt>& thePoint) const;
};
#endif
{
}
-GeomAPI_Lin2d::GeomAPI_Lin2d(const boost::shared_ptr<GeomAPI_Pnt2d>& theStart,
- const boost::shared_ptr<GeomAPI_Pnt2d>& theEnd)
+GeomAPI_Lin2d::GeomAPI_Lin2d(const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
+ const std::shared_ptr<GeomAPI_Pnt2d>& theEnd)
: GeomAPI_Interface(newLine2d(theStart->x(), theStart->y(), theEnd->x(), theEnd->y()))
{
}
-double GeomAPI_Lin2d::distance(const boost::shared_ptr<GeomAPI_Pnt2d>& theOther) const
+double GeomAPI_Lin2d::distance(const std::shared_ptr<GeomAPI_Pnt2d>& theOther) const
{
return MY_LIN2D->Distance(theOther->impl<gp_Pnt2d>());
}
-const boost::shared_ptr<GeomAPI_Pnt2d> GeomAPI_Lin2d::intersect(
- const boost::shared_ptr<GeomAPI_Lin2d>& theLine) const
+const std::shared_ptr<GeomAPI_Pnt2d> GeomAPI_Lin2d::intersect(
+ const std::shared_ptr<GeomAPI_Lin2d>& theLine) const
{
IntAna2d_AnaIntersection anInter(*MY_LIN2D, theLine->impl<gp_Lin2d>());
if (!anInter.IsDone() || anInter.IsEmpty())
- return boost::shared_ptr<GeomAPI_Pnt2d>();
+ return std::shared_ptr<GeomAPI_Pnt2d>();
const gp_Pnt2d& aResult = anInter.Point(1).Value();
- return boost::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(aResult.X(), aResult.Y()));
+ return std::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(aResult.X(), aResult.Y()));
}
-const boost::shared_ptr<GeomAPI_Pnt2d> GeomAPI_Lin2d::project(
- const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint) const
+const std::shared_ptr<GeomAPI_Pnt2d> GeomAPI_Lin2d::project(
+ const std::shared_ptr<GeomAPI_Pnt2d>& thePoint) const
{
const gp_XY& aDir = MY_LIN2D->Direction().XY();
const gp_XY& aLoc = MY_LIN2D->Location().XY();
double aParam = aDir.Dot(aPnt - aLoc);
gp_XY aResult = aLoc + aDir * aParam;
- return boost::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(aResult.X(), aResult.Y()));
+ return std::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(aResult.X(), aResult.Y()));
}
-bool GeomAPI_Lin2d::isRight(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint) const
+bool GeomAPI_Lin2d::isRight(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint) const
{
const gp_XY& aDir = MY_LIN2D->Direction().XY();
const gp_XY& aLoc = MY_LIN2D->Location().XY();
}
-boost::shared_ptr<GeomAPI_Pnt2d> GeomAPI_Lin2d::shiftedLocation(double theShift) const
+std::shared_ptr<GeomAPI_Pnt2d> GeomAPI_Lin2d::shiftedLocation(double theShift) const
{
gp_Vec2d aVec = MY_LIN2D->Direction();
aVec = aVec.GetNormal();
aVec.Reverse();
aVec.Scale(theShift);
gp_Lin2d aLin = MY_LIN2D->Translated(aVec);
- return boost::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(aLin.Location().X(), aLin.Location().Y()));
+ return std::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(aLin.Location().X(), aLin.Location().Y()));
}
#define GeomAPI_Lin2d_H_
#include <GeomAPI_Interface.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
class GeomAPI_Pnt2d;
GeomAPI_Lin2d(const double theStartX, const double theStartY, const double theEndX,
const double theEndY);
/// Creation of line defined by start and end points
- GeomAPI_Lin2d(const boost::shared_ptr<GeomAPI_Pnt2d>& theStart,
- const boost::shared_ptr<GeomAPI_Pnt2d>& theEnd);
+ GeomAPI_Lin2d(const std::shared_ptr<GeomAPI_Pnt2d>& theStart,
+ const std::shared_ptr<GeomAPI_Pnt2d>& theEnd);
/// Distance between two points
- double distance(const boost::shared_ptr<GeomAPI_Pnt2d>& theOther) const;
+ double distance(const std::shared_ptr<GeomAPI_Pnt2d>& theOther) const;
/// Intersection of two lines
- const boost::shared_ptr<GeomAPI_Pnt2d> intersect(
- const boost::shared_ptr<GeomAPI_Lin2d>& theLine) const;
+ const std::shared_ptr<GeomAPI_Pnt2d> intersect(
+ const std::shared_ptr<GeomAPI_Lin2d>& theLine) const;
/// Project point on line
- const boost::shared_ptr<GeomAPI_Pnt2d> project(
- const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint) const;
+ const std::shared_ptr<GeomAPI_Pnt2d> project(
+ const std::shared_ptr<GeomAPI_Pnt2d>& thePoint) const;
/// Computes the cross product of the line direction and a vector from the line start point to the point
- bool isRight(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint) const;
+ bool isRight(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint) const;
/// Returns a location point shifted on theShift in perpendicular direction
- boost::shared_ptr<GeomAPI_Pnt2d> shiftedLocation(double theShift) const;
+ std::shared_ptr<GeomAPI_Pnt2d> shiftedLocation(double theShift) const;
};
#endif
this->setImpl(new TopoDS_Shape(aBigWireImpl));
}
-void GeomAPI_PlanarEdges::addEdge(boost::shared_ptr<GeomAPI_Shape> theEdge)
+void GeomAPI_PlanarEdges::addEdge(std::shared_ptr<GeomAPI_Shape> theEdge)
{
const TopoDS_Edge& anEdge = theEdge->impl<TopoDS_Edge>();
if (anEdge.ShapeType() != TopAbs_EDGE)
aBuilder.Add(aWire, anEdge);
}
-std::list<boost::shared_ptr<GeomAPI_Shape> > GeomAPI_PlanarEdges::getEdges()
+std::list<std::shared_ptr<GeomAPI_Shape> > GeomAPI_PlanarEdges::getEdges()
{
TopoDS_Shape& aShape = const_cast<TopoDS_Shape&>(impl<TopoDS_Shape>());
//BRepTools_WireExplorer aWireExp(TopoDS::Wire(aShape));
TopExp_Explorer aWireExp(aShape, TopAbs_EDGE);
- std::list<boost::shared_ptr<GeomAPI_Shape> > aResult;
+ std::list<std::shared_ptr<GeomAPI_Shape> > aResult;
for (; aWireExp.More(); aWireExp.Next()) {
- boost::shared_ptr<GeomAPI_Shape> anEdge(new GeomAPI_Shape);
+ std::shared_ptr<GeomAPI_Shape> anEdge(new GeomAPI_Shape);
anEdge->setImpl(new TopoDS_Shape(aWireExp.Current()));
aResult.push_back(anEdge);
}
#include "GeomAPI_Pnt.h"
#include "GeomAPI_Dir.h"
-#include <boost/smart_ptr/shared_ptr.hpp>
+#include <memory>
#include <list>
return false;
}
- GEOMAPI_EXPORT void addEdge(boost::shared_ptr<GeomAPI_Shape> theEdge);
- GEOMAPI_EXPORT std::list<boost::shared_ptr<GeomAPI_Shape> > getEdges();
+ GEOMAPI_EXPORT void addEdge(std::shared_ptr<GeomAPI_Shape> theEdge);
+ GEOMAPI_EXPORT std::list<std::shared_ptr<GeomAPI_Shape> > getEdges();
/// Returns True if the wire is defined in a plane
GEOMAPI_EXPORT bool hasPlane() const { return myOrigin && myNorm && myDirX && myDirY; }
/// Set/Get origin point
- GEOMAPI_EXPORT void setOrigin(const boost::shared_ptr<GeomAPI_Pnt>& theOrigin)
+ GEOMAPI_EXPORT void setOrigin(const std::shared_ptr<GeomAPI_Pnt>& theOrigin)
{ myOrigin = theOrigin; }
- GEOMAPI_EXPORT boost::shared_ptr<GeomAPI_Pnt> origin() const { return myOrigin; }
+ GEOMAPI_EXPORT std::shared_ptr<GeomAPI_Pnt> origin() const { return myOrigin; }
/// Set/Get X direction vector
- GEOMAPI_EXPORT void setDirX(const boost::shared_ptr<GeomAPI_Dir>& theDirX) { myDirX = theDirX; }
- GEOMAPI_EXPORT boost::shared_ptr<GeomAPI_Dir> dirX() const { return myDirX; }
+ GEOMAPI_EXPORT void setDirX(const std::shared_ptr<GeomAPI_Dir>& theDirX) { myDirX = theDirX; }
+ GEOMAPI_EXPORT std::shared_ptr<GeomAPI_Dir> dirX() const { return myDirX; }
/// Set/Get Y direction vector
- GEOMAPI_EXPORT void setDirY(const boost::shared_ptr<GeomAPI_Dir>& theDirY) { myDirY = theDirY; }
- GEOMAPI_EXPORT boost::shared_ptr<GeomAPI_Dir> dirY() const { return myDirY; }
+ GEOMAPI_EXPORT void setDirY(const std::shared_ptr<GeomAPI_Dir>& theDirY) { myDirY = theDirY; }
+ GEOMAPI_EXPORT std::shared_ptr<GeomAPI_Dir> dirY() const { return myDirY; }
/// Set/Get Normal direction vector
- GEOMAPI_EXPORT void setNorm(const boost::shared_ptr<GeomAPI_Dir>& theNorm) { myNorm = theNorm; }
- GEOMAPI_EXPORT boost::shared_ptr<GeomAPI_Dir> norm() const { return myNorm; }
+ GEOMAPI_EXPORT void setNorm(const std::shared_ptr<GeomAPI_Dir>& theNorm) { myNorm = theNorm; }
+ GEOMAPI_EXPORT std::shared_ptr<GeomAPI_Dir> norm() const { return myNorm; }
private:
- boost::shared_ptr<GeomAPI_Pnt> myOrigin;
- boost::shared_ptr<GeomAPI_Dir> myDirX;
- boost::shared_ptr<GeomAPI_Dir> myDirY;
- boost::shared_ptr<GeomAPI_Dir> myNorm;
+ std::shared_ptr<GeomAPI_Pnt> myOrigin;
+ std::shared_ptr<GeomAPI_Dir> myDirX;
+ std::shared_ptr<GeomAPI_Dir> myDirY;
+ std::shared_ptr<GeomAPI_Dir> myNorm;
};
#endif
using namespace std;
-GeomAPI_Pln::GeomAPI_Pln(const boost::shared_ptr<GeomAPI_Pnt>& thePoint,
- const boost::shared_ptr<GeomAPI_Dir>& theNormal)
+GeomAPI_Pln::GeomAPI_Pln(const std::shared_ptr<GeomAPI_Pnt>& thePoint,
+ const std::shared_ptr<GeomAPI_Dir>& theNormal)
: GeomAPI_Interface(new gp_Pln(thePoint->impl<gp_Pnt>(), theNormal->impl<gp_Dir>()))
{
}
{
}
-boost::shared_ptr<GeomAPI_Pnt> GeomAPI_Pln::location()
+std::shared_ptr<GeomAPI_Pnt> GeomAPI_Pln::location()
{
gp_Pnt aLoc = impl<gp_Pln>().Location();
- return boost::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aLoc.X(), aLoc.Y(), aLoc.Z()));
+ return std::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aLoc.X(), aLoc.Y(), aLoc.Z()));
}
-boost::shared_ptr<GeomAPI_Dir> GeomAPI_Pln::direction()
+std::shared_ptr<GeomAPI_Dir> GeomAPI_Pln::direction()
{
const gp_Dir& aDir = impl<gp_Pln>().Axis().Direction();
- return boost::shared_ptr<GeomAPI_Dir>(new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z()));
+ return std::shared_ptr<GeomAPI_Dir>(new GeomAPI_Dir(aDir.X(), aDir.Y(), aDir.Z()));
}
void GeomAPI_Pln::coefficients(double& theA, double& theB, double& theC, double& theD)
#ifndef GeomAPI_Pln_H_
#define GeomAPI_Pln_H_
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <GeomAPI_Interface.h>
class GeomAPI_Pnt;
{
public:
/// Creation of plane by the point and normal
- GeomAPI_Pln(const boost::shared_ptr<GeomAPI_Pnt>& thePoint,
- const boost::shared_ptr<GeomAPI_Dir>& theNormal);
+ GeomAPI_Pln(const std::shared_ptr<GeomAPI_Pnt>& thePoint,
+ const std::shared_ptr<GeomAPI_Dir>& theNormal);
/// Creation of plane by coefficients (Ax+By+Cz+D=0)
GeomAPI_Pln(const double theA, const double theB, const double theC, const double theD);
/// Returns a point of this plane
- boost::shared_ptr<GeomAPI_Pnt> location();
+ std::shared_ptr<GeomAPI_Pnt> location();
/// Returns a plane normal
- boost::shared_ptr<GeomAPI_Dir> direction();
+ std::shared_ptr<GeomAPI_Dir> direction();
/// Returns the plane coefficients (Ax+By+Cz+D=0)
void coefficients(double& theA, double& theB, double& theC, double& theD);
{
}
-GeomAPI_Pnt::GeomAPI_Pnt(const boost::shared_ptr<GeomAPI_XYZ>& theCoords)
+GeomAPI_Pnt::GeomAPI_Pnt(const std::shared_ptr<GeomAPI_XYZ>& theCoords)
: GeomAPI_Interface(new gp_Pnt(theCoords->x(), theCoords->y(), theCoords->z()))
{
}
return MY_PNT->SetZ(theZ);
}
-const boost::shared_ptr<GeomAPI_XYZ> GeomAPI_Pnt::xyz()
+const std::shared_ptr<GeomAPI_XYZ> GeomAPI_Pnt::xyz()
{
- return boost::shared_ptr<GeomAPI_XYZ>(new GeomAPI_XYZ(MY_PNT->X(), MY_PNT->Y(), MY_PNT->Z()));
+ return std::shared_ptr<GeomAPI_XYZ>(new GeomAPI_XYZ(MY_PNT->X(), MY_PNT->Y(), MY_PNT->Z()));
}
-double GeomAPI_Pnt::distance(const boost::shared_ptr<GeomAPI_Pnt>& theOther) const
+double GeomAPI_Pnt::distance(const std::shared_ptr<GeomAPI_Pnt>& theOther) const
{
return MY_PNT->Distance(theOther->impl<gp_Pnt>());
}
-boost::shared_ptr<GeomAPI_Pnt2d> GeomAPI_Pnt::to2D(const boost::shared_ptr<GeomAPI_Pnt>& theOrigin,
- const boost::shared_ptr<GeomAPI_Dir>& theDirX, const boost::shared_ptr<GeomAPI_Dir>& theDirY)
+std::shared_ptr<GeomAPI_Pnt2d> GeomAPI_Pnt::to2D(const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
+ const std::shared_ptr<GeomAPI_Dir>& theDirX, const std::shared_ptr<GeomAPI_Dir>& theDirY)
{
gp_Pnt anOriginPnt(theOrigin->x(), theOrigin->y(), theOrigin->z());
gp_Vec aVec(anOriginPnt, impl<gp_Pnt>());
double aX = aVec.X() * theDirX->x() + aVec.Y() * theDirX->y() + aVec.Z() * theDirX->z();
double aY = aVec.X() * theDirY->x() + aVec.Y() * theDirY->y() + aVec.Z() * theDirY->z();
- return boost::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(aX, aY));
+ return std::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(aX, aY));
}
#define GeomAPI_Pnt_H_
#include <GeomAPI_Interface.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
class GeomAPI_XYZ;
class GeomAPI_Pnt2d;
/// Creation of point by coordinates
GeomAPI_Pnt(const double theX, const double theY, const double theZ);
/// Creation of point by coordinates
- GeomAPI_Pnt(const boost::shared_ptr<GeomAPI_XYZ>& theCoords);
+ GeomAPI_Pnt(const std::shared_ptr<GeomAPI_XYZ>& theCoords);
/// returns X coordinate
double x() const;
void setZ(const double theZ);
/// returns coordinates of the point
- const boost::shared_ptr<GeomAPI_XYZ> xyz();
+ const std::shared_ptr<GeomAPI_XYZ> xyz();
/// Distance between two points
- double distance(const boost::shared_ptr<GeomAPI_Pnt>& theOther) const;
+ double distance(const std::shared_ptr<GeomAPI_Pnt>& theOther) const;
/// Projects a point to the plane defined by the origin and 2 axes vectors in this plane
- boost::shared_ptr<GeomAPI_Pnt2d> to2D(const boost::shared_ptr<GeomAPI_Pnt>& theOrigin,
- const boost::shared_ptr<GeomAPI_Dir>& theDirX,
- const boost::shared_ptr<GeomAPI_Dir>& theDirY);
+ std::shared_ptr<GeomAPI_Pnt2d> to2D(const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
+ const std::shared_ptr<GeomAPI_Dir>& theDirX,
+ const std::shared_ptr<GeomAPI_Dir>& theDirY);
};
#endif
{
}
-GeomAPI_Pnt2d::GeomAPI_Pnt2d(const boost::shared_ptr<GeomAPI_XY>& theCoords)
+GeomAPI_Pnt2d::GeomAPI_Pnt2d(const std::shared_ptr<GeomAPI_XY>& theCoords)
: GeomAPI_Interface(new gp_Pnt2d(theCoords->x(), theCoords->y()))
{
}
return MY_PNT2D->SetY(theY);
}
-boost::shared_ptr<GeomAPI_Pnt> GeomAPI_Pnt2d::to3D(const boost::shared_ptr<GeomAPI_Pnt>& theOrigin,
- const boost::shared_ptr<GeomAPI_Dir>& theDirX,
- const boost::shared_ptr<GeomAPI_Dir>& theDirY)
+std::shared_ptr<GeomAPI_Pnt> GeomAPI_Pnt2d::to3D(const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
+ const std::shared_ptr<GeomAPI_Dir>& theDirX,
+ const std::shared_ptr<GeomAPI_Dir>& theDirY)
{
- boost::shared_ptr<GeomAPI_XYZ> aSum = theOrigin->xyz()->added(theDirX->xyz()->multiplied(x()))
+ std::shared_ptr<GeomAPI_XYZ> aSum = theOrigin->xyz()->added(theDirX->xyz()->multiplied(x()))
->added(theDirY->xyz()->multiplied(y()));
- return boost::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aSum));
+ return std::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aSum));
}
-const boost::shared_ptr<GeomAPI_XY> GeomAPI_Pnt2d::xy()
+const std::shared_ptr<GeomAPI_XY> GeomAPI_Pnt2d::xy()
{
- return boost::shared_ptr<GeomAPI_XY>(new GeomAPI_XY(MY_PNT2D->X(), MY_PNT2D->Y()));
+ return std::shared_ptr<GeomAPI_XY>(new GeomAPI_XY(MY_PNT2D->X(), MY_PNT2D->Y()));
}
-double GeomAPI_Pnt2d::distance(const boost::shared_ptr<GeomAPI_Pnt2d>& theOther) const
+double GeomAPI_Pnt2d::distance(const std::shared_ptr<GeomAPI_Pnt2d>& theOther) const
{
return MY_PNT2D->Distance(theOther->impl<gp_Pnt2d>());
}
-bool GeomAPI_Pnt2d::isEqual(const boost::shared_ptr<GeomAPI_Pnt2d>& theOther) const
+bool GeomAPI_Pnt2d::isEqual(const std::shared_ptr<GeomAPI_Pnt2d>& theOther) const
{
return distance(theOther) < Precision::Confusion();
}
#define GeomAPI_Pnt2d_H_
#include <GeomAPI_Interface.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
class GeomAPI_XY;
class GeomAPI_Pnt;
/// Creation of point by coordinates
GeomAPI_Pnt2d(const double theX, const double theY);
/// Creation of point by coordinates
- GeomAPI_Pnt2d(const boost::shared_ptr<GeomAPI_XY>& theCoords);
+ GeomAPI_Pnt2d(const std::shared_ptr<GeomAPI_XY>& theCoords);
/// returns X coordinate
double x() const;
void setY(const double theY);
/// Returns the 3D point
- boost::shared_ptr<GeomAPI_Pnt> to3D(const boost::shared_ptr<GeomAPI_Pnt>& theOrigin,
- const boost::shared_ptr<GeomAPI_Dir>& theDirX,
- const boost::shared_ptr<GeomAPI_Dir>& theDirY);
+ std::shared_ptr<GeomAPI_Pnt> to3D(const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
+ const std::shared_ptr<GeomAPI_Dir>& theDirX,
+ const std::shared_ptr<GeomAPI_Dir>& theDirY);
/// returns coordinates of the point
- const boost::shared_ptr<GeomAPI_XY> xy();
+ const std::shared_ptr<GeomAPI_XY> xy();
/// Distance between two points
- double distance(const boost::shared_ptr<GeomAPI_Pnt2d>& theOther) const;
+ double distance(const std::shared_ptr<GeomAPI_Pnt2d>& theOther) const;
/// Returns whether the distance between two points is less then precision confusion
- bool isEqual(const boost::shared_ptr<GeomAPI_Pnt2d>& theOther) const;
+ bool isEqual(const std::shared_ptr<GeomAPI_Pnt2d>& theOther) const;
};
#endif
return MY_SHAPE->IsNull() == Standard_True;
}
-bool GeomAPI_Shape::isEqual(const boost::shared_ptr<GeomAPI_Shape> theShape) const
+bool GeomAPI_Shape::isEqual(const std::shared_ptr<GeomAPI_Shape> theShape) const
{
if (isNull())
return theShape->isNull();
#define GeomAPI_Shape_H_
#include <GeomAPI_Interface.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <list>
/**\class GeomAPI_Shape
bool isNull() const;
/// Returns whether the shapes are equal
- virtual bool isEqual(const boost::shared_ptr<GeomAPI_Shape> theShape) const;
+ virtual bool isEqual(const std::shared_ptr<GeomAPI_Shape> theShape) const;
/// Returns whether the shape is a vertex
virtual bool isVertex() const;
};
//! Pointer on list of shapes
-typedef std::list<boost::shared_ptr<GeomAPI_Shape> > ListOfShape;
+typedef std::list<std::shared_ptr<GeomAPI_Shape> > ListOfShape;
//! Pointer on attribute object
-typedef boost::shared_ptr<GeomAPI_Shape> GeomShapePtr;
+typedef std::shared_ptr<GeomAPI_Shape> GeomShapePtr;
#endif
return MY_XY->SetY(theY);
}
-const boost::shared_ptr<GeomAPI_XY> GeomAPI_XY::added(const boost::shared_ptr<GeomAPI_XY>& theArg)
+const std::shared_ptr<GeomAPI_XY> GeomAPI_XY::added(const std::shared_ptr<GeomAPI_XY>& theArg)
{
- boost::shared_ptr<GeomAPI_XY> aResult(new GeomAPI_XY(MY_XY->X() + theArg->x(), MY_XY->Y() + theArg->y()));
+ std::shared_ptr<GeomAPI_XY> aResult(new GeomAPI_XY(MY_XY->X() + theArg->x(), MY_XY->Y() + theArg->y()));
return aResult;
}
-const boost::shared_ptr<GeomAPI_XY> GeomAPI_XY::multiplied(const double theArg)
+const std::shared_ptr<GeomAPI_XY> GeomAPI_XY::multiplied(const double theArg)
{
- boost::shared_ptr<GeomAPI_XY> aResult(new GeomAPI_XY(MY_XY->X() * theArg, MY_XY->Y() * theArg));
+ std::shared_ptr<GeomAPI_XY> aResult(new GeomAPI_XY(MY_XY->X() * theArg, MY_XY->Y() * theArg));
return aResult;
}
-double GeomAPI_XY::dot(const boost::shared_ptr<GeomAPI_XY>& theArg) const
+double GeomAPI_XY::dot(const std::shared_ptr<GeomAPI_XY>& theArg) const
{
return MY_XY->Dot(theArg->impl<gp_XY>());
}
-double GeomAPI_XY::cross(const boost::shared_ptr<GeomAPI_XY>& theArg) const
+double GeomAPI_XY::cross(const std::shared_ptr<GeomAPI_XY>& theArg) const
{
return MY_XY->Crossed(theArg->impl<gp_XY>());
}
-double GeomAPI_XY::distance(const boost::shared_ptr<GeomAPI_XY>& theOther) const
+double GeomAPI_XY::distance(const std::shared_ptr<GeomAPI_XY>& theOther) const
{
gp_XY aResult(theOther->x() - x(), theOther->y() - y());
return aResult.Modulus();
#define GeomAPI_XY_H_
#include <GeomAPI_Interface.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
/**\class GeomAPI_XY
* \ingroup DataModel
void setY(const double theY);
/// result is sum of coordinates of this and the given argument
- const boost::shared_ptr<GeomAPI_XY> added(const boost::shared_ptr<GeomAPI_XY>& theArg);
+ const std::shared_ptr<GeomAPI_XY> added(const std::shared_ptr<GeomAPI_XY>& theArg);
/// result is coordinates multiplied by the argument
- const boost::shared_ptr<GeomAPI_XY> multiplied(const double theArg);
+ const std::shared_ptr<GeomAPI_XY> multiplied(const double theArg);
/// result is a scalar product of two triplets
- double dot(const boost::shared_ptr<GeomAPI_XY>& theArg) const;
+ double dot(const std::shared_ptr<GeomAPI_XY>& theArg) const;
/// result is a cross product of two triplets
- double cross(const boost::shared_ptr<GeomAPI_XY>& theArg) const;
+ double cross(const std::shared_ptr<GeomAPI_XY>& theArg) const;
/// Distance between two pairs
- double distance(const boost::shared_ptr<GeomAPI_XY>& theOther) const;
+ double distance(const std::shared_ptr<GeomAPI_XY>& theOther) const;
};
#endif
return MY_XYZ->SetZ(theZ);
}
-const boost::shared_ptr<GeomAPI_XYZ> GeomAPI_XYZ::added(
- const boost::shared_ptr<GeomAPI_XYZ>& theArg)
+const std::shared_ptr<GeomAPI_XYZ> GeomAPI_XYZ::added(
+ const std::shared_ptr<GeomAPI_XYZ>& theArg)
{
- boost::shared_ptr<GeomAPI_XYZ> aResult(new GeomAPI_XYZ(MY_XYZ->X() + theArg->x(),
+ std::shared_ptr<GeomAPI_XYZ> aResult(new GeomAPI_XYZ(MY_XYZ->X() + theArg->x(),
MY_XYZ->Y() + theArg->y(), MY_XYZ->Z() + theArg->z()));
return aResult;
}
-const boost::shared_ptr<GeomAPI_XYZ> GeomAPI_XYZ::decreased(
- const boost::shared_ptr<GeomAPI_XYZ>& theArg)
+const std::shared_ptr<GeomAPI_XYZ> GeomAPI_XYZ::decreased(
+ const std::shared_ptr<GeomAPI_XYZ>& theArg)
{
- boost::shared_ptr<GeomAPI_XYZ> aResult(new GeomAPI_XYZ(MY_XYZ->X() - theArg->x(),
+ std::shared_ptr<GeomAPI_XYZ> aResult(new GeomAPI_XYZ(MY_XYZ->X() - theArg->x(),
MY_XYZ->Y() - theArg->y(), MY_XYZ->Z() - theArg->z()));
return aResult;
}
-const boost::shared_ptr<GeomAPI_XYZ> GeomAPI_XYZ::multiplied(const double theArg)
+const std::shared_ptr<GeomAPI_XYZ> GeomAPI_XYZ::multiplied(const double theArg)
{
- boost::shared_ptr<GeomAPI_XYZ> aResult(new GeomAPI_XYZ(MY_XYZ->X() * theArg,
+ std::shared_ptr<GeomAPI_XYZ> aResult(new GeomAPI_XYZ(MY_XYZ->X() * theArg,
MY_XYZ->Y() * theArg, MY_XYZ->Z() * theArg));
return aResult;
}
-double GeomAPI_XYZ::dot(const boost::shared_ptr<GeomAPI_XYZ>& theArg) const
+double GeomAPI_XYZ::dot(const std::shared_ptr<GeomAPI_XYZ>& theArg) const
{
return MY_XYZ->Dot(theArg->impl<gp_XYZ>());
}
-const boost::shared_ptr<GeomAPI_XYZ> GeomAPI_XYZ::cross(
- const boost::shared_ptr<GeomAPI_XYZ>& theArg) const
+const std::shared_ptr<GeomAPI_XYZ> GeomAPI_XYZ::cross(
+ const std::shared_ptr<GeomAPI_XYZ>& theArg) const
{
gp_XYZ aResult = MY_XYZ->Crossed(theArg->impl<gp_XYZ>());
- return boost::shared_ptr<GeomAPI_XYZ>(new GeomAPI_XYZ(aResult.X(), aResult.Y(), aResult.Z()));
+ return std::shared_ptr<GeomAPI_XYZ>(new GeomAPI_XYZ(aResult.X(), aResult.Y(), aResult.Z()));
}
-double GeomAPI_XYZ::distance(const boost::shared_ptr<GeomAPI_XYZ>& theOther) const
+double GeomAPI_XYZ::distance(const std::shared_ptr<GeomAPI_XYZ>& theOther) const
{
gp_XYZ aResult(theOther->x() - x(), theOther->y() - y(), theOther->z() - z());
return aResult.Modulus();
#define GeomAPI_XYZ_H_
#include <GeomAPI_Interface.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
/**\class GeomAPI_XYZ
* \ingroup DataModel
void setZ(const double theZ);
/// result is sum of coordinates of this and the given argument
- const boost::shared_ptr<GeomAPI_XYZ> added(const boost::shared_ptr<GeomAPI_XYZ>& theArg);
+ const std::shared_ptr<GeomAPI_XYZ> added(const std::shared_ptr<GeomAPI_XYZ>& theArg);
/// result is difference between coordinates of this and the given argument
- const boost::shared_ptr<GeomAPI_XYZ> decreased(const boost::shared_ptr<GeomAPI_XYZ>& theArg);
+ const std::shared_ptr<GeomAPI_XYZ> decreased(const std::shared_ptr<GeomAPI_XYZ>& theArg);
/// result is coordinates multiplied by the argument
- const boost::shared_ptr<GeomAPI_XYZ> multiplied(const double theArg);
+ const std::shared_ptr<GeomAPI_XYZ> multiplied(const double theArg);
/// result is a scalar product of two triplets
- double dot(const boost::shared_ptr<GeomAPI_XYZ>& theArg) const;
+ double dot(const std::shared_ptr<GeomAPI_XYZ>& theArg) const;
/// result is a cross product of two triplets
- const boost::shared_ptr<GeomAPI_XYZ> cross(const boost::shared_ptr<GeomAPI_XYZ>& theArg) const;
+ const std::shared_ptr<GeomAPI_XYZ> cross(const std::shared_ptr<GeomAPI_XYZ>& theArg) const;
/// Distance between two triplets
- double distance(const boost::shared_ptr<GeomAPI_XYZ>& theOther) const;
+ double distance(const std::shared_ptr<GeomAPI_XYZ>& theOther) const;
};
#endif
/* GeomAPI.i */
%module GeomAlgoAPI
%{
- #include "memory"
#include "GeomAlgoAPI.h"
#include "GeomAlgoAPI_FaceBuilder.h"
#include "GeomAlgoAPI_EdgeBuilder.h"
%include "typemaps.i"
%include "std_string.i"
%include "std_list.i"
-//%include <std_shared_ptr.i>
-%include <boost_shared_ptr.i>
+%include "std_shared_ptr.i"
-%template(ShapeList) std::list<boost::shared_ptr<GeomAPI_Shape> >;
+%template(ShapeList) std::list<std::shared_ptr<GeomAPI_Shape> >;
// all supported interfaces
%include "GeomAlgoAPI_FaceBuilder.h"
#include <TopExp_Explorer.hxx>
#include <GeomAlgoAPI_DFLoader.h>
-boost::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_Boolean::makeCut(
- boost::shared_ptr<GeomAPI_Shape> theShape,
- boost::shared_ptr<GeomAPI_Shape> theTool)
+std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_Boolean::makeCut(
+ std::shared_ptr<GeomAPI_Shape> theShape,
+ std::shared_ptr<GeomAPI_Shape> theTool)
{
const TopoDS_Shape& aShape = theShape->impl<TopoDS_Shape>();
const TopoDS_Shape& aTool = theTool->impl<TopoDS_Shape>();
BRepAlgoAPI_Cut aCut(aShape, aTool);
if (aCut.IsDone()) {
- boost::shared_ptr<GeomAPI_Shape> aResult(new GeomAPI_Shape());
+ std::shared_ptr<GeomAPI_Shape> aResult(new GeomAPI_Shape());
aResult->setImpl(new TopoDS_Shape(aCut.Shape()));
return aResult;
}
- return boost::shared_ptr<GeomAPI_Shape>();
+ return std::shared_ptr<GeomAPI_Shape>();
}
-boost::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_Boolean::makeFuse(
- boost::shared_ptr<GeomAPI_Shape> theShape,
- boost::shared_ptr<GeomAPI_Shape> theTool)
+std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_Boolean::makeFuse(
+ std::shared_ptr<GeomAPI_Shape> theShape,
+ std::shared_ptr<GeomAPI_Shape> theTool)
{
const TopoDS_Shape& aShape = theShape->impl<TopoDS_Shape>();
const TopoDS_Shape& aTool = theTool->impl<TopoDS_Shape>();
BRepAlgoAPI_Fuse aFuse(aShape, aTool);
if (aFuse.IsDone()) {
- boost::shared_ptr<GeomAPI_Shape> aResult(new GeomAPI_Shape());
+ std::shared_ptr<GeomAPI_Shape> aResult(new GeomAPI_Shape());
aResult->setImpl(new TopoDS_Shape(aFuse.Shape()));
return aResult;
}
- return boost::shared_ptr<GeomAPI_Shape>();
+ return std::shared_ptr<GeomAPI_Shape>();
}
-boost::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_Boolean::makeCommon(
- boost::shared_ptr<GeomAPI_Shape> theShape,
- boost::shared_ptr<GeomAPI_Shape> theTool)
+std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_Boolean::makeCommon(
+ std::shared_ptr<GeomAPI_Shape> theShape,
+ std::shared_ptr<GeomAPI_Shape> theTool)
{
const TopoDS_Shape& aShape = theShape->impl<TopoDS_Shape>();
const TopoDS_Shape& aTool = theTool->impl<TopoDS_Shape>();
BRepAlgoAPI_Common aCommon(aShape, aTool);
if (aCommon.IsDone()) {
- boost::shared_ptr<GeomAPI_Shape> aResult(new GeomAPI_Shape());
+ std::shared_ptr<GeomAPI_Shape> aResult(new GeomAPI_Shape());
aResult->setImpl(new TopoDS_Shape(aCommon.Shape()));
return aResult;
}
- return boost::shared_ptr<GeomAPI_Shape>();
+ return std::shared_ptr<GeomAPI_Shape>();
}
//============================================================================
-GeomAlgoAPI_Boolean::GeomAlgoAPI_Boolean(boost::shared_ptr<GeomAPI_Shape> theObject,
- boost::shared_ptr<GeomAPI_Shape> theTool,
+GeomAlgoAPI_Boolean::GeomAlgoAPI_Boolean(std::shared_ptr<GeomAPI_Shape> theObject,
+ std::shared_ptr<GeomAPI_Shape> theTool,
int theType)
: myOperation(theType), myDone(false), myShape(new GeomAPI_Shape())
{
//============================================================================
-void GeomAlgoAPI_Boolean::build(boost::shared_ptr<GeomAPI_Shape> theObject,
- boost::shared_ptr<GeomAPI_Shape> theTool)
+void GeomAlgoAPI_Boolean::build(std::shared_ptr<GeomAPI_Shape> theObject,
+ std::shared_ptr<GeomAPI_Shape> theTool)
{
const TopoDS_Shape& anObject = theObject->impl<TopoDS_Shape>();
const TopoDS_Shape& aTool = theTool->impl<TopoDS_Shape>();
if(aResult.ShapeType() == TopAbs_COMPOUND)
aResult = GeomAlgoAPI_DFLoader::refineResult(aResult);
myShape->setImpl(new TopoDS_Shape(aResult));
- boost::shared_ptr<GeomAPI_Shape> aGeomResult(new GeomAPI_Shape());
+ std::shared_ptr<GeomAPI_Shape> aGeomResult(new GeomAPI_Shape());
aGeomResult->setImpl(new TopoDS_Shape(aResult));
// fill data map to keep correct orientation of sub-shapes
for (TopExp_Explorer Exp(aResult,TopAbs_FACE); Exp.More(); Exp.Next()) {
- boost::shared_ptr<GeomAPI_Shape> aCurrentShape(new GeomAPI_Shape());
+ std::shared_ptr<GeomAPI_Shape> aCurrentShape(new GeomAPI_Shape());
aCurrentShape->setImpl(new TopoDS_Shape(Exp.Current()));
myMap.bind(aCurrentShape, aCurrentShape);
}
}
//============================================================================
-const boost::shared_ptr<GeomAPI_Shape>& GeomAlgoAPI_Boolean::shape () const
+const std::shared_ptr<GeomAPI_Shape>& GeomAlgoAPI_Boolean::shape () const
{
return myShape;
}
#include <GeomAPI_Shape.h>
#include <GeomAlgoAPI_MakeShape.h>
#include <GeomAPI_DataMapOfShapeShape.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
/**\class GeomAlgoAPI_Boolean
* \ingroup DataAlgo
* \param[in] theTool toole shape for boolean
* \return a solid as result of operation
*/
- GEOMALGOAPI_EXPORT static boost::shared_ptr<GeomAPI_Shape> makeCut(
- boost::shared_ptr<GeomAPI_Shape> theShape,
- boost::shared_ptr<GeomAPI_Shape> theTool);
+ GEOMALGOAPI_EXPORT static std::shared_ptr<GeomAPI_Shape> makeCut(
+ std::shared_ptr<GeomAPI_Shape> theShape,
+ std::shared_ptr<GeomAPI_Shape> theTool);
/* \brief Creates fuse boolean operation
* \param[in] theShape the main shape
* \param[in] theTool second shape
* \return a solid as result of operation
*/
- GEOMALGOAPI_EXPORT static boost::shared_ptr<GeomAPI_Shape> makeFuse(
- boost::shared_ptr<GeomAPI_Shape> theShape,
- boost::shared_ptr<GeomAPI_Shape> theTool);
+ GEOMALGOAPI_EXPORT static std::shared_ptr<GeomAPI_Shape> makeFuse(
+ std::shared_ptr<GeomAPI_Shape> theShape,
+ std::shared_ptr<GeomAPI_Shape> theTool);
/* \brief Creates common boolean operation
* \param[in] theObject the main shape
* \param[in] theType type of the operation: Fuse, Cut, Common
* \return a solid as result of operation
*/
- GEOMALGOAPI_EXPORT static boost::shared_ptr<GeomAPI_Shape> makeCommon(
- boost::shared_ptr<GeomAPI_Shape> theObject,
- boost::shared_ptr<GeomAPI_Shape> theTool);
+ GEOMALGOAPI_EXPORT static std::shared_ptr<GeomAPI_Shape> makeCommon(
+ std::shared_ptr<GeomAPI_Shape> theObject,
+ std::shared_ptr<GeomAPI_Shape> theTool);
enum {
BOOL_CUT,
BOOL_COMMON
};
/// Constructor
- GEOMALGOAPI_EXPORT GeomAlgoAPI_Boolean (boost::shared_ptr<GeomAPI_Shape> theObject,
- boost::shared_ptr<GeomAPI_Shape> theTool,
+ GEOMALGOAPI_EXPORT GeomAlgoAPI_Boolean (std::shared_ptr<GeomAPI_Shape> theObject,
+ std::shared_ptr<GeomAPI_Shape> theTool,
int theType);
/// Returns True if algorithm succeed
GEOMALGOAPI_EXPORT const bool isValid() const;
/// Returns result of the boolean algorithm which may be a Solid or a Face
- GEOMALGOAPI_EXPORT const boost::shared_ptr<GeomAPI_Shape>& shape () const;
+ GEOMALGOAPI_EXPORT const std::shared_ptr<GeomAPI_Shape>& shape () const;
/// Returns map of sub-shapes of the result. To be used for History keeping
GEOMALGOAPI_EXPORT void mapOfShapes (GeomAPI_DataMapOfShapeShape& theMap) const;
private:
/// builds resulting shape
- void build(boost::shared_ptr<GeomAPI_Shape> theObject,
- boost::shared_ptr<GeomAPI_Shape> theTool);
+ void build(std::shared_ptr<GeomAPI_Shape> theObject,
+ std::shared_ptr<GeomAPI_Shape> theTool);
/// fields
double mySize;
bool myDone;
int myOperation;
- boost::shared_ptr<GeomAPI_Shape> myShape;
+ std::shared_ptr<GeomAPI_Shape> myShape;
GeomAPI_DataMapOfShapeShape myMap;
GeomAlgoAPI_MakeShape * myMkShape;
};
#include <BRep_Builder.hxx>
#include <TopoDS_Compound.hxx>
-boost::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_CompoundBuilder::compound(
- std::list<boost::shared_ptr<GeomAPI_Shape> > theShapes)
+std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_CompoundBuilder::compound(
+ std::list<std::shared_ptr<GeomAPI_Shape> > theShapes)
{
BRep_Builder aBuilder;
TopoDS_Compound aComp;
aBuilder.MakeCompound(aComp);
- std::list<boost::shared_ptr<GeomAPI_Shape> >::const_iterator anIt = theShapes.begin(), aLast =
+ std::list<std::shared_ptr<GeomAPI_Shape> >::const_iterator anIt = theShapes.begin(), aLast =
theShapes.end();
for (; anIt != aLast; anIt++) {
aBuilder.Add(aComp, (*anIt)->impl<TopoDS_Shape>());
}
- boost::shared_ptr<GeomAPI_Shape> aRes(new GeomAPI_Shape);
+ std::shared_ptr<GeomAPI_Shape> aRes(new GeomAPI_Shape);
aRes->setImpl(new TopoDS_Shape(aComp));
return aRes;
}
#include <GeomAPI_Shape.h>
#include <GeomAPI_Pnt.h>
#include <GeomAPI_Dir.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <list>
public:
/// Creates compund of the given shapes
/// \param theShapes a list of shapes
- static boost::shared_ptr<GeomAPI_Shape> compound(
- std::list<boost::shared_ptr<GeomAPI_Shape> > theShapes);
+ static std::shared_ptr<GeomAPI_Shape> compound(
+ std::list<std::shared_ptr<GeomAPI_Shape> > theShapes);
};
#endif
#include <gp_Ax2.hxx>
#include <gp_Circ.hxx>
-boost::shared_ptr<GeomAPI_Edge> GeomAlgoAPI_EdgeBuilder::line(
- boost::shared_ptr<GeomAPI_Pnt> theStart, boost::shared_ptr<GeomAPI_Pnt> theEnd)
+std::shared_ptr<GeomAPI_Edge> GeomAlgoAPI_EdgeBuilder::line(
+ std::shared_ptr<GeomAPI_Pnt> theStart, std::shared_ptr<GeomAPI_Pnt> theEnd)
{
const gp_Pnt& aStart = theStart->impl<gp_Pnt>();
const gp_Pnt& anEnd = theEnd->impl<gp_Pnt>();
if (aStart.IsEqual(anEnd, Precision::Confusion()))
- return boost::shared_ptr<GeomAPI_Edge>();
+ return std::shared_ptr<GeomAPI_Edge>();
if (Abs(aStart.SquareDistance(anEnd)) > 1.e+100)
- return boost::shared_ptr<GeomAPI_Edge>();
+ return std::shared_ptr<GeomAPI_Edge>();
BRepBuilderAPI_MakeEdge anEdgeBuilder(aStart, anEnd);
- boost::shared_ptr<GeomAPI_Edge> aRes(new GeomAPI_Edge);
+ std::shared_ptr<GeomAPI_Edge> aRes(new GeomAPI_Edge);
TopoDS_Edge anEdge = anEdgeBuilder.Edge();
aRes->setImpl(new TopoDS_Shape(anEdge));
return aRes;
}
-boost::shared_ptr<GeomAPI_Edge> GeomAlgoAPI_EdgeBuilder::lineCircle(
- boost::shared_ptr<GeomAPI_Pnt> theCenter, boost::shared_ptr<GeomAPI_Dir> theNormal,
+std::shared_ptr<GeomAPI_Edge> GeomAlgoAPI_EdgeBuilder::lineCircle(
+ std::shared_ptr<GeomAPI_Pnt> theCenter, std::shared_ptr<GeomAPI_Dir> theNormal,
double theRadius)
{
const gp_Pnt& aCenter = theCenter->impl<gp_Pnt>();
gp_Circ aCircle(gp_Ax2(aCenter, aDir), theRadius);
BRepBuilderAPI_MakeEdge anEdgeBuilder(aCircle);
- boost::shared_ptr<GeomAPI_Edge> aRes(new GeomAPI_Edge);
+ std::shared_ptr<GeomAPI_Edge> aRes(new GeomAPI_Edge);
TopoDS_Edge anEdge = anEdgeBuilder.Edge();
aRes->setImpl(new TopoDS_Shape(anEdge));
return aRes;
}
-boost::shared_ptr<GeomAPI_Edge> GeomAlgoAPI_EdgeBuilder::lineCircleArc(
- boost::shared_ptr<GeomAPI_Pnt> theCenter, boost::shared_ptr<GeomAPI_Pnt> theStartPoint,
- boost::shared_ptr<GeomAPI_Pnt> theEndPoint, boost::shared_ptr<GeomAPI_Dir> theNormal)
+std::shared_ptr<GeomAPI_Edge> GeomAlgoAPI_EdgeBuilder::lineCircleArc(
+ std::shared_ptr<GeomAPI_Pnt> theCenter, std::shared_ptr<GeomAPI_Pnt> theStartPoint,
+ std::shared_ptr<GeomAPI_Pnt> theEndPoint, std::shared_ptr<GeomAPI_Dir> theNormal)
{
const gp_Pnt& aCenter = theCenter->impl<gp_Pnt>();
const gp_Dir& aDir = theNormal->impl<gp_Dir>();
else
anEdgeBuilder = BRepBuilderAPI_MakeEdge(aCircle, aStart, anEnd);
- boost::shared_ptr<GeomAPI_Edge> aRes(new GeomAPI_Edge);
+ std::shared_ptr<GeomAPI_Edge> aRes(new GeomAPI_Edge);
anEdgeBuilder.Build();
if (anEdgeBuilder.IsDone())
aRes->setImpl(new TopoDS_Shape(anEdgeBuilder.Edge()));
else
- aRes = boost::shared_ptr<GeomAPI_Edge>();
+ aRes = std::shared_ptr<GeomAPI_Edge>();
return aRes;
}
#include <GeomAPI_Edge.h>
#include <GeomAPI_Pnt.h>
#include <GeomAPI_Dir.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
/**\class GeomAlgoAPI_EdgeBuilder
* \ingroup DataAlgo
{
public:
/// Creates linear edge by two points
- static boost::shared_ptr<GeomAPI_Edge> line(boost::shared_ptr<GeomAPI_Pnt> theStart,
- boost::shared_ptr<GeomAPI_Pnt> theEnd);
+ static std::shared_ptr<GeomAPI_Edge> line(std::shared_ptr<GeomAPI_Pnt> theStart,
+ std::shared_ptr<GeomAPI_Pnt> theEnd);
/// Creates linear edge in a form of a circle by a point and a circle radius
- static boost::shared_ptr<GeomAPI_Edge> lineCircle(boost::shared_ptr<GeomAPI_Pnt> theCenter,
- boost::shared_ptr<GeomAPI_Dir> theNormal,
+ static std::shared_ptr<GeomAPI_Edge> lineCircle(std::shared_ptr<GeomAPI_Pnt> theCenter,
+ std::shared_ptr<GeomAPI_Dir> theNormal,
double theRadius);
/// Creates linear edge in a form of a circle arc by a three points
- static boost::shared_ptr<GeomAPI_Edge> lineCircleArc(boost::shared_ptr<GeomAPI_Pnt> theCenter,
- boost::shared_ptr<GeomAPI_Pnt> theStartPoint,
- boost::shared_ptr<GeomAPI_Pnt> theEndPoint,
- boost::shared_ptr<GeomAPI_Dir> theNormal);
+ static std::shared_ptr<GeomAPI_Edge> lineCircleArc(std::shared_ptr<GeomAPI_Pnt> theCenter,
+ std::shared_ptr<GeomAPI_Pnt> theStartPoint,
+ std::shared_ptr<GeomAPI_Pnt> theEndPoint,
+ std::shared_ptr<GeomAPI_Dir> theNormal);
};
#endif
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <Precision.hxx>
#include <TDF_TagSource.hxx>
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <BRepPrimAPI_MakePrism.hxx>
#include <TopoDS_Shape.hxx>
const double tolerance = Precision::Angular();
// Constructor
GeomAlgoAPI_Extrusion::GeomAlgoAPI_Extrusion(
- boost::shared_ptr<GeomAPI_Shape> theBasis, double theSize)
+ std::shared_ptr<GeomAPI_Shape> theBasis, double theSize)
: mySize(theSize), myDone(false), myShape(new GeomAPI_Shape()),
myFirst(new GeomAPI_Shape()), myLast(new GeomAPI_Shape())
{
}
//============================================================================
-void GeomAlgoAPI_Extrusion::build(const boost::shared_ptr<GeomAPI_Shape>& theBasis)
+void GeomAlgoAPI_Extrusion::build(const std::shared_ptr<GeomAPI_Shape>& theBasis)
{
bool isFirstNorm = true;
gp_Dir aShapeNormal;
aResult = aBuilder->Shape();
// fill data map to keep correct orientation of sub-shapes
for (TopExp_Explorer Exp(aResult,TopAbs_FACE); Exp.More(); Exp.Next()) {
- boost::shared_ptr<GeomAPI_Shape> aCurrentShape(new GeomAPI_Shape());
+ std::shared_ptr<GeomAPI_Shape> aCurrentShape(new GeomAPI_Shape());
aCurrentShape->setImpl(new TopoDS_Shape(Exp.Current()));
myMap.bind(aCurrentShape, aCurrentShape);
}
}
//============================================================================
-const boost::shared_ptr<GeomAPI_Shape>& GeomAlgoAPI_Extrusion::shape () const
+const std::shared_ptr<GeomAPI_Shape>& GeomAlgoAPI_Extrusion::shape () const
{
return myShape;
}
//============================================================================
-const boost::shared_ptr<GeomAPI_Shape>& GeomAlgoAPI_Extrusion::firstShape()
+const std::shared_ptr<GeomAPI_Shape>& GeomAlgoAPI_Extrusion::firstShape()
{
return myFirst;
}
//============================================================================
-const boost::shared_ptr<GeomAPI_Shape>& GeomAlgoAPI_Extrusion::lastShape()
+const std::shared_ptr<GeomAPI_Shape>& GeomAlgoAPI_Extrusion::lastShape()
{
return myLast;
}
#include <GeomAPI_Dir.h>
#include <GeomAlgoAPI_MakeShape.h>
#include <GeomAPI_DataMapOfShapeShape.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
/**\class GeomAlgoAPI_Extrusion
* \ingroup DataAlgo
* \brief Allows to create the prism based on a given face and a direction
* \return a solid or a face/shell which is obtained from specified one
*/
/// Constructor
- GEOMALGOAPI_EXPORT GeomAlgoAPI_Extrusion (boost::shared_ptr<GeomAPI_Shape> theBasis, double theSize);
+ GEOMALGOAPI_EXPORT GeomAlgoAPI_Extrusion (std::shared_ptr<GeomAPI_Shape> theBasis, double theSize);
/// Returns True if algorithm succeed
GEOMALGOAPI_EXPORT const bool isDone() const;
GEOMALGOAPI_EXPORT const bool hasVolume() const;
/// Returns result of the Extrusion algorithm which may be a Solid or a Face
- GEOMALGOAPI_EXPORT const boost::shared_ptr<GeomAPI_Shape>& shape () const;
+ GEOMALGOAPI_EXPORT const std::shared_ptr<GeomAPI_Shape>& shape () const;
/// Returns the first shape
- GEOMALGOAPI_EXPORT const boost::shared_ptr<GeomAPI_Shape>& firstShape();
+ GEOMALGOAPI_EXPORT const std::shared_ptr<GeomAPI_Shape>& firstShape();
/// returns last shape
- GEOMALGOAPI_EXPORT const boost::shared_ptr<GeomAPI_Shape>& lastShape();
+ GEOMALGOAPI_EXPORT const std::shared_ptr<GeomAPI_Shape>& lastShape();
/// Returns map of sub-shapes of the result. To be used for History keeping
GEOMALGOAPI_EXPORT void mapOfShapes (GeomAPI_DataMapOfShapeShape& theMap) const;
GEOMALGOAPI_EXPORT ~GeomAlgoAPI_Extrusion();
private:
/// builds resulting shape
- void build(const boost::shared_ptr<GeomAPI_Shape>& theBasis);
+ void build(const std::shared_ptr<GeomAPI_Shape>& theBasis);
/// fields
double mySize;
bool myDone;
- boost::shared_ptr<GeomAPI_Shape> myShape;
- boost::shared_ptr<GeomAPI_Shape> myFirst;
- boost::shared_ptr<GeomAPI_Shape> myLast;
+ std::shared_ptr<GeomAPI_Shape> myShape;
+ std::shared_ptr<GeomAPI_Shape> myFirst;
+ std::shared_ptr<GeomAPI_Shape> myLast;
GeomAPI_DataMapOfShapeShape myMap;
GeomAlgoAPI_MakeShape * myMkShape;
};
#include <BRep_Tool.hxx>
#include <Geom_Plane.hxx>
-boost::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_FaceBuilder::square(
- boost::shared_ptr<GeomAPI_Pnt> theCenter, boost::shared_ptr<GeomAPI_Dir> theNormal,
+std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_FaceBuilder::square(
+ std::shared_ptr<GeomAPI_Pnt> theCenter, std::shared_ptr<GeomAPI_Dir> theNormal,
const double theSize)
{
const gp_Pnt& aCenter = theCenter->impl<gp_Pnt>();
// half of the size in each direction from the center
BRepBuilderAPI_MakeFace aFaceBuilder(aPlane, -theSize / 2., theSize / 2., -theSize / 2.,
theSize / 2.);
- boost::shared_ptr<GeomAPI_Shape> aRes(new GeomAPI_Shape);
+ std::shared_ptr<GeomAPI_Shape> aRes(new GeomAPI_Shape);
aRes->setImpl(new TopoDS_Shape(aFaceBuilder.Face()));
return aRes;
}
-boost::shared_ptr<GeomAPI_Pln> GeomAlgoAPI_FaceBuilder::plane(
- boost::shared_ptr<GeomAPI_Shape> theFace)
+std::shared_ptr<GeomAPI_Pln> GeomAlgoAPI_FaceBuilder::plane(
+ std::shared_ptr<GeomAPI_Shape> theFace)
{
- boost::shared_ptr<GeomAPI_Pln> aResult;
+ std::shared_ptr<GeomAPI_Pln> aResult;
if (!theFace)
return aResult; // bad shape
TopoDS_Shape aShape = theFace->impl<TopoDS_Shape>();
return aResult; // not planar
double aA, aB, aC, aD;
aPlane->Coefficients(aA, aB, aC, aD);
- aResult = boost::shared_ptr<GeomAPI_Pln>(new GeomAPI_Pln(aA, aB, aC, aD));
+ aResult = std::shared_ptr<GeomAPI_Pln>(new GeomAPI_Pln(aA, aB, aC, aD));
return aResult;
}
#include <GeomAPI_Pnt.h>
#include <GeomAPI_Pln.h>
#include <GeomAPI_Dir.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
/**\class GeomAlgoAPI_FaceBuilder
* \ingroup DataAlgo
public:
/// Creates square planar face by given point of the center,
/// normal to the plane and size of square
- static boost::shared_ptr<GeomAPI_Shape> square(boost::shared_ptr<GeomAPI_Pnt> theCenter,
- boost::shared_ptr<GeomAPI_Dir> theNormal,
+ static std::shared_ptr<GeomAPI_Shape> square(std::shared_ptr<GeomAPI_Pnt> theCenter,
+ std::shared_ptr<GeomAPI_Dir> theNormal,
const double theSize);
/// Returns the plane of the planar face. If it is not planar, returns empty ptr.
- static boost::shared_ptr<GeomAPI_Pln> plane(boost::shared_ptr<GeomAPI_Shape> theFace);
+ static std::shared_ptr<GeomAPI_Pln> plane(std::shared_ptr<GeomAPI_Shape> theFace);
};
#endif
setImpl((void *)implPtr<BRepBuilderAPI_MakeShape>());
}
-const boost::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_MakeShape::shape() const
+const std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_MakeShape::shape() const
{
return myShape;
}
/// Returns the list of shapes generated from the shape <theShape>
void GeomAlgoAPI_MakeShape::generated(
- const boost::shared_ptr<GeomAPI_Shape> theShape, ListOfShape& theHistory)
+ const std::shared_ptr<GeomAPI_Shape> theShape, ListOfShape& theHistory)
{
BRepBuilderAPI_MakeShape* aBuilder = implPtr<BRepBuilderAPI_MakeShape>();
if(aBuilder) {
const TopTools_ListOfShape& aList = aBuilder->Generated(theShape->impl<TopoDS_Shape>());
TopTools_ListIteratorOfListOfShape it(aList);
for(;it.More();it.Next()) {
- boost::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
+ std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
aShape->setImpl(new TopoDS_Shape(it.Value()));
theHistory.push_back(aShape);
}
/// Returns the list of shapes modified from the shape <theShape>
void GeomAlgoAPI_MakeShape::modified(
- const boost::shared_ptr<GeomAPI_Shape> theShape, ListOfShape& theHistory)
+ const std::shared_ptr<GeomAPI_Shape> theShape, ListOfShape& theHistory)
{
BRepBuilderAPI_MakeShape* aBuilder = implPtr<BRepBuilderAPI_MakeShape>();
if(aBuilder) {
const TopTools_ListOfShape& aList = aBuilder->Modified(theShape->impl<TopoDS_Shape>());
TopTools_ListIteratorOfListOfShape it(aList);
for(;it.More();it.Next()) {
- boost::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
+ std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
aShape->setImpl(new TopoDS_Shape(it.Value()));
theHistory.push_back(aShape);
}
}
/// Returns whether the shape is an edge
-bool GeomAlgoAPI_MakeShape::isDeleted(const boost::shared_ptr<GeomAPI_Shape> theShape)
+bool GeomAlgoAPI_MakeShape::isDeleted(const std::shared_ptr<GeomAPI_Shape> theShape)
{
bool isDeleted(false);
BRepBuilderAPI_MakeShape* aBuilder = implPtr<BRepBuilderAPI_MakeShape>();
#define GeomAlgoAPI_MakeShape_H_
#include <GeomAPI_Shape.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <GeomAlgoAPI.h>
//#include <BRepBuilderAPI_MakeShape.hxx>
/**\class GeomAlgoAPI_MakeShape
GEOMALGOAPI_EXPORT GeomAlgoAPI_MakeShape(void* theBuilder);
/// Returns a shape built by the shape construction algorithm
- GEOMALGOAPI_EXPORT const boost::shared_ptr<GeomAPI_Shape> shape() const;
+ GEOMALGOAPI_EXPORT const std::shared_ptr<GeomAPI_Shape> shape() const;
/// Returns the list of shapes generated from the shape <theShape>
GEOMALGOAPI_EXPORT virtual void generated(
- const boost::shared_ptr<GeomAPI_Shape> theShape, ListOfShape& theHistory);
+ const std::shared_ptr<GeomAPI_Shape> theShape, ListOfShape& theHistory);
/// Returns the list of shapes modified from the shape <theShape>
GEOMALGOAPI_EXPORT virtual void modified(
- const boost::shared_ptr<GeomAPI_Shape> theShape, ListOfShape& theHistory);
+ const std::shared_ptr<GeomAPI_Shape> theShape, ListOfShape& theHistory);
/// Returns whether the shape is an edge
- GEOMALGOAPI_EXPORT virtual bool isDeleted(const boost::shared_ptr<GeomAPI_Shape> theShape);
+ GEOMALGOAPI_EXPORT virtual bool isDeleted(const std::shared_ptr<GeomAPI_Shape> theShape);
GEOMALGOAPI_EXPORT void init(void* theMkShape);
protected:
- boost::shared_ptr<GeomAPI_Shape> myShape;
+ std::shared_ptr<GeomAPI_Shape> myShape;
};
#endif
#include <BRepBuilderAPI_MakeVertex.hxx>
#include <TopoDS_Vertex.hxx>
-boost::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_PointBuilder::point(
- boost::shared_ptr<GeomAPI_Pnt> thePoint)
+std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_PointBuilder::point(
+ std::shared_ptr<GeomAPI_Pnt> thePoint)
{
const gp_Pnt& aPnt = thePoint->impl<gp_Pnt>();
BRepBuilderAPI_MakeVertex aMaker(aPnt);
TopoDS_Vertex aVertex = aMaker.Vertex();
- boost::shared_ptr<GeomAPI_Shape> aRes(new GeomAPI_Shape);
+ std::shared_ptr<GeomAPI_Shape> aRes(new GeomAPI_Shape);
aRes->setImpl(new TopoDS_Shape(aVertex));
return aRes;
}
#define GeomAlgoAPI_PointBuilder_H_
#include <GeomAlgoAPI.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
class GeomAPI_Shape;
class GeomAPI_Pnt;
{
public:
/// Creates linear edge by two points
- static boost::shared_ptr<GeomAPI_Shape> point(boost::shared_ptr<GeomAPI_Pnt> thePoint);
+ static std::shared_ptr<GeomAPI_Shape> point(std::shared_ptr<GeomAPI_Pnt> thePoint);
};
#endif
void GeomAlgoAPI_SketchBuilder::createFaces(
- const boost::shared_ptr<GeomAPI_Pnt>& theOrigin, const boost::shared_ptr<GeomAPI_Dir>& theDirX,
- const boost::shared_ptr<GeomAPI_Dir>& theDirY, const boost::shared_ptr<GeomAPI_Dir>& theNorm,
- const std::list<boost::shared_ptr<GeomAPI_Shape> >& theFeatures,
- std::list<boost::shared_ptr<GeomAPI_Shape> >& theResultFaces,
- std::list<boost::shared_ptr<GeomAPI_Shape> >& theResultWires)
+ const std::shared_ptr<GeomAPI_Pnt>& theOrigin, const std::shared_ptr<GeomAPI_Dir>& theDirX,
+ const std::shared_ptr<GeomAPI_Dir>& theDirY, const std::shared_ptr<GeomAPI_Dir>& theNorm,
+ const std::list<std::shared_ptr<GeomAPI_Shape> >& theFeatures,
+ std::list<std::shared_ptr<GeomAPI_Shape> >& theResultFaces,
+ std::list<std::shared_ptr<GeomAPI_Shape> >& theResultWires)
{
if (theFeatures.empty())
return;
TopoDS_Shape aFeaturesCompound;
// Obtain only edges from the features list
- std::list<boost::shared_ptr<GeomAPI_Shape> > anEdges;
- std::list<boost::shared_ptr<GeomAPI_Shape> >::const_iterator aFeatIt = theFeatures.begin();
+ std::list<std::shared_ptr<GeomAPI_Shape> > anEdges;
+ std::list<std::shared_ptr<GeomAPI_Shape> >::const_iterator aFeatIt = theFeatures.begin();
for (; aFeatIt != theFeatures.end(); aFeatIt++) {
- boost::shared_ptr<GeomAPI_Shape> aShape(*aFeatIt);
+ std::shared_ptr<GeomAPI_Shape> aShape(*aFeatIt);
const TopoDS_Edge& anEdge = aShape->impl<TopoDS_Edge>();
if (anEdge.ShapeType() == TopAbs_EDGE)
anEdges.push_back(aShape);
if (anEdges.size() == 1) { // If there is only one feature, BOPAlgo_Builder will decline to work. Need to process it anyway
aFeaturesCompound = anEdges.front()->impl<TopoDS_Shape>();
} else {
- std::list<boost::shared_ptr<GeomAPI_Shape> >::const_iterator anIt = anEdges.begin();
+ std::list<std::shared_ptr<GeomAPI_Shape> >::const_iterator anIt = anEdges.begin();
for (; anIt != anEdges.end(); anIt++) {
- boost::shared_ptr<GeomAPI_Shape> aPreview(*anIt);
+ std::shared_ptr<GeomAPI_Shape> aPreview(*anIt);
aBuilder.AddArgument(aPreview->impl<TopoDS_Edge>());
}
aPF.SetArguments(aBuilder.Arguments());
TopoDS_Face aPatch;
createFace(*aVertIter, anEdgeIter, aProcEdges.end(), aPlane, aPatch);
if (!aPatch.IsNull()) {
- boost::shared_ptr<GeomAPI_Shape> aFace(new GeomAPI_Shape);
+ std::shared_ptr<GeomAPI_Shape> aFace(new GeomAPI_Shape);
aFace->setImpl(new TopoDS_Face(aPatch));
theResultFaces.push_back(aFace);
}
std::list<TopoDS_Wire>::const_iterator aTailIter = aTail.begin();
for (; aTailIter != aTail.end(); aTailIter++)
if (!aTailIter->IsNull()) {
- boost::shared_ptr<GeomAPI_Shape> aWire(new GeomAPI_Shape);
+ std::shared_ptr<GeomAPI_Shape> aWire(new GeomAPI_Shape);
aWire->setImpl(new TopoDS_Shape(*aTailIter));
theResultWires.push_back(aWire);
}
fixIntersections(theResultFaces);
}
-void GeomAlgoAPI_SketchBuilder::createFaces(const boost::shared_ptr<GeomAPI_Pnt>& theOrigin,
- const boost::shared_ptr<GeomAPI_Dir>& theDirX,
- const boost::shared_ptr<GeomAPI_Dir>& theDirY,
- const boost::shared_ptr<GeomAPI_Dir>& theNorm,
- const boost::shared_ptr<GeomAPI_Shape>& theWire,
- std::list<boost::shared_ptr<GeomAPI_Shape> >& theResultFaces)
+void GeomAlgoAPI_SketchBuilder::createFaces(const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
+ const std::shared_ptr<GeomAPI_Dir>& theDirX,
+ const std::shared_ptr<GeomAPI_Dir>& theDirY,
+ const std::shared_ptr<GeomAPI_Dir>& theNorm,
+ const std::shared_ptr<GeomAPI_Shape>& theWire,
+ std::list<std::shared_ptr<GeomAPI_Shape> >& theResultFaces)
{
- boost::shared_ptr<GeomAPI_PlanarEdges> aWire = boost::dynamic_pointer_cast<GeomAPI_PlanarEdges>(theWire);
+ std::shared_ptr<GeomAPI_PlanarEdges> aWire = std::dynamic_pointer_cast<GeomAPI_PlanarEdges>(theWire);
if(!aWire)
return;
// Filter wires, return only faces.
- std::list<boost::shared_ptr<GeomAPI_Shape> > aFilteredWires;
+ std::list<std::shared_ptr<GeomAPI_Shape> > aFilteredWires;
createFaces(theOrigin, theDirX, theDirY, theNorm,
aWire->getEdges(), theResultFaces, aFilteredWires);
}
void GeomAlgoAPI_SketchBuilder::fixIntersections(
- std::list<boost::shared_ptr<GeomAPI_Shape> >& theFaces)
+ std::list<std::shared_ptr<GeomAPI_Shape> >& theFaces)
{
BRepClass_FaceClassifier aClassifier;
- std::list<boost::shared_ptr<GeomAPI_Shape> >::iterator anIter1 = theFaces.begin();
- std::list<boost::shared_ptr<GeomAPI_Shape> >::iterator anIter2;
+ std::list<std::shared_ptr<GeomAPI_Shape> >::iterator anIter1 = theFaces.begin();
+ std::list<std::shared_ptr<GeomAPI_Shape> >::iterator anIter2;
for (; anIter1 != theFaces.end(); anIter1++) {
anIter2 = anIter1;
for (++anIter2; anIter2 != theFaces.end(); anIter2++) {
(*anIter2)->setImpl(new TopoDS_Shape(anExp.Current()));
isFirstFace = false;
} else {
- boost::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape);
+ std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape);
aShape->setImpl(new TopoDS_Shape(anExp.Current()));
theFaces.push_back(aShape);
}
(*anIter1)->setImpl(new TopoDS_Shape(anExp.Current()));
isFirstFace = false;
} else {
- boost::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape);
+ std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape);
aShape->setImpl(new TopoDS_Shape(anExp.Current()));
theFaces.push_back(aShape);
}
#include <GeomAlgoAPI.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <list>
#include <GeomAPI_Dir.h>
* It finds the vertex with minimal coordinates along X axis (theDirX) and then
* goes through the edges passing the surrounding area on the left.
*/
- static void createFaces(const boost::shared_ptr<GeomAPI_Pnt>& theOrigin,
- const boost::shared_ptr<GeomAPI_Dir>& theDirX,
- const boost::shared_ptr<GeomAPI_Dir>& theDirY,
- const boost::shared_ptr<GeomAPI_Dir>& theNorm,
- const std::list<boost::shared_ptr<GeomAPI_Shape> >& theFeatures,
- std::list<boost::shared_ptr<GeomAPI_Shape> >& theResultFaces,
- std::list<boost::shared_ptr<GeomAPI_Shape> >& theResultWires);
+ static void createFaces(const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
+ const std::shared_ptr<GeomAPI_Dir>& theDirX,
+ const std::shared_ptr<GeomAPI_Dir>& theDirY,
+ const std::shared_ptr<GeomAPI_Dir>& theNorm,
+ const std::list<std::shared_ptr<GeomAPI_Shape> >& theFeatures,
+ std::list<std::shared_ptr<GeomAPI_Shape> >& theResultFaces,
+ std::list<std::shared_ptr<GeomAPI_Shape> >& theResultWires);
/** \brief Creates list of faces and unclosed wires on basis of the features of the sketch
* \param[in] theOrigin origin point of the sketch
* It finds the vertex with minimal coordinates along X axis (theDirX) and then
* goes through the edges passing the surrounding area on the left.
*/
- static void createFaces(const boost::shared_ptr<GeomAPI_Pnt>& theOrigin,
- const boost::shared_ptr<GeomAPI_Dir>& theDirX,
- const boost::shared_ptr<GeomAPI_Dir>& theDirY,
- const boost::shared_ptr<GeomAPI_Dir>& theNorm,
- const boost::shared_ptr<GeomAPI_Shape>& theWire,
- std::list<boost::shared_ptr<GeomAPI_Shape> >& theResultFaces);
+ static void createFaces(const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
+ const std::shared_ptr<GeomAPI_Dir>& theDirX,
+ const std::shared_ptr<GeomAPI_Dir>& theDirY,
+ const std::shared_ptr<GeomAPI_Dir>& theNorm,
+ const std::shared_ptr<GeomAPI_Shape>& theWire,
+ std::list<std::shared_ptr<GeomAPI_Shape> >& theResultFaces);
/** \brief Searches intersections between the faces in the list
* and make holes in the faces to avoid intersections
* \param[in,out] theFaces list of faces to proccess
*/
- static void fixIntersections(std::list<boost::shared_ptr<GeomAPI_Shape> >& theFaces);
+ static void fixIntersections(std::list<std::shared_ptr<GeomAPI_Shape> >& theFaces);
};
#endif
}
}
-void GeomData_Dir::setValue(const boost::shared_ptr<GeomAPI_Dir>& theDir)
+void GeomData_Dir::setValue(const std::shared_ptr<GeomAPI_Dir>& theDir)
{
setValue(theDir->x(), theDir->y(), theDir->z());
}
return myCoords->Value(2);
}
-boost::shared_ptr<GeomAPI_Dir> GeomData_Dir::dir()
+std::shared_ptr<GeomAPI_Dir> GeomData_Dir::dir()
{
- return boost::shared_ptr<GeomAPI_Dir>(
+ return std::shared_ptr<GeomAPI_Dir>(
new GeomAPI_Dir(myCoords->Value(0), myCoords->Value(1), myCoords->Value(2)));
}
#include "GeomDataAPI_Dir.h"
#include <TDataStd_RealArray.hxx>
#include <TDF_Label.hxx>
-#include <boost/shared_ptr.hpp>
+#include <memory>
class GeomAPI_Dir;
/// Defines the double value
GEOMDATA_EXPORT virtual void setValue(const double theX, const double theY, const double theZ);
/// Defines the direction
- GEOMDATA_EXPORT virtual void setValue(const boost::shared_ptr<GeomAPI_Dir>& theDir);
+ GEOMDATA_EXPORT virtual void setValue(const std::shared_ptr<GeomAPI_Dir>& theDir);
/// Returns the X double value
GEOMDATA_EXPORT virtual double x() const;
/// Returns the Z double value
GEOMDATA_EXPORT virtual double z() const;
/// Returns the direction of this attribute
- GEOMDATA_EXPORT virtual boost::shared_ptr<GeomAPI_Dir> dir();
+ GEOMDATA_EXPORT virtual std::shared_ptr<GeomAPI_Dir> dir();
protected:
/// Initializes attributes
}
}
-void GeomData_Point::setValue(const boost::shared_ptr<GeomAPI_Pnt>& thePoint)
+void GeomData_Point::setValue(const std::shared_ptr<GeomAPI_Pnt>& thePoint)
{
setValue(thePoint->x(), thePoint->y(), thePoint->z());
}
return myCoords->Value(2);
}
-boost::shared_ptr<GeomAPI_Pnt> GeomData_Point::pnt()
+std::shared_ptr<GeomAPI_Pnt> GeomData_Point::pnt()
{
- boost::shared_ptr<GeomAPI_Pnt> aResult(
+ std::shared_ptr<GeomAPI_Pnt> aResult(
new GeomAPI_Pnt(myCoords->Value(0), myCoords->Value(1), myCoords->Value(2)));
return aResult;
}
/// Defines the double value
GEOMDATA_EXPORT virtual void setValue(const double theX, const double theY, const double theZ);
/// Defines the point
- GEOMDATA_EXPORT virtual void setValue(const boost::shared_ptr<GeomAPI_Pnt>& thePoint);
+ GEOMDATA_EXPORT virtual void setValue(const std::shared_ptr<GeomAPI_Pnt>& thePoint);
/// Returns the X double value
GEOMDATA_EXPORT virtual double x() const;
/// Returns the Z double value
GEOMDATA_EXPORT virtual double z() const;
/// Returns the 3D point
- GEOMDATA_EXPORT virtual boost::shared_ptr<GeomAPI_Pnt> pnt();
+ GEOMDATA_EXPORT virtual std::shared_ptr<GeomAPI_Pnt> pnt();
protected:
/// Initializes attributes
}
}
-void GeomData_Point2D::setValue(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint)
+void GeomData_Point2D::setValue(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint)
{
setValue(thePoint->x(), thePoint->y());
}
return myCoords->Value(1);
}
-boost::shared_ptr<GeomAPI_Pnt2d> GeomData_Point2D::pnt()
+std::shared_ptr<GeomAPI_Pnt2d> GeomData_Point2D::pnt()
{
- boost::shared_ptr<GeomAPI_Pnt2d> aResult(
+ std::shared_ptr<GeomAPI_Pnt2d> aResult(
new GeomAPI_Pnt2d(myCoords->Value(0), myCoords->Value(1)));
return aResult;
}
/// Defines the double value
GEOMDATA_EXPORT virtual void setValue(const double theX, const double theY);
/// Defines the point
- GEOMDATA_EXPORT virtual void setValue(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint);
+ GEOMDATA_EXPORT virtual void setValue(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
/// Returns the X double value
GEOMDATA_EXPORT virtual double x() const;
/// Returns the Y double value
GEOMDATA_EXPORT virtual double y() const;
/// Returns the 2D point
- GEOMDATA_EXPORT virtual boost::shared_ptr<GeomAPI_Pnt2d> pnt();
+ GEOMDATA_EXPORT virtual std::shared_ptr<GeomAPI_Pnt2d> pnt();
protected:
/// Initializes attributes
/* GeomDataAPI.i */
%module GeomDataAPI
%{
- #include <boost/shared_ptr.hpp>
-
#include "ModelAPI_Attribute.h"
#include "GeomDataAPI.h"
#include "GeomDataAPI_Point.h"
#include "GeomDataAPI_Dir.h"
#include "GeomDataAPI_Point2D.h"
- template<class T> boost::shared_ptr<T> castTo(boost::shared_ptr<ModelAPI_Attribute> theObject)
+ template<class T> std::shared_ptr<T> castTo(std::shared_ptr<ModelAPI_Attribute> theObject)
{
- return boost::dynamic_pointer_cast<T>(theObject);
+ return std::dynamic_pointer_cast<T>(theObject);
}
%}
%include "typemaps.i"
%include "std_string.i"
%include "std_list.i"
+%include "std_shared_ptr.i"
-// boost pointers
-%include <boost_shared_ptr.i>
%shared_ptr(ModelAPI_Attribute)
%shared_ptr(GeomDataAPI_Point)
%shared_ptr(GeomDataAPI_Dir)
%include "GeomDataAPI_Dir.h"
%include "GeomDataAPI_Point2D.h"
-template<class T> boost::shared_ptr<T> castTo(boost::shared_ptr<ModelAPI_Attribute> theObject);
+template<class T> std::shared_ptr<T> castTo(std::shared_ptr<ModelAPI_Attribute> theObject);
%template(geomDataAPI_Point) castTo<GeomDataAPI_Point>;
%template(geomDataAPI_Dir) castTo<GeomDataAPI_Dir>;
%template(geomDataAPI_Point2D) castTo<GeomDataAPI_Point2D>;
/// Defines the double value
virtual void setValue(const double theX, const double theY, const double theZ) = 0;
/// Defines the direction
- virtual void setValue(const boost::shared_ptr<GeomAPI_Dir>& theDir) = 0;
+ virtual void setValue(const std::shared_ptr<GeomAPI_Dir>& theDir) = 0;
/// Returns the X double value
virtual double x() const = 0;
/// Returns the Z double value
virtual double z() const = 0;
/// Returns the direction of this attribute
- virtual boost::shared_ptr<GeomAPI_Dir> dir() = 0;
+ virtual std::shared_ptr<GeomAPI_Dir> dir() = 0;
/// Returns the type of this class of attributes
static inline std::string type()
/// Defines the double value
virtual void setValue(const double theX, const double theY, const double theZ) = 0;
/// Defines the point
- virtual void setValue(const boost::shared_ptr<GeomAPI_Pnt>& thePoint) = 0;
+ virtual void setValue(const std::shared_ptr<GeomAPI_Pnt>& thePoint) = 0;
/// Returns the X double value
virtual double x() const = 0;
/// Returns the Z double value
virtual double z() const = 0;
/// Returns the 3D point
- virtual boost::shared_ptr<GeomAPI_Pnt> pnt() = 0;
+ virtual std::shared_ptr<GeomAPI_Pnt> pnt() = 0;
/// Returns the type of this class of attributes
static inline std::string type()
/// Defines the double value
virtual void setValue(const double theX, const double theY) = 0;
/// Defines the point
- virtual void setValue(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint) = 0;
+ virtual void setValue(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint) = 0;
/// Returns the X double value
virtual double x() const = 0;
/// Returns the Y double value
virtual double y() const = 0;
/// Returns the 2D point
- virtual boost::shared_ptr<GeomAPI_Pnt2d> pnt() = 0;
+ virtual std::shared_ptr<GeomAPI_Pnt2d> pnt() = 0;
/// Appends the delta values to point
void move(const double theDeltaX, const double theDeltaY)
bool GeomValidators_Positive::isValid(
const AttributePtr& theAttribute, const std::list<std::string>& theArguments) const
{
- boost::shared_ptr<ModelAPI_AttributeDouble> aDouble =
- boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(theAttribute);
+ std::shared_ptr<ModelAPI_AttributeDouble> aDouble =
+ std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(theAttribute);
return aDouble->isInitialized() && aDouble->value() > 1.e-5;
}
}
//=======================================================================
-const boost::shared_ptr<Model_Document>& Model_Application::getDocument(string theDocID)
+const std::shared_ptr<Model_Document>& Model_Application::getDocument(string theDocID)
{
if (myDocs.find(theDocID) != myDocs.end())
return myDocs[theDocID];
static const std::string thePartSetKind("PartSet");
static const std::string thePartKind("Part");
- boost::shared_ptr<Model_Document> aNew(
+ std::shared_ptr<Model_Document> aNew(
new Model_Document(theDocID, theDocID == "root" ? thePartSetKind : thePartKind));
myDocs[theDocID] = aNew;
// load it if it must be loaded by demand
//! 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 boost::shared_ptr<Model_Document>& getDocument(std::string theDocID);
+ MODEL_EXPORT const std::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, boost::shared_ptr<Model_Document> > myDocs;
+ std::map<std::string, std::shared_ptr<Model_Document> > myDocs;
/// Path for the loaded by demand documents
std::string myPath;
/// Path for the loaded by demand documents
using namespace std;
-void Model_AttributeDocRef::setValue(boost::shared_ptr<ModelAPI_Document> theDoc)
+void Model_AttributeDocRef::setValue(std::shared_ptr<ModelAPI_Document> theDoc)
{
myDoc = theDoc;
TCollection_ExtendedString aNewID(theDoc->id().c_str());
}
}
-boost::shared_ptr<ModelAPI_Document> Model_AttributeDocRef::value()
+std::shared_ptr<ModelAPI_Document> Model_AttributeDocRef::value()
{
return myDoc;
}
class Model_AttributeDocRef : public ModelAPI_AttributeDocRef
{
Handle_TDataStd_Comment myComment; ///< reference to document is identified as string-id
- boost::shared_ptr<ModelAPI_Document> myDoc; ///< document referenced by this attribute (if already loaded)
+ std::shared_ptr<ModelAPI_Document> myDoc; ///< document referenced by this attribute (if already loaded)
public:
/// Defines the document referenced from this attribute
- MODEL_EXPORT virtual void setValue(boost::shared_ptr<ModelAPI_Document> theDoc);
+ MODEL_EXPORT virtual void setValue(std::shared_ptr<ModelAPI_Document> theDoc);
/// Returns document referenced from this attribute
- MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Document> value();
+ MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Document> value();
protected:
/// Initializes attibutes
return myID->Get().Length() == 0;
}
-void Model_AttributeRefAttr::setAttr(boost::shared_ptr<ModelAPI_Attribute> theAttr)
+void Model_AttributeRefAttr::setAttr(std::shared_ptr<ModelAPI_Attribute> theAttr)
{
- boost::shared_ptr<Model_Data> aData = boost::dynamic_pointer_cast<Model_Data>(
+ std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(
theAttr->owner()->data());
string anID = aData->id(theAttr);
if (myIsInitialized && object() == theAttr->owner() && myID->Get().IsEqual(anID.c_str()))
owner()->data()->sendAttributeUpdated(this);
}
-boost::shared_ptr<ModelAPI_Attribute> Model_AttributeRefAttr::attr()
+std::shared_ptr<ModelAPI_Attribute> Model_AttributeRefAttr::attr()
{
ObjectPtr anObj = object();
if (anObj) {
- boost::shared_ptr<Model_Data> aData = boost::dynamic_pointer_cast<Model_Data>(anObj->data());
+ std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(anObj->data());
return aData->attribute(TCollection_AsciiString(myID->Get()).ToCString());
}
// not initialized
- return boost::shared_ptr<ModelAPI_Attribute>();
+ return std::shared_ptr<ModelAPI_Attribute>();
}
void Model_AttributeRefAttr::setObject(ObjectPtr theObject)
{
if (theObject && (!myIsInitialized || myID->Get().Length() != 0 || object() != theObject)) {
- boost::shared_ptr<Model_Data> aData = boost::dynamic_pointer_cast<Model_Data>(
+ std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(
theObject->data());
myRef->Set(aData->label().Father());
myID->Set(""); // feature is identified by the empty ID
ObjectPtr Model_AttributeRefAttr::object()
{
if (myRef->Get() != myRef->Label()) { // initialized
- boost::shared_ptr<Model_Document> aDoc = boost::dynamic_pointer_cast<Model_Document>(
+ std::shared_ptr<Model_Document> aDoc = std::dynamic_pointer_cast<Model_Document>(
owner()->document());
if (aDoc) {
TDF_Label aRefLab = myRef->Get();
MODEL_EXPORT virtual bool isObject();
/// Defines the reference to the attribute
- MODEL_EXPORT virtual void setAttr(boost::shared_ptr<ModelAPI_Attribute> theAttr);
+ MODEL_EXPORT virtual void setAttr(std::shared_ptr<ModelAPI_Attribute> theAttr);
/// Returns attribute referenced from this attribute
- MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Attribute> attr();
+ MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Attribute> attr();
/// Defines the reference to the object
MODEL_EXPORT virtual void setObject(ObjectPtr theFeature);
void Model_AttributeRefList::append(ObjectPtr theObject)
{
- boost::shared_ptr<Model_Data> aData = boost::dynamic_pointer_cast<Model_Data>(theObject->data());
+ std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(theObject->data());
myRef->Append(aData->label().Father()); // store label of the object
owner()->data()->sendAttributeUpdated(this);
void Model_AttributeRefList::remove(ObjectPtr theObject)
{
- boost::shared_ptr<Model_Data> aData = boost::dynamic_pointer_cast<Model_Data>(theObject->data());
+ std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(theObject->data());
myRef->Remove(aData->label().Father());
owner()->data()->sendAttributeUpdated(this);
list<ObjectPtr> Model_AttributeRefList::list()
{
std::list<ObjectPtr> aResult;
- boost::shared_ptr<Model_Document> aDoc = boost::dynamic_pointer_cast<Model_Document>(
+ std::shared_ptr<Model_Document> aDoc = std::dynamic_pointer_cast<Model_Document>(
owner()->document());
if (aDoc) {
const TDF_LabelList& aList = myRef->List();
ObjectPtr Model_AttributeRefList::object(const int theIndex) const
{
- boost::shared_ptr<Model_Document> aDoc = boost::dynamic_pointer_cast<Model_Document>(
+ std::shared_ptr<Model_Document> aDoc = std::dynamic_pointer_cast<Model_Document>(
owner()->document());
if (aDoc) {
const TDF_LabelList& aList = myRef->List();
if(!theObject)
return;
if (!myIsInitialized || value() != theObject) {
- boost::shared_ptr<Model_Data> aData = boost::dynamic_pointer_cast<Model_Data>(
+ std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(
theObject->data());
- boost::shared_ptr<Model_Document> aDoc =
- boost::dynamic_pointer_cast<Model_Document>(owner()->document());
+ std::shared_ptr<Model_Document> aDoc =
+ std::dynamic_pointer_cast<Model_Document>(owner()->document());
myRef->Set(aData->label().Father()); // references to the feature label
owner()->data()->sendAttributeUpdated(this);
ObjectPtr Model_AttributeReference::value()
{
if (myIsInitialized) {
- boost::shared_ptr<Model_Document> aDoc = boost::dynamic_pointer_cast<Model_Document>(
+ std::shared_ptr<Model_Document> aDoc = std::dynamic_pointer_cast<Model_Document>(
owner()->document());
if (aDoc) {
TDF_Label aRefLab = myRef->Get();
myRef = TDF_Reference::Set(theLabel, theLabel); // not initialized references to itself
} else {
if (owner()) {
- boost::shared_ptr<Model_Document> aDoc =
- boost::dynamic_pointer_cast<Model_Document>(owner()->document());
+ std::shared_ptr<Model_Document> aDoc =
+ std::dynamic_pointer_cast<Model_Document>(owner()->document());
}
}
}
-void Model_AttributeReference::setObject(const boost::shared_ptr<ModelAPI_Object>& theObject)
+void Model_AttributeReference::setObject(const std::shared_ptr<ModelAPI_Object>& theObject)
{
if (owner() != theObject) {
ModelAPI_AttributeReference::setObject(theObject);
- boost::shared_ptr<Model_Document> aDoc =
- boost::dynamic_pointer_cast<Model_Document>(owner()->document());
+ std::shared_ptr<Model_Document> aDoc =
+ std::dynamic_pointer_cast<Model_Document>(owner()->document());
}
}
Model_AttributeReference::~Model_AttributeReference()
{
- boost::shared_ptr<Model_Document> aDoc =
- boost::dynamic_pointer_cast<Model_Document>(owner()->document());
+ std::shared_ptr<Model_Document> aDoc =
+ std::dynamic_pointer_cast<Model_Document>(owner()->document());
TDF_Label aLab = myRef->Get();
}
MODEL_EXPORT ~Model_AttributeReference();
- MODEL_EXPORT virtual void setObject(const boost::shared_ptr<ModelAPI_Object>& theObject);
+ MODEL_EXPORT virtual void setObject(const std::shared_ptr<ModelAPI_Object>& theObject);
protected:
/// Objects are created for features automatically
// TDF_Reference - from ReferenceAttribute, the context
void Model_AttributeSelection::setValue(const ResultPtr& theContext,
- const boost::shared_ptr<GeomAPI_Shape>& theSubShape)
+ const std::shared_ptr<GeomAPI_Shape>& theSubShape)
{
- const boost::shared_ptr<GeomAPI_Shape>& anOldShape = value();
+ const std::shared_ptr<GeomAPI_Shape>& anOldShape = value();
bool isOldShape =
(theSubShape == anOldShape || (theSubShape && anOldShape && theSubShape->isEqual(anOldShape)));
if (isOldShape) return; // shape is the same, so context is also unchanged
owner()->data()->sendAttributeUpdated(this);
}
-boost::shared_ptr<GeomAPI_Shape> Model_AttributeSelection::value()
+std::shared_ptr<GeomAPI_Shape> Model_AttributeSelection::value()
{
- boost::shared_ptr<GeomAPI_Shape> aResult;
+ std::shared_ptr<GeomAPI_Shape> aResult;
if (myIsInitialized) {
Handle(TNaming_NamedShape) aSelection;
if (selectionLabel().FindAttribute(TNaming_NamedShape::GetID(), aSelection)) {
TopoDS_Shape aSelShape = aSelection->Get();
- aResult = boost::shared_ptr<GeomAPI_Shape>(new GeomAPI_Shape);
+ aResult = std::shared_ptr<GeomAPI_Shape>(new GeomAPI_Shape);
aResult->setImpl(new TopoDS_Shape(aSelShape));
}
}
}
ResultPtr Model_AttributeSelection::context() {
- return boost::dynamic_pointer_cast<ModelAPI_Result>(myRef.value());
+ return std::dynamic_pointer_cast<ModelAPI_Result>(myRef.value());
}
-void Model_AttributeSelection::setObject(const boost::shared_ptr<ModelAPI_Object>& theObject)
+void Model_AttributeSelection::setObject(const std::shared_ptr<ModelAPI_Object>& theObject)
{
ModelAPI_AttributeSelection::setObject(theObject);
myRef.setObject(theObject);
} else if (aContext->groupName() == ModelAPI_ResultConstruction::group()) {
// construction: identification by the results indexes, recompute faces and
// take the face that more close by the indexes
- boost::shared_ptr<GeomAPI_PlanarEdges> aWirePtr =
- boost::dynamic_pointer_cast<GeomAPI_PlanarEdges>(
- boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aContext)->shape());
+ std::shared_ptr<GeomAPI_PlanarEdges> aWirePtr =
+ std::dynamic_pointer_cast<GeomAPI_PlanarEdges>(
+ std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aContext)->shape());
if (aWirePtr && aWirePtr->hasPlane()) {
TDF_Label aLab = myRef.myRef->Label();
// getting a type of selected shape
TopAbs_ShapeEnum aShapeType = (TopAbs_ShapeEnum)(aTypeAttr->Get());
// selected indexes will be needed in each "if"
Handle(TDataStd_IntPackedMap) aSubIds;
- boost::shared_ptr<GeomAPI_Shape> aNewSelected;
+ std::shared_ptr<GeomAPI_Shape> aNewSelected;
bool aNoIndexes =
!aLab.FindAttribute(TDataStd_IntPackedMap::GetID(), aSubIds) || aSubIds->Extent() == 0;
// for now working only with composite features
FeaturePtr aContextFeature = owner()->document()->feature(aContext);
CompositeFeaturePtr aComposite =
- boost::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aContextFeature);
+ std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aContextFeature);
if (!aComposite || aComposite->numberOfSubs() == 0) {
return false;
}
if (aShapeType == TopAbs_FACE) {
// If this is a wire with plane defined thin it is a sketch-like object
- std::list<boost::shared_ptr<GeomAPI_Shape> > aFaces;
+ std::list<std::shared_ptr<GeomAPI_Shape> > aFaces;
GeomAlgoAPI_SketchBuilder::createFaces(aWirePtr->origin(), aWirePtr->dirX(),
aWirePtr->dirY(), aWirePtr->norm(), aWirePtr, aFaces);
if (aFaces.empty()) // no faces, update can not work correctly
return false;
// if there is no edges indexes, any face can be used: take the first
- boost::shared_ptr<GeomAPI_Shape> aNewSelected;
+ std::shared_ptr<GeomAPI_Shape> aNewSelected;
if (aNoIndexes) {
aNewSelected = *(aFaces.begin());
} else { // searching for most looks-like initial face by the indexes
for(int a = 0; a < aSubNum; a++) {
if (aSubIds->Contains(aComposite->subFeatureId(a))) {
FeaturePtr aSub = aComposite->subFeature(a);
- const std::list<boost::shared_ptr<ModelAPI_Result> >& aResults = aSub->results();
- std::list<boost::shared_ptr<ModelAPI_Result> >::const_iterator aRes;
+ const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = aSub->results();
+ std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRes;
for(aRes = aResults.cbegin(); aRes != aResults.cend(); aRes++) {
ResultConstructionPtr aConstr =
- boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aRes);
+ std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aRes);
if (aConstr->shape() && aConstr->shape()->isEdge()) {
const TopoDS_Shape& aResShape = aConstr->shape()->impl<TopoDS_Shape>();
TopoDS_Edge anEdge = TopoDS::Edge(aResShape);
}
}
// iterate new result faces and searching for these edges
- std::list<boost::shared_ptr<GeomAPI_Shape> >::iterator aFacesIter = aFaces.begin();
+ std::list<std::shared_ptr<GeomAPI_Shape> >::iterator aFacesIter = aFaces.begin();
double aBestFound = 0; // best percentage of found edges
for(; aFacesIter != aFaces.end(); aFacesIter++) {
int aFound = 0, aNotFound = 0;
if (aSubIds->IsEmpty() || aSubIds->Contains(aComposite->subFeatureId(a))) {
// found the appropriate feature
FeaturePtr aFeature = aComposite->subFeature(a);
- std::list<boost::shared_ptr<ModelAPI_Result> >::const_iterator aResIter =
+ std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aResIter =
aFeature->results().cbegin();
for(;aResIter != aFeature->results().cend(); aResIter++) {
ResultConstructionPtr aRes =
- boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aResIter);
+ std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aResIter);
if (aRes && aRes->shape() && aRes->shape()->isEdge()) { // found!
selectConstruction(aContext, aRes->shape());
owner()->data()->sendAttributeUpdated(this);
else if (aSubIds->Contains(aFeatureID + kSTART_VERTEX_DELTA)) aVertexNum = 2;
// found the feature with appropriate edge
FeaturePtr aFeature = aComposite->subFeature(a);
- std::list<boost::shared_ptr<ModelAPI_Result> >::const_iterator aResIter =
+ std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aResIter =
aFeature->results().cbegin();
for(;aResIter != aFeature->results().cend(); aResIter++) {
ResultConstructionPtr aRes =
- boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aResIter);
+ std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aResIter);
if (aRes && aRes->shape()) {
if (aRes->shape()->isVertex() && aVertexNum == 0) { // found!
selectConstruction(aContext, aRes->shape());
int aVIndex = 1;
for(TopExp_Explorer aVExp(anEdge, TopAbs_VERTEX); aVExp.More(); aVExp.Next()) {
if (aVIndex == aVertexNum) { // found!
- boost::shared_ptr<GeomAPI_Shape> aVertex(new GeomAPI_Shape);
+ std::shared_ptr<GeomAPI_Shape> aVertex(new GeomAPI_Shape);
aVertex->setImpl(new TopoDS_Shape(aVExp.Current()));
selectConstruction(aContext, aVertex);
owner()->data()->sendAttributeUpdated(this);
void Model_AttributeSelection::selectBody(
- const ResultPtr& theContext, const boost::shared_ptr<GeomAPI_Shape>& theSubShape)
+ const ResultPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape)
{
// perform the selection
TNaming_Selector aSel(selectionLabel());
TopoDS_Shape aNewShape = theSubShape ? theSubShape->impl<TopoDS_Shape>() : TopoDS_Shape();
TopoDS_Shape aContext;
- ResultBodyPtr aBody = boost::dynamic_pointer_cast<ModelAPI_ResultBody>(myRef.value());
+ ResultBodyPtr aBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(myRef.value());
if (aBody)
aContext = aBody->shape()->impl<TopoDS_Shape>();
else {
- ResultConstructionPtr aConstr = boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(myRef.value());
+ ResultConstructionPtr aConstr = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(myRef.value());
if (aConstr) {
aContext = aConstr->shape()->impl<TopoDS_Shape>();
} else {
}
void Model_AttributeSelection::selectConstruction(
- const ResultPtr& theContext, const boost::shared_ptr<GeomAPI_Shape>& theSubShape)
+ const ResultPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape)
{
FeaturePtr aContextFeature = owner()->document()->feature(theContext);
CompositeFeaturePtr aComposite =
- boost::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aContextFeature);
+ std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(aContextFeature);
if (!aComposite || aComposite->numberOfSubs() == 0) {
return; // saving of context is enough: result construction contains exactly the needed shape
}
- boost::shared_ptr<Model_Data> aData = boost::dynamic_pointer_cast<Model_Data>(owner()->data());
+ std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(owner()->data());
TDF_Label aLab = myRef.myRef->Label();
// identify the reuslts of sub-object of the composite by edges
const TopoDS_Shape& aSubShape = theSubShape->impl<TopoDS_Shape>();
const int aSubNum = aComposite->numberOfSubs();
for(int a = 0; a < aSubNum; a++) {
FeaturePtr aSub = aComposite->subFeature(a);
- const std::list<boost::shared_ptr<ModelAPI_Result> >& aResults = aSub->results();
- std::list<boost::shared_ptr<ModelAPI_Result> >::const_iterator aRes = aResults.cbegin();
+ const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = aSub->results();
+ std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRes = aResults.cbegin();
// there may be many shapes (circle and center): register if at least one is in selection
for(; aRes != aResults.cend(); aRes++) {
ResultConstructionPtr aConstr =
- boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aRes);
+ std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aRes);
if (!aConstr->shape()) {
continue;
}
public:
/// Defines the result and its selected sub-shape
MODEL_EXPORT virtual void setValue(
- const ResultPtr& theContext, const boost::shared_ptr<GeomAPI_Shape>& theSubShape);
+ const ResultPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape);
/// Returns the selected subshape
- MODEL_EXPORT virtual boost::shared_ptr<GeomAPI_Shape> value();
+ MODEL_EXPORT virtual std::shared_ptr<GeomAPI_Shape> value();
/// Returns the context of the selection (the whole shape owner)
MODEL_EXPORT virtual ResultPtr context();
/// Sets the feature object
- MODEL_EXPORT virtual void setObject(const boost::shared_ptr<ModelAPI_Object>& theObject);
+ MODEL_EXPORT virtual void setObject(const std::shared_ptr<ModelAPI_Object>& theObject);
/// Updates the underlied selection due to the changes in the referenced objects
/// \returns false if update is failed
/// Performs the selection for the body result (TNaming selection)
virtual void selectBody(
- const ResultPtr& theContext, const boost::shared_ptr<GeomAPI_Shape>& theSubShape);
+ const ResultPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape);
/// Performs the selection for the construction result (selection by index)
virtual void selectConstruction(
- const ResultPtr& theContext, const boost::shared_ptr<GeomAPI_Shape>& theSubShape);
+ const ResultPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape);
/// Returns the label where TNaming_Selection results are stored
/// Note: there must be no attributes stored at the same label because Selector clears this lab
using namespace std;
void Model_AttributeSelectionList::append(
- const ResultPtr& theContext, const boost::shared_ptr<GeomAPI_Shape>& theSubShape)
+ const ResultPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape)
{
int aNewTag = mySize->Get() + 1;
TDF_Label aNewLab = mySize->Label().FindChild(aNewTag);
- boost::shared_ptr<Model_AttributeSelection> aNewAttr =
- boost::shared_ptr<Model_AttributeSelection>(new Model_AttributeSelection(aNewLab));
+ std::shared_ptr<Model_AttributeSelection> aNewAttr =
+ std::shared_ptr<Model_AttributeSelection>(new Model_AttributeSelection(aNewLab));
if (owner()) {
aNewAttr->setObject(owner());
}
mySelectionType->Set((double) theType);
}
-boost::shared_ptr<ModelAPI_AttributeSelection>
+std::shared_ptr<ModelAPI_AttributeSelection>
Model_AttributeSelectionList::value(const int theIndex)
{
TDF_Label aLabel = mySize->Label().FindChild(theIndex + 1);
// create a new attribute each time, by demand
// supporting of old attributes is too slow (synch each time) and buggy on redo
// (if attribute is deleted and created, the abort updates attriute and makes the Attr invalid)
- boost::shared_ptr<Model_AttributeSelection> aNewAttr =
- boost::shared_ptr<Model_AttributeSelection>(new Model_AttributeSelection(aLabel));
+ std::shared_ptr<Model_AttributeSelection> aNewAttr =
+ std::shared_ptr<Model_AttributeSelection>(new Model_AttributeSelection(aLabel));
if (owner()) {
aNewAttr->setObject(owner());
}
public:
/// Adds the new reference to the end of the list
MODEL_EXPORT virtual void append(
- const ResultPtr& theContext, const boost::shared_ptr<GeomAPI_Shape>& theSubShape);
+ const ResultPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape);
/// Returns the number ofselection attributes in the list
MODEL_EXPORT virtual int size();
MODEL_EXPORT virtual void setSelectionType(int);
/// Returns the attribute selection by the index (zero based)
- MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_AttributeSelection> value(const int theIndex);
+ MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeSelection> value(const int theIndex);
/// Returns all attributes
MODEL_EXPORT virtual void clear();
anAttr = new GeomData_Point2D(anAttrLab);
}
if (anAttr) {
- myAttrs[theID] = boost::shared_ptr<ModelAPI_Attribute>(anAttr);
+ myAttrs[theID] = std::shared_ptr<ModelAPI_Attribute>(anAttr);
anAttr->setObject(myObject);
} else {
Events_Error::send("Can not create unknown type of attribute " + theAttrType);
}
}
-boost::shared_ptr<ModelAPI_AttributeDocRef> Model_Data::document(const std::string& theID)
+std::shared_ptr<ModelAPI_AttributeDocRef> Model_Data::document(const std::string& theID)
{
- std::map<std::string, boost::shared_ptr<ModelAPI_Attribute> >::iterator aFound =
+ std::map<std::string, std::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 boost::shared_ptr<ModelAPI_AttributeDocRef>();
+ return std::shared_ptr<ModelAPI_AttributeDocRef>();
}
- boost::shared_ptr<ModelAPI_AttributeDocRef> aRes = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_AttributeDocRef> aRes = std::dynamic_pointer_cast<
ModelAPI_AttributeDocRef>(aFound->second);
if (!aRes) {
// TODO: generate error on invalid attribute type request
return aRes;
}
-boost::shared_ptr<ModelAPI_AttributeDouble> Model_Data::real(const std::string& theID)
+std::shared_ptr<ModelAPI_AttributeDouble> Model_Data::real(const std::string& theID)
{
- std::map<std::string, boost::shared_ptr<ModelAPI_Attribute> >::iterator aFound =
+ std::map<std::string, std::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 boost::shared_ptr<ModelAPI_AttributeDouble>();
+ return std::shared_ptr<ModelAPI_AttributeDouble>();
}
- boost::shared_ptr<ModelAPI_AttributeDouble> aRes = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_AttributeDouble> aRes = std::dynamic_pointer_cast<
ModelAPI_AttributeDouble>(aFound->second);
if (!aRes) {
// TODO: generate error on invalid attribute type request
return aRes;
}
-boost::shared_ptr<ModelAPI_AttributeInteger> Model_Data::integer(const std::string& theID)
+std::shared_ptr<ModelAPI_AttributeInteger> Model_Data::integer(const std::string& theID)
{
- std::map<std::string, boost::shared_ptr<ModelAPI_Attribute> >::iterator aFound =
+ std::map<std::string, std::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 boost::shared_ptr<ModelAPI_AttributeInteger>();
+ return std::shared_ptr<ModelAPI_AttributeInteger>();
}
- boost::shared_ptr<ModelAPI_AttributeInteger> aRes = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_AttributeInteger> aRes = std::dynamic_pointer_cast<
ModelAPI_AttributeInteger>(aFound->second);
if (!aRes) {
// TODO: generate error on invalid attribute type request
return aRes;
}
-boost::shared_ptr<ModelAPI_AttributeBoolean> Model_Data::boolean(const std::string& theID)
+std::shared_ptr<ModelAPI_AttributeBoolean> Model_Data::boolean(const std::string& theID)
{
- std::map<std::string, boost::shared_ptr<ModelAPI_Attribute> >::iterator aFound =
+ std::map<std::string, std::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 boost::shared_ptr<ModelAPI_AttributeBoolean>();
+ return std::shared_ptr<ModelAPI_AttributeBoolean>();
}
- boost::shared_ptr<ModelAPI_AttributeBoolean> aRes = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_AttributeBoolean> aRes = std::dynamic_pointer_cast<
ModelAPI_AttributeBoolean>(aFound->second);
if (!aRes) {
// TODO: generate error on invalid attribute type request
return aRes;
}
-boost::shared_ptr<ModelAPI_AttributeString> Model_Data::string(const std::string& theID)
+std::shared_ptr<ModelAPI_AttributeString> Model_Data::string(const std::string& theID)
{
- std::map<std::string, boost::shared_ptr<ModelAPI_Attribute> >::iterator aFound =
+ std::map<std::string, std::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 boost::shared_ptr<ModelAPI_AttributeString>();
+ return std::shared_ptr<ModelAPI_AttributeString>();
}
- boost::shared_ptr<ModelAPI_AttributeString> aRes =
- boost::dynamic_pointer_cast<ModelAPI_AttributeString>(aFound->second);
+ std::shared_ptr<ModelAPI_AttributeString> aRes =
+ std::dynamic_pointer_cast<ModelAPI_AttributeString>(aFound->second);
if (!aRes) {
// TODO: generate error on invalid attribute type request
}
}
-boost::shared_ptr<ModelAPI_AttributeReference> Model_Data::reference(const std::string& theID)
+std::shared_ptr<ModelAPI_AttributeReference> Model_Data::reference(const std::string& theID)
{
- std::map<std::string, boost::shared_ptr<ModelAPI_Attribute> >::iterator aFound =
+ std::map<std::string, std::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 boost::shared_ptr<ModelAPI_AttributeReference>();
+ return std::shared_ptr<ModelAPI_AttributeReference>();
}
- boost::shared_ptr<ModelAPI_AttributeReference> aRes = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_AttributeReference> aRes = std::dynamic_pointer_cast<
ModelAPI_AttributeReference>(aFound->second);
if (!aRes) {
// TODO: generate error on invalid attribute type request
return aRes;
}
-boost::shared_ptr<ModelAPI_AttributeSelection> Model_Data::selection(const std::string& theID)
+std::shared_ptr<ModelAPI_AttributeSelection> Model_Data::selection(const std::string& theID)
{
- std::map<std::string, boost::shared_ptr<ModelAPI_Attribute> >::iterator aFound =
+ std::map<std::string, std::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 boost::shared_ptr<ModelAPI_AttributeSelection>();
+ return std::shared_ptr<ModelAPI_AttributeSelection>();
}
- boost::shared_ptr<ModelAPI_AttributeSelection> aRes =
- boost::dynamic_pointer_cast<ModelAPI_AttributeSelection>(aFound->second);
+ std::shared_ptr<ModelAPI_AttributeSelection> aRes =
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(aFound->second);
if (!aRes) {
// TODO: generate error on invalid attribute type request
}
return aRes;
}
-boost::shared_ptr<ModelAPI_AttributeSelectionList>
+std::shared_ptr<ModelAPI_AttributeSelectionList>
Model_Data::selectionList(const std::string& theID)
{
- std::map<std::string, boost::shared_ptr<ModelAPI_Attribute> >::iterator aFound =
+ std::map<std::string, std::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 boost::shared_ptr<ModelAPI_AttributeSelectionList>();
+ return std::shared_ptr<ModelAPI_AttributeSelectionList>();
}
- boost::shared_ptr<ModelAPI_AttributeSelectionList> aRes =
- boost::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(aFound->second);
+ std::shared_ptr<ModelAPI_AttributeSelectionList> aRes =
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(aFound->second);
if (!aRes) {
// TODO: generate error on invalid attribute type request
}
return aRes;
}
-boost::shared_ptr<ModelAPI_AttributeRefAttr> Model_Data::refattr(const std::string& theID)
+std::shared_ptr<ModelAPI_AttributeRefAttr> Model_Data::refattr(const std::string& theID)
{
- std::map<std::string, boost::shared_ptr<ModelAPI_Attribute> >::iterator aFound =
+ std::map<std::string, std::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 boost::shared_ptr<ModelAPI_AttributeRefAttr>();
+ return std::shared_ptr<ModelAPI_AttributeRefAttr>();
}
- boost::shared_ptr<ModelAPI_AttributeRefAttr> aRes = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_AttributeRefAttr> aRes = std::dynamic_pointer_cast<
ModelAPI_AttributeRefAttr>(aFound->second);
if (!aRes) {
// TODO: generate error on invalid attribute type request
return aRes;
}
-boost::shared_ptr<ModelAPI_AttributeRefList> Model_Data::reflist(const std::string& theID)
+std::shared_ptr<ModelAPI_AttributeRefList> Model_Data::reflist(const std::string& theID)
{
- std::map<std::string, boost::shared_ptr<ModelAPI_Attribute> >::iterator aFound =
+ std::map<std::string, std::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 boost::shared_ptr<ModelAPI_AttributeRefList>();
+ return std::shared_ptr<ModelAPI_AttributeRefList>();
}
- boost::shared_ptr<ModelAPI_AttributeRefList> aRes = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_AttributeRefList> aRes = std::dynamic_pointer_cast<
ModelAPI_AttributeRefList>(aFound->second);
if (!aRes) {
// TODO: generate error on invalid attribute type request
return aRes;
}
-boost::shared_ptr<ModelAPI_Attribute> Model_Data::attribute(const std::string& theID)
+std::shared_ptr<ModelAPI_Attribute> Model_Data::attribute(const std::string& theID)
{
- boost::shared_ptr<ModelAPI_Attribute> aResult;
+ std::shared_ptr<ModelAPI_Attribute> aResult;
if (myAttrs.find(theID) == myAttrs.end()) // no such attribute
return aResult;
return myAttrs[theID];
}
-const std::string& Model_Data::id(const boost::shared_ptr<ModelAPI_Attribute>& theAttr)
+const std::string& Model_Data::id(const std::shared_ptr<ModelAPI_Attribute>& theAttr)
{
- std::map<std::string, boost::shared_ptr<ModelAPI_Attribute> >::iterator anAttr =
+ std::map<std::string, std::shared_ptr<ModelAPI_Attribute> >::iterator anAttr =
myAttrs.begin();
for (; anAttr != myAttrs.end(); anAttr++) {
if (anAttr->second == theAttr)
return anEmpty;
}
-bool Model_Data::isEqual(const boost::shared_ptr<ModelAPI_Data>& theData)
+bool Model_Data::isEqual(const std::shared_ptr<ModelAPI_Data>& theData)
{
- boost::shared_ptr<Model_Data> aData = boost::dynamic_pointer_cast<Model_Data>(theData);
+ std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(theData);
if (aData)
return myLab.IsEqual(aData->myLab) == Standard_True ;
return false;
return !myLab.IsNull() && myLab.HasAttribute();
}
-std::list<boost::shared_ptr<ModelAPI_Attribute> > Model_Data::attributes(const std::string& theType)
+std::list<std::shared_ptr<ModelAPI_Attribute> > Model_Data::attributes(const std::string& theType)
{
- std::list<boost::shared_ptr<ModelAPI_Attribute> > aResult;
- std::map<std::string, boost::shared_ptr<ModelAPI_Attribute> >::iterator anAttrsIter =
+ std::list<std::shared_ptr<ModelAPI_Attribute> > aResult;
+ std::map<std::string, std::shared_ptr<ModelAPI_Attribute> >::iterator anAttrsIter =
myAttrs.begin();
for (; anAttrsIter != myAttrs.end(); anAttrsIter++) {
if (theType.empty() || anAttrsIter->second->attributeType() == theType) {
std::list<std::string> Model_Data::attributesIDs(const std::string& theType)
{
std::list<std::string> aResult;
- std::map<std::string, boost::shared_ptr<ModelAPI_Attribute> >::iterator anAttrsIter =
+ std::map<std::string, std::shared_ptr<ModelAPI_Attribute> >::iterator anAttrsIter =
myAttrs.begin();
for (; anAttrsIter != myAttrs.end(); anAttrsIter++) {
if (theType.empty() || anAttrsIter->second->attributeType() == theType) {
void Model_Data::eraseBackReferences()
{
myRefsToMe.clear();
- boost::shared_ptr<ModelAPI_Result> aRes =
- boost::dynamic_pointer_cast<ModelAPI_Result>(myObject);
+ std::shared_ptr<ModelAPI_Result> aRes =
+ std::dynamic_pointer_cast<ModelAPI_Result>(myObject);
if (aRes)
aRes->setIsConcealed(false);
}
{
myRefsToMe.insert(theFeature->data()->attribute(theAttrID));
if (ModelAPI_Session::get()->validators()->isConcealed(theFeature->getKind(), theAttrID)) {
- boost::shared_ptr<ModelAPI_Result> aRes =
- boost::dynamic_pointer_cast<ModelAPI_Result>(myObject);
+ std::shared_ptr<ModelAPI_Result> aRes =
+ std::dynamic_pointer_cast<ModelAPI_Result>(myObject);
if (aRes) {
aRes->setIsConcealed(true);
}
void Model_Data::referencesToObjects(
std::list<std::pair<std::string, std::list<ObjectPtr> > >& theRefs)
{
- std::map<std::string, boost::shared_ptr<ModelAPI_Attribute> >::iterator anAttr = myAttrs.begin();
+ std::map<std::string, std::shared_ptr<ModelAPI_Attribute> >::iterator anAttr = myAttrs.begin();
std::list<ObjectPtr> aReferenced; // not inside of cycle to avoid excess memory menagement
for(; anAttr != myAttrs.end(); anAttr++) {
std::string aType = anAttr->second->attributeType();
if (aType == ModelAPI_AttributeReference::type()) { // reference to object
- boost::shared_ptr<ModelAPI_AttributeReference> aRef = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_AttributeReference> aRef = std::dynamic_pointer_cast<
ModelAPI_AttributeReference>(anAttr->second);
aReferenced.push_back(aRef->value());
theRefs.push_back(std::pair<std::string, std::list<ObjectPtr> >(anAttr->first, aReferenced));
} else if (aType == ModelAPI_AttributeRefAttr::type()) { // reference to attribute or object
- boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_AttributeRefAttr> aRef = std::dynamic_pointer_cast<
ModelAPI_AttributeRefAttr>(anAttr->second);
aReferenced.push_back(aRef->isObject() ? aRef->object() : aRef->attr()->owner());
} else if (aType == ModelAPI_AttributeRefList::type()) { // list of references
- aReferenced = boost::dynamic_pointer_cast<ModelAPI_AttributeRefList>(anAttr->second)->list();
+ aReferenced = std::dynamic_pointer_cast<ModelAPI_AttributeRefList>(anAttr->second)->list();
} else if (aType == ModelAPI_AttributeSelection::type()) { // selection attribute
- boost::shared_ptr<ModelAPI_AttributeSelection> aRef = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_AttributeSelection> aRef = std::dynamic_pointer_cast<
ModelAPI_AttributeSelection>(anAttr->second);
aReferenced.push_back(aRef->context());
} else if (aType == ModelAPI_AttributeSelectionList::type()) { // list of selection attributes
- boost::shared_ptr<ModelAPI_AttributeSelectionList> aRef = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_AttributeSelectionList> aRef = std::dynamic_pointer_cast<
ModelAPI_AttributeSelectionList>(anAttr->second);
for(int a = aRef->size() - 1; a >= 0; a--) {
aReferenced.push_back(aRef->value(a)->context());
#include <TDF_Label.hxx>
-#include <boost/smart_ptr/shared_ptr.hpp>
+#include <memory>
#include <map>
#include <list>
{
TDF_Label myLab; ///< label of the feature in the document
/// All attributes of the object identified by the attribute ID
- std::map<std::string, boost::shared_ptr<ModelAPI_Attribute> > myAttrs;
+ std::map<std::string, std::shared_ptr<ModelAPI_Attribute> > myAttrs;
/// needed here to emit signal that object changed on change of the attribute
ObjectPtr myObject;
/// Defines the name of the feature visible by the user in the object browser
MODEL_EXPORT virtual void setName(const std::string& theName);
/// Returns the attribute that references to another document
- MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_AttributeDocRef> document(const std::string& theID);
+ MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeDocRef> document(const std::string& theID);
/// Returns the attribute that contains real value with double precision
- MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_AttributeDouble> real(const std::string& theID);
+ MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeDouble> real(const std::string& theID);
/// Returns the attribute that contains integer value
- MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_AttributeInteger>
+ MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeInteger>
integer(const std::string& theID);
/// Returns the attribute that contains reference to a feature
- MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_AttributeReference>
+ MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeReference>
reference(const std::string& theID);
/// Returns the attribute that contains selection to a shape
- MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_AttributeSelection>
+ MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeSelection>
selection(const std::string& theID);
/// Returns the attribute that contains selection to a shape
- MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_AttributeSelectionList>
+ MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeSelectionList>
selectionList(const std::string& theID);
/// Returns the attribute that contains reference to an attribute of a feature
- MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_AttributeRefAttr>
+ MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeRefAttr>
refattr(const std::string& theID);
/// Returns the attribute that contains list of references to features
- MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_AttributeRefList>
+ MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeRefList>
reflist(const std::string& theID);
/// Returns the attribute that contains boolean value
- MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_AttributeBoolean>
+ MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeBoolean>
boolean(const std::string& theID);
/// Returns the attribute that contains real value with double precision
- MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_AttributeString>
+ MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeString>
string(const std::string& theID);
/// Returns the generic attribute by identifier
/// \param theID identifier of the attribute
- MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Attribute> attribute(const std::string& theID);
+ MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Attribute> attribute(const std::string& theID);
/// Returns all attributes of the feature of the given type
/// or all attributes if "theType" is empty
- MODEL_EXPORT virtual std::list<boost::shared_ptr<ModelAPI_Attribute> >
+ MODEL_EXPORT virtual std::list<std::shared_ptr<ModelAPI_Attribute> >
attributes(const std::string& theType);
/// Returns all attributes ids of the feature of the given type
/// or all attributes if "theType" is empty
/// Identifier by the id (not fast, iteration by map)
/// \param theAttr attribute already created in this data
- MODEL_EXPORT virtual const std::string& id(const boost::shared_ptr<ModelAPI_Attribute>& theAttr);
+ 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 boost::shared_ptr<ModelAPI_Data>& theData);
+ MODEL_EXPORT virtual bool isEqual(const std::shared_ptr<ModelAPI_Data>& theData);
/// Returns true if it is correctly connected t othe data model
MODEL_EXPORT virtual bool isValid();
void Model_Document::close(const bool theForever)
{
- boost::shared_ptr<ModelAPI_Session> aPM = Model_Session::get();
+ std::shared_ptr<ModelAPI_Session> aPM = Model_Session::get();
if (this != aPM->moduleDocument().get() && this == aPM->activeDocument().get()) {
aPM->setActiveDocument(aPM->moduleDocument());
}
mySubs.clear();
// close for thid document needs no transaction in this document
- boost::static_pointer_cast<Model_Session>(Model_Session::get())->setCheckTransactions(false);
+ std::static_pointer_cast<Model_Session>(Model_Session::get())->setCheckTransactions(false);
// delete all features of this document
- boost::shared_ptr<ModelAPI_Document> aThis =
+ std::shared_ptr<ModelAPI_Document> aThis =
Model_Application::getApplication()->getDocument(myID);
Events_Loop* aLoop = Events_Loop::loop();
NCollection_DataMap<TDF_Label, FeaturePtr>::Iterator aFeaturesIter(myObjs);
myDoc->Close();
}
- boost::static_pointer_cast<Model_Session>(Model_Session::get())->setCheckTransactions(true);
+ std::static_pointer_cast<Model_Session>(Model_Session::get())->setCheckTransactions(true);
}
void Model_Document::startOperation()
{
// just to be sure that everybody knows that changes were performed
if (!myDoc->HasOpenCommand() && myNestedNum != -1)
- boost::static_pointer_cast<Model_Session>(Model_Session::get())
+ std::static_pointer_cast<Model_Session>(Model_Session::get())
->setCheckTransactions(false); // for nested transaction commit
synchronizeBackRefs();
Events_Loop* aLoop = Events_Loop::loop();
// and to rebuild everything after all updates and creates
if (Model_Session::get()->moduleDocument().get() == this) { // once for root document
Events_Loop::loop()->autoFlush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
- static boost::shared_ptr<Events_Message> aFinishMsg
+ static std::shared_ptr<Events_Message> aFinishMsg
(new Events_Message(Events_Loop::eventByName("FinishOperation")));
Events_Loop::loop()->send(aFinishMsg);
Events_Loop::loop()->autoFlush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED), false);
//aLoop->clear(Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
if (!myDoc->HasOpenCommand() && myNestedNum != -1)
- boost::static_pointer_cast<Model_Session>(Model_Session::get())
+ std::static_pointer_cast<Model_Session>(Model_Session::get())
->setCheckTransactions(true); // for nested transaction commit
// finish for all subs first: to avoid nested finishing and "isOperation" calls problems inside
FeaturePtr aFeature = ModelAPI_Session::get()->createFeature(theID);
if (!aFeature)
return aFeature;
- boost::shared_ptr<Model_Document> aDocToAdd = boost::dynamic_pointer_cast<Model_Document>(
+ std::shared_ptr<Model_Document> aDocToAdd = std::dynamic_pointer_cast<Model_Document>(
aFeature->documentToAdd());
if (aFeature) {
TDF_Label aFeatureLab;
// check the feature: it must have no depended objects on it
std::list<ResultPtr>::const_iterator aResIter = theFeature->results().cbegin();
for(; aResIter != theFeature->results().cend(); aResIter++) {
- boost::shared_ptr<Model_Data> aData =
- boost::dynamic_pointer_cast<Model_Data>((*aResIter)->data());
+ std::shared_ptr<Model_Data> aData =
+ std::dynamic_pointer_cast<Model_Data>((*aResIter)->data());
if (aData && !aData->refsToMe().empty()) {
Events_Error::send(
"Feature '" + theFeature->data()->name() + "' is used and can not be deleted");
}
}
- boost::shared_ptr<Model_Data> aData = boost::static_pointer_cast<Model_Data>(theFeature->data());
+ std::shared_ptr<Model_Data> aData = std::static_pointer_cast<Model_Data>(theFeature->data());
if (aData) {
TDF_Label aFeatureLabel = aData->label().Father();
if (myObjs.IsBound(aFeatureLabel))
TDF_Label aFeatureLabel = theLabel.Father().Father(); // let's suppose it is result
aFeature = feature(aFeatureLabel);
if (aFeature) {
- const std::list<boost::shared_ptr<ModelAPI_Result> >& aResults = aFeature->results();
- std::list<boost::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.cbegin();
+ const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = aFeature->results();
+ std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.cbegin();
for (; aRIter != aResults.cend(); aRIter++) {
- boost::shared_ptr<Model_Data> aResData = boost::dynamic_pointer_cast<Model_Data>(
+ std::shared_ptr<Model_Data> aResData = std::dynamic_pointer_cast<Model_Data>(
(*aRIter)->data());
if (aResData->label().Father().IsEqual(theLabel))
return *aRIter;
return FeaturePtr(); // not found
}
-boost::shared_ptr<ModelAPI_Document> Model_Document::subDocument(std::string theDocID)
+std::shared_ptr<ModelAPI_Document> Model_Document::subDocument(std::string theDocID)
{
// just store sub-document identifier here to manage it later
if (mySubs.find(theDocID) == mySubs.end())
return Model_Application::getApplication()->getDocument(theDocID);
}
-boost::shared_ptr<Model_Document> Model_Document::subDoc(std::string theDocID)
+std::shared_ptr<Model_Document> Model_Document::subDoc(std::string theDocID)
{
// just store sub-document identifier here to manage it later
if (mySubs.find(theDocID) == mySubs.end())
mySubs.insert(theDocID);
- return boost::dynamic_pointer_cast<Model_Document>(
+ return std::dynamic_pointer_cast<Model_Document>(
Model_Application::getApplication()->getDocument(theDocID));
}
for (; aLabIter.More(); aLabIter.Next()) {
TDF_Label aFLabel = aLabIter.Value()->Label();
FeaturePtr aFeature = feature(aFLabel);
- const std::list<boost::shared_ptr<ModelAPI_Result> >& aResults = aFeature->results();
- std::list<boost::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
+ const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = aFeature->results();
+ std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
for (; aRIter != aResults.cend(); aRIter++) {
if ((*aRIter)->groupName() != theGroupID) continue;
bool isIn = theHidden && (*aRIter)->isInHistory();
FeaturePtr aFeature = feature(aFLabel);
if (!aFeature) // may be on close
continue;
- const std::list<boost::shared_ptr<ModelAPI_Result> >& aResults = aFeature->results();
- std::list<boost::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
+ const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = aFeature->results();
+ std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
for (; aRIter != aResults.cend(); aRIter++) {
if ((*aRIter)->groupName() != theGroupID) continue;
bool isIn = theHidden;
FeaturePtr aFeature = aFIter.Value();
bool isSameName = aFeature->data()->name() == aName;
if (!isSameName) { // check also results to avoid same results names (actual for Parts)
- const std::list<boost::shared_ptr<ModelAPI_Result> >& aResults = aFeature->results();
- std::list<boost::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
+ const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = aFeature->results();
+ std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
for (; aRIter != aResults.cend(); aRIter++) {
isSameName = (*aRIter)->data()->name() == aName;
}
void Model_Document::initData(ObjectPtr theObj, TDF_Label theLab, const int theTag)
{
- boost::shared_ptr<ModelAPI_Document> aThis = Model_Application::getApplication()->getDocument(
+ std::shared_ptr<ModelAPI_Document> aThis = Model_Application::getApplication()->getDocument(
myID);
- boost::shared_ptr<Model_Data> aData(new Model_Data);
+ std::shared_ptr<Model_Data> aData(new Model_Data);
aData->setLabel(theLab.FindChild(theTag));
aData->setObject(theObj);
theObj->setDoc(aThis);
theObj->setData(aData);
- FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(theObj);
+ FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theObj);
if (aFeature) {
setUniqueName(aFeature); // must be before "initAttributes" because duplicate part uses name
aFeature->initAttributes();
void Model_Document::synchronizeFeatures(const bool theMarkUpdated, const bool theUpdateReferences)
{
- boost::shared_ptr<ModelAPI_Document> aThis =
+ std::shared_ptr<ModelAPI_Document> aThis =
Model_Application::getApplication()->getDocument(myID);
// after all updates, sends a message that groups of features were created or updated
- boost::static_pointer_cast<Model_Session>(Model_Session::get())
+ std::static_pointer_cast<Model_Session>(Model_Session::get())
->setCheckTransactions(false);
Events_Loop* aLoop = Events_Loop::loop();
aLoop->activateFlushes(false);
//}
// results of this feature must be redisplayed (hided)
static Events_ID EVENT_DISP = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
- const std::list<boost::shared_ptr<ModelAPI_Result> >& aResults = aFeature->results();
- std::list<boost::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
+ const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = aFeature->results();
+ std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
// redisplay also removed feature (used for sketch and AISObject)
ModelAPI_EventCreator::get()->sendUpdated(aFeature, EVENT_DISP);
aFeature->erase();
aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_TOHIDE));
- boost::static_pointer_cast<Model_Session>(Model_Session::get())
+ std::static_pointer_cast<Model_Session>(Model_Session::get())
->setCheckTransactions(true);
myExecuteFeatures = true;
}
void Model_Document::synchronizeBackRefs()
{
- boost::shared_ptr<ModelAPI_Document> aThis =
+ std::shared_ptr<ModelAPI_Document> aThis =
Model_Application::getApplication()->getDocument(myID);
// keeps the concealed flags of result to catch the change and create created/deleted events
std::list<std::pair<ResultPtr, bool> > aConcealed;
NCollection_DataMap<TDF_Label, FeaturePtr>::Iterator aFeatures(myObjs);
for(; aFeatures.More(); aFeatures.Next()) {
FeaturePtr aFeature = aFeatures.Value();
- boost::shared_ptr<Model_Data> aFData =
- boost::dynamic_pointer_cast<Model_Data>(aFeature->data());
+ std::shared_ptr<Model_Data> aFData =
+ std::dynamic_pointer_cast<Model_Data>(aFeature->data());
if (aFData) {
aFData->eraseBackReferences();
}
- const std::list<boost::shared_ptr<ModelAPI_Result> >& aResults = aFeature->results();
- std::list<boost::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
+ const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = aFeature->results();
+ std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
for (; aRIter != aResults.cend(); aRIter++) {
- boost::shared_ptr<Model_Data> aResData =
- boost::dynamic_pointer_cast<Model_Data>((*aRIter)->data());
+ std::shared_ptr<Model_Data> aResData =
+ std::dynamic_pointer_cast<Model_Data>((*aRIter)->data());
if (aResData) {
aConcealed.push_back(std::pair<ResultPtr, bool>(*aRIter, (*aRIter)->isConcealed()));
aResData->eraseBackReferences();
ModelAPI_ValidatorsFactory* aValidators = ModelAPI_Session::get()->validators();
for(aFeatures.Initialize(myObjs); aFeatures.More(); aFeatures.Next()) {
FeaturePtr aFeature = aFeatures.Value();
- boost::shared_ptr<Model_Data> aFData =
- boost::dynamic_pointer_cast<Model_Data>(aFeature->data());
+ std::shared_ptr<Model_Data> aFData =
+ std::dynamic_pointer_cast<Model_Data>(aFeature->data());
if (aFData) {
std::list<std::pair<std::string, std::list<ObjectPtr> > > aRefs;
aFData->referencesToObjects(aRefs);
std::list<ObjectPtr>::iterator aRefTo = aRefsIter->second.begin();
for(; aRefTo != aRefsIter->second.end(); aRefTo++) {
if (*aRefTo) {
- boost::shared_ptr<Model_Data> aRefData =
- boost::dynamic_pointer_cast<Model_Data>((*aRefTo)->data());
+ std::shared_ptr<Model_Data> aRefData =
+ std::dynamic_pointer_cast<Model_Data>((*aRefTo)->data());
aRefData->addBackReference(aFeature, aRefsIter->first); // here the Concealed flag is updated
}
}
}
TDF_Label Model_Document::resultLabel(
- const boost::shared_ptr<ModelAPI_Data>& theFeatureData, const int theResultIndex)
+ const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theResultIndex)
{
- const boost::shared_ptr<Model_Data>& aData =
- boost::dynamic_pointer_cast<Model_Data>(theFeatureData);
+ const std::shared_ptr<Model_Data>& aData =
+ std::dynamic_pointer_cast<Model_Data>(theFeatureData);
return aData->label().Father().FindChild(TAG_FEATURE_RESULTS).FindChild(theResultIndex + 1);
}
-void Model_Document::storeResult(boost::shared_ptr<ModelAPI_Data> theFeatureData,
- boost::shared_ptr<ModelAPI_Result> theResult,
+void Model_Document::storeResult(std::shared_ptr<ModelAPI_Data> theFeatureData,
+ std::shared_ptr<ModelAPI_Result> theResult,
const int theResultIndex)
{
- boost::shared_ptr<ModelAPI_Document> aThis =
+ std::shared_ptr<ModelAPI_Document> aThis =
Model_Application::getApplication()->getDocument(myID);
theResult->setDoc(aThis);
initData(theResult, resultLabel(theFeatureData, theResultIndex), TAG_FEATURE_ARGUMENTS);
}
}
-boost::shared_ptr<ModelAPI_ResultConstruction> Model_Document::createConstruction(
- const boost::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex)
+std::shared_ptr<ModelAPI_ResultConstruction> Model_Document::createConstruction(
+ const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex)
{
TDF_Label aLab = resultLabel(theFeatureData, theIndex);
TDataStd_Comment::Set(aLab, ModelAPI_ResultConstruction::group().c_str());
ObjectPtr anOldObject = object(aLab);
- boost::shared_ptr<ModelAPI_ResultConstruction> aResult;
+ std::shared_ptr<ModelAPI_ResultConstruction> aResult;
if (anOldObject) {
- aResult = boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(anOldObject);
+ aResult = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(anOldObject);
}
if (!aResult) {
- aResult = boost::shared_ptr<ModelAPI_ResultConstruction>(new Model_ResultConstruction);
+ aResult = std::shared_ptr<ModelAPI_ResultConstruction>(new Model_ResultConstruction);
storeResult(theFeatureData, aResult, theIndex);
}
return aResult;
}
-boost::shared_ptr<ModelAPI_ResultBody> Model_Document::createBody(
- const boost::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex)
+std::shared_ptr<ModelAPI_ResultBody> Model_Document::createBody(
+ const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex)
{
TDF_Label aLab = resultLabel(theFeatureData, theIndex);
TDataStd_Comment::Set(aLab, ModelAPI_ResultBody::group().c_str());
ObjectPtr anOldObject = object(aLab);
- boost::shared_ptr<ModelAPI_ResultBody> aResult;
+ std::shared_ptr<ModelAPI_ResultBody> aResult;
if (anOldObject) {
- aResult = boost::dynamic_pointer_cast<ModelAPI_ResultBody>(anOldObject);
+ aResult = std::dynamic_pointer_cast<ModelAPI_ResultBody>(anOldObject);
}
if (!aResult) {
- aResult = boost::shared_ptr<ModelAPI_ResultBody>(new Model_ResultBody);
+ aResult = std::shared_ptr<ModelAPI_ResultBody>(new Model_ResultBody);
storeResult(theFeatureData, aResult, theIndex);
}
return aResult;
}
-boost::shared_ptr<ModelAPI_ResultPart> Model_Document::createPart(
- const boost::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex)
+std::shared_ptr<ModelAPI_ResultPart> Model_Document::createPart(
+ const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex)
{
TDF_Label aLab = resultLabel(theFeatureData, theIndex);
TDataStd_Comment::Set(aLab, ModelAPI_ResultPart::group().c_str());
ObjectPtr anOldObject = object(aLab);
- boost::shared_ptr<ModelAPI_ResultPart> aResult;
+ std::shared_ptr<ModelAPI_ResultPart> aResult;
if (anOldObject) {
- aResult = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(anOldObject);
+ aResult = std::dynamic_pointer_cast<ModelAPI_ResultPart>(anOldObject);
}
if (!aResult) {
- aResult = boost::shared_ptr<ModelAPI_ResultPart>(new Model_ResultPart);
+ aResult = std::shared_ptr<ModelAPI_ResultPart>(new Model_ResultPart);
storeResult(theFeatureData, aResult, theIndex);
}
return aResult;
}
-boost::shared_ptr<ModelAPI_ResultGroup> Model_Document::createGroup(
- const boost::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex)
+std::shared_ptr<ModelAPI_ResultGroup> Model_Document::createGroup(
+ const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex)
{
TDF_Label aLab = resultLabel(theFeatureData, theIndex);
TDataStd_Comment::Set(aLab, ModelAPI_ResultGroup::group().c_str());
ObjectPtr anOldObject = object(aLab);
- boost::shared_ptr<ModelAPI_ResultGroup> aResult;
+ std::shared_ptr<ModelAPI_ResultGroup> aResult;
if (anOldObject) {
- aResult = boost::dynamic_pointer_cast<ModelAPI_ResultGroup>(anOldObject);
+ aResult = std::dynamic_pointer_cast<ModelAPI_ResultGroup>(anOldObject);
}
if (!aResult) {
- aResult = boost::shared_ptr<ModelAPI_ResultGroup>(new Model_ResultGroup(theFeatureData));
+ aResult = std::shared_ptr<ModelAPI_ResultGroup>(new Model_ResultGroup(theFeatureData));
storeResult(theFeatureData, aResult, theIndex);
}
return aResult;
}
-boost::shared_ptr<ModelAPI_Feature> Model_Document::feature(
- const boost::shared_ptr<ModelAPI_Result>& theResult)
+std::shared_ptr<ModelAPI_Feature> Model_Document::feature(
+ const std::shared_ptr<ModelAPI_Result>& theResult)
{
- boost::shared_ptr<Model_Data> aData = boost::dynamic_pointer_cast<Model_Data>(theResult->data());
+ std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(theResult->data());
if (aData) {
TDF_Label aFeatureLab = aData->label().Father().Father().Father();
return feature(aFeatureLab);
// check the existing results and remove them if there is nothing on the label
std::list<ResultPtr>::const_iterator aResIter = theFeature->results().cbegin();
while(aResIter != theFeature->results().cend()) {
- ResultPtr aBody = boost::dynamic_pointer_cast<ModelAPI_Result>(*aResIter);
+ ResultPtr aBody = std::dynamic_pointer_cast<ModelAPI_Result>(*aResIter);
if (aBody) {
if (!aBody->data()->isValid()) {
// found a disappeared result => remove it
MODEL_EXPORT virtual ObjectPtr object(TDF_Label theLabel);
//! Adds a new sub-document by the identifier, or returns existing one if it is already exist
- MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Document> subDocument(std::string theDocID);
+ MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Document> subDocument(std::string theDocID);
//! Internal sub-document by ID
- MODEL_EXPORT virtual boost::shared_ptr<Model_Document> subDoc(std::string theDocID);
+ MODEL_EXPORT virtual std::shared_ptr<Model_Document> subDoc(std::string theDocID);
///! Returns the id of hte document
MODEL_EXPORT virtual const std::string& id() const
MODEL_EXPORT virtual int size(const std::string& theGroupID, const bool theHidden = false);
/// Creates a construction cresults
- MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_ResultConstruction> createConstruction(
- const boost::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
+ MODEL_EXPORT virtual std::shared_ptr<ModelAPI_ResultConstruction> createConstruction(
+ const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
/// Creates a body results
- MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_ResultBody> createBody(
- const boost::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
+ MODEL_EXPORT virtual std::shared_ptr<ModelAPI_ResultBody> createBody(
+ const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
/// Creates a part results
- MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_ResultPart> createPart(
- const boost::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
+ MODEL_EXPORT virtual std::shared_ptr<ModelAPI_ResultPart> createPart(
+ const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
/// Creates a group results
- MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_ResultGroup> createGroup(
- const boost::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
+ MODEL_EXPORT virtual std::shared_ptr<ModelAPI_ResultGroup> createGroup(
+ const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0);
//! Returns a feature by result (owner of result)
- MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Feature>
- feature(const boost::shared_ptr<ModelAPI_Result>& theResult);
+ MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Feature>
+ feature(const std::shared_ptr<ModelAPI_Result>& theResult);
///! Returns true if parametric updater need to execute feature on recomputartion
///! On abort, undo or redo it is not necessary: results in document are updated automatically
void initData(ObjectPtr theObj, TDF_Label theLab, const int theTag);
//! Allows to store the result in the data tree of the document (attaches 'data' of result to tree)
- MODEL_EXPORT virtual void storeResult(boost::shared_ptr<ModelAPI_Data> theFeatureData,
- boost::shared_ptr<ModelAPI_Result> theResult,
+ MODEL_EXPORT virtual void storeResult(std::shared_ptr<ModelAPI_Data> theFeatureData,
+ std::shared_ptr<ModelAPI_Result> theResult,
const int theResultIndex = 0);
//! returns the label of result by index; creates this label if it was not created before
- TDF_Label resultLabel(const boost::shared_ptr<ModelAPI_Data>& theFeatureData, const int theResultIndex);
+ TDF_Label resultLabel(const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theResultIndex);
//! Updates the results list of the feature basing on the current data tree
void updateResults(FeaturePtr theFeature);
void Model_EventCreator::sendUpdated(const ObjectPtr& theObject, const Events_ID& theEvent,
const bool isGroupped) const
{
- boost::shared_ptr<Model_ObjectUpdatedMessage> aMsg(
+ std::shared_ptr<Model_ObjectUpdatedMessage> aMsg(
new Model_ObjectUpdatedMessage(theObject, theEvent));
Events_Loop::loop()->send(aMsg, isGroupped);
}
-void Model_EventCreator::sendDeleted(const boost::shared_ptr<ModelAPI_Document>& theDoc,
+void Model_EventCreator::sendDeleted(const std::shared_ptr<ModelAPI_Document>& theDoc,
const std::string& theGroup) const
{
- boost::shared_ptr<Model_ObjectDeletedMessage> aMsg(
+ std::shared_ptr<Model_ObjectDeletedMessage> aMsg(
new Model_ObjectDeletedMessage(theDoc, theGroup));
Events_Loop::loop()->send(aMsg, true);
}
return myObjects;
}
-boost::shared_ptr<Events_MessageGroup> Model_ObjectUpdatedMessage::newEmpty()
+std::shared_ptr<Events_MessageGroup> Model_ObjectUpdatedMessage::newEmpty()
{
ObjectPtr anEmptyObject;
- return boost::shared_ptr<Model_ObjectUpdatedMessage>(
+ return std::shared_ptr<Model_ObjectUpdatedMessage>(
new Model_ObjectUpdatedMessage(anEmptyObject, eventID()));
}
-void Model_ObjectUpdatedMessage::Join(const boost::shared_ptr<Events_MessageGroup>& theJoined)
+void Model_ObjectUpdatedMessage::Join(const std::shared_ptr<Events_MessageGroup>& theJoined)
{
- boost::shared_ptr<Model_ObjectUpdatedMessage> aJoined =
- boost::dynamic_pointer_cast<Model_ObjectUpdatedMessage>(theJoined);
+ std::shared_ptr<Model_ObjectUpdatedMessage> aJoined =
+ std::dynamic_pointer_cast<Model_ObjectUpdatedMessage>(theJoined);
std::set<ObjectPtr>::iterator aFIter = aJoined->myObjects.begin();
for (; aFIter != aJoined->myObjects.end(); aFIter++) {
myObjects.insert(*aFIter);
/////////////////////// DELETED MESSAGE /////////////////////////////
Model_ObjectDeletedMessage::Model_ObjectDeletedMessage(
- const boost::shared_ptr<ModelAPI_Document>& theDoc, const std::string& theGroup)
+ const std::shared_ptr<ModelAPI_Document>& theDoc, const std::string& theGroup)
: ModelAPI_ObjectDeletedMessage(messageId(), 0),
myDoc(theDoc)
{
myGroups.insert(theGroup);
}
-boost::shared_ptr<Events_MessageGroup> Model_ObjectDeletedMessage::newEmpty()
+std::shared_ptr<Events_MessageGroup> Model_ObjectDeletedMessage::newEmpty()
{
- return boost::shared_ptr<Model_ObjectDeletedMessage>(new Model_ObjectDeletedMessage(myDoc, ""));
+ return std::shared_ptr<Model_ObjectDeletedMessage>(new Model_ObjectDeletedMessage(myDoc, ""));
}
const Events_ID Model_ObjectDeletedMessage::messageId()
return MY_ID;
}
-void Model_ObjectDeletedMessage::Join(const boost::shared_ptr<Events_MessageGroup>& theJoined)
+void Model_ObjectDeletedMessage::Join(const std::shared_ptr<Events_MessageGroup>& theJoined)
{
- boost::shared_ptr<Model_ObjectDeletedMessage> aJoined =
- boost::dynamic_pointer_cast<Model_ObjectDeletedMessage>(theJoined);
+ std::shared_ptr<Model_ObjectDeletedMessage> aJoined =
+ std::dynamic_pointer_cast<Model_ObjectDeletedMessage>(theJoined);
std::set<std::string>::iterator aGIter = aJoined->myGroups.begin();
for (; aGIter != aJoined->myGroups.end(); aGIter++) {
myGroups.insert(*aGIter);
virtual void sendUpdated(const ObjectPtr& theObject, const Events_ID& theEvent,
const bool isGroupped = true) const;
/// creates deleted message and sends to the loop
- virtual void sendDeleted(const boost::shared_ptr<ModelAPI_Document>& theDoc,
+ virtual void sendDeleted(const std::shared_ptr<ModelAPI_Document>& theDoc,
const std::string& theGroup) const;
/// must be one per application, the constructor for internal usage only
virtual const std::set<ObjectPtr>& objects() const;
//! Creates a new empty group (to store it in the loop before flush)
- virtual boost::shared_ptr<Events_MessageGroup> newEmpty();
+ virtual std::shared_ptr<Events_MessageGroup> newEmpty();
//! Allows to join the given message with the current one
- virtual void Join(const boost::shared_ptr<Events_MessageGroup>& theJoined);
+ virtual void Join(const std::shared_ptr<Events_MessageGroup>& theJoined);
};
/// Message that feature was deleted (used for Object Browser update)
class Model_ObjectDeletedMessage : public ModelAPI_ObjectDeletedMessage
{
- boost::shared_ptr<ModelAPI_Document> myDoc; ///< document owner of the feature
+ std::shared_ptr<ModelAPI_Document> myDoc; ///< document owner of the feature
std::set<std::string> myGroups; ///< group identifiers that contained the deleted feature
/// Use ModelAPI for creation of this event.
- Model_ObjectDeletedMessage(const boost::shared_ptr<ModelAPI_Document>& theDoc,
+ Model_ObjectDeletedMessage(const std::shared_ptr<ModelAPI_Document>& theDoc,
const std::string& theGroup);
friend class Model_EventCreator;
public:
/// Returns the feature that has been updated
- virtual boost::shared_ptr<ModelAPI_Document> document() const
+ virtual std::shared_ptr<ModelAPI_Document> document() const
{
return myDoc;
}
return myGroups;
}
- virtual boost::shared_ptr<Events_MessageGroup> newEmpty();
+ virtual std::shared_ptr<Events_MessageGroup> newEmpty();
virtual const Events_ID messageId();
- virtual void Join(const boost::shared_ptr<Events_MessageGroup>& theJoined);
+ virtual void Join(const std::shared_ptr<Events_MessageGroup>& theJoined);
};
#endif
#include <ModelAPI_Object.h>
#include <list>
-#include <boost/shared_ptr.hpp>
+#include <memory>
-bool Model_FeatureValidator::isValid(const boost::shared_ptr<ModelAPI_Feature>& theFeature,
+bool Model_FeatureValidator::isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
const std::list<std::string>& theArguments) const
{
- boost::shared_ptr<ModelAPI_Data> aData = theFeature->data();
+ std::shared_ptr<ModelAPI_Data> aData = theFeature->data();
if (!aData)
return false;
if (!aData->isValid())
#include <ModelAPI_Feature.h>
#include <ModelAPI_FeatureValidator.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <set>
#include <map>
public:
/// Returns true if feature and/or attributes are valid
/// \param theFeature the validated feature
- MODEL_EXPORT virtual bool isValid(const boost::shared_ptr<ModelAPI_Feature>& theFeature,
+ MODEL_EXPORT virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
const std::list<std::string>& theArguments) const;
// sets not obligatory attributes, not checked for initialization
setIsConcealed(false);
}
-void Model_ResultBody::store(const boost::shared_ptr<GeomAPI_Shape>& theShape)
+void Model_ResultBody::store(const std::shared_ptr<GeomAPI_Shape>& theShape)
{
- boost::shared_ptr<Model_Data> aData = boost::dynamic_pointer_cast<Model_Data>(data());
+ std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
if (aData) {
TDF_Label& aShapeLab = aData->shapeLab();
// clean builders
}
}
-void Model_ResultBody::storeGenerated(const boost::shared_ptr<GeomAPI_Shape>& theFromShape,
- const boost::shared_ptr<GeomAPI_Shape>& theToShape)
+void Model_ResultBody::storeGenerated(const std::shared_ptr<GeomAPI_Shape>& theFromShape,
+ const std::shared_ptr<GeomAPI_Shape>& theToShape)
{
- boost::shared_ptr<Model_Data> aData = boost::dynamic_pointer_cast<Model_Data>(data());
+ std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
if (aData) {
TDF_Label& aShapeLab = aData->shapeLab();
// clean builders
}
}
-void Model_ResultBody::storeModified(const boost::shared_ptr<GeomAPI_Shape>& theOldShape,
- const boost::shared_ptr<GeomAPI_Shape>& theNewShape)
+void Model_ResultBody::storeModified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
+ const std::shared_ptr<GeomAPI_Shape>& theNewShape)
{
- boost::shared_ptr<Model_Data> aData = boost::dynamic_pointer_cast<Model_Data>(data());
+ std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
if (aData) {
TDF_Label& aShapeLab = aData->shapeLab();
// clean builders
}
}
-boost::shared_ptr<GeomAPI_Shape> Model_ResultBody::shape()
+std::shared_ptr<GeomAPI_Shape> Model_ResultBody::shape()
{
- boost::shared_ptr<Model_Data> aData = boost::dynamic_pointer_cast<Model_Data>(data());
+ std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
if (aData) {
TDF_Label& aShapeLab = aData->shapeLab();
Handle(TNaming_NamedShape) aName;
if (aShapeLab.FindAttribute(TNaming_NamedShape::GetID(), aName)) {
TopoDS_Shape aShape = aName->Get();
if (!aShape.IsNull()) {
- boost::shared_ptr<GeomAPI_Shape> aRes(new GeomAPI_Shape);
+ std::shared_ptr<GeomAPI_Shape> aRes(new GeomAPI_Shape);
aRes->setImpl(new TopoDS_Shape(aShape));
return aRes;
}
}
}
- return boost::shared_ptr<GeomAPI_Shape>();
+ return std::shared_ptr<GeomAPI_Shape>();
}
void Model_ResultBody::clean()
myBuilders.insert(myBuilders.end(), theTag - myBuilders.size() + 1, NULL);
}
if (!myBuilders[theTag]) {
- boost::shared_ptr<Model_Data> aData = boost::dynamic_pointer_cast<Model_Data>(data());
+ std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(data());
myBuilders[theTag] = new TNaming_Builder(aData->shapeLab().FindChild(theTag));
//TCollection_AsciiString entry;//
//TDF_Tool::Entry(aData->shapeLab().FindChild(theTag), entry);
}
void Model_ResultBody::generated(
- const boost::shared_ptr<GeomAPI_Shape>& theNewShape, const int theTag)
+ const std::shared_ptr<GeomAPI_Shape>& theNewShape, const int theTag)
{
TopoDS_Shape aShape = theNewShape->impl<TopoDS_Shape>();
builder(theTag)->Generated(aShape);
}
-void Model_ResultBody::generated(const boost::shared_ptr<GeomAPI_Shape>& theOldShape,
- const boost::shared_ptr<GeomAPI_Shape>& theNewShape, const int theTag)
+void Model_ResultBody::generated(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
+ const std::shared_ptr<GeomAPI_Shape>& theNewShape, const int theTag)
{
TopoDS_Shape anOldShape = theOldShape->impl<TopoDS_Shape>();
TopoDS_Shape aNewShape = theNewShape->impl<TopoDS_Shape>();
}
-void Model_ResultBody::modified(const boost::shared_ptr<GeomAPI_Shape>& theOldShape,
- const boost::shared_ptr<GeomAPI_Shape>& theNewShape, const int theTag)
+void Model_ResultBody::modified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
+ const std::shared_ptr<GeomAPI_Shape>& theNewShape, const int theTag)
{
TopoDS_Shape anOldShape = theOldShape->impl<TopoDS_Shape>();
TopoDS_Shape aNewShape = theNewShape->impl<TopoDS_Shape>();
builder(theTag)->Modify(anOldShape, aNewShape);
}
-void Model_ResultBody::deleted(const boost::shared_ptr<GeomAPI_Shape>& theOldShape,
+void Model_ResultBody::deleted(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
const int theTag)
{
TopoDS_Shape aShape = theOldShape->impl<TopoDS_Shape>();
}
void Model_ResultBody::loadDeletedShapes (GeomAlgoAPI_MakeShape* theMS,
- boost::shared_ptr<GeomAPI_Shape> theShapeIn,
+ std::shared_ptr<GeomAPI_Shape> theShapeIn,
const int theKindOfShape,
const int theTag)
{
for (; ShapeExplorer.More(); ShapeExplorer.Next ()) {
const TopoDS_Shape& aRoot = ShapeExplorer.Current ();
if (!aView.Add(aRoot)) continue;
- boost::shared_ptr<GeomAPI_Shape> aRShape(new GeomAPI_Shape());
+ std::shared_ptr<GeomAPI_Shape> aRShape(new GeomAPI_Shape());
aRShape->setImpl((new TopoDS_Shape(aRoot)));
if (theMS->isDeleted (aRShape)) {
builder(theTag)->Delete(aRoot);
void Model_ResultBody::loadAndOrientModifiedShapes (
GeomAlgoAPI_MakeShape* theMS,
- boost::shared_ptr<GeomAPI_Shape> theShapeIn,
+ std::shared_ptr<GeomAPI_Shape> theShapeIn,
const int theKindOfShape,
const int theTag,
GeomAPI_DataMapOfShapeShape& theSubShapes)
const TopoDS_Shape& aRoot = aShapeExplorer.Current ();
if (!aView.Add(aRoot)) continue;
ListOfShape aList;
- boost::shared_ptr<GeomAPI_Shape> aRShape(new GeomAPI_Shape());
+ std::shared_ptr<GeomAPI_Shape> aRShape(new GeomAPI_Shape());
aRShape->setImpl((new TopoDS_Shape(aRoot)));
theMS->modified(aRShape, aList);
- std::list<boost::shared_ptr<GeomAPI_Shape> >::const_iterator anIt = aList.begin(), aLast = aList.end();
+ std::list<std::shared_ptr<GeomAPI_Shape> >::const_iterator anIt = aList.begin(), aLast = aList.end();
for (; anIt != aLast; anIt++) {
TopoDS_Shape aNewShape = (*anIt)->impl<TopoDS_Shape>();
if (theSubShapes.isBound(*anIt)) {
- boost::shared_ptr<GeomAPI_Shape> aMapShape(theSubShapes.find(*anIt));
+ std::shared_ptr<GeomAPI_Shape> aMapShape(theSubShapes.find(*anIt));
aNewShape.Orientation(aMapShape->impl<TopoDS_Shape>().Orientation());
}
if (!aRoot.IsSame (aNewShape))
void Model_ResultBody::loadAndOrientGeneratedShapes (
GeomAlgoAPI_MakeShape* theMS,
- boost::shared_ptr<GeomAPI_Shape> theShapeIn,
+ std::shared_ptr<GeomAPI_Shape> theShapeIn,
const int theKindOfShape,
const int theTag,
GeomAPI_DataMapOfShapeShape& theSubShapes)
const TopoDS_Shape& aRoot = aShapeExplorer.Current ();
if (!aView.Add(aRoot)) continue;
ListOfShape aList;
- boost::shared_ptr<GeomAPI_Shape> aRShape(new GeomAPI_Shape());
+ std::shared_ptr<GeomAPI_Shape> aRShape(new GeomAPI_Shape());
aRShape->setImpl((new TopoDS_Shape(aRoot)));
theMS->generated(aRShape, aList);
- std::list<boost::shared_ptr<GeomAPI_Shape> >::const_iterator anIt = aList.begin(), aLast = aList.end();
+ std::list<std::shared_ptr<GeomAPI_Shape> >::const_iterator anIt = aList.begin(), aLast = aList.end();
for (; anIt != aLast; anIt++) {
TopoDS_Shape aNewShape = (*anIt)->impl<TopoDS_Shape>();
if (theSubShapes.isBound(*anIt)) {
- boost::shared_ptr<GeomAPI_Shape> aMapShape(theSubShapes.find(*anIt));
+ std::shared_ptr<GeomAPI_Shape> aMapShape(theSubShapes.find(*anIt));
aNewShape.Orientation(aMapShape->impl<TopoDS_Shape>().Orientation());
}
if (!aRoot.IsSame (aNewShape))
}
//=======================================================================
-void Model_ResultBody::loadNextLevels(boost::shared_ptr<GeomAPI_Shape> theShape,
+void Model_ResultBody::loadNextLevels(std::shared_ptr<GeomAPI_Shape> theShape,
int& theTag)
{
if(theShape->isNull()) return;
}
//=======================================================================
void Model_ResultBody::loadFirstLevel(
- boost::shared_ptr<GeomAPI_Shape> theShape, int& theTag)
+ std::shared_ptr<GeomAPI_Shape> theShape, int& theTag)
{
if(theShape->isNull()) return;
TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
if (itr.Value().ShapeType() == TopAbs_COMPOUND ||
itr.Value().ShapeType() == TopAbs_COMPSOLID)
{
- boost::shared_ptr<GeomAPI_Shape> itrShape(new GeomAPI_Shape());
+ std::shared_ptr<GeomAPI_Shape> itrShape(new GeomAPI_Shape());
itrShape->setImpl(new TopoDS_Shape(itr.Value()));
loadFirstLevel(itrShape, theTag);
} else {
- boost::shared_ptr<GeomAPI_Shape> itrShape(new GeomAPI_Shape());
+ std::shared_ptr<GeomAPI_Shape> itrShape(new GeomAPI_Shape());
itrShape->setImpl(new TopoDS_Shape(itr.Value()));
loadNextLevels(itrShape, theTag);
}
}
} else {
- boost::shared_ptr<GeomAPI_Shape> itrShape(new GeomAPI_Shape());
+ std::shared_ptr<GeomAPI_Shape> itrShape(new GeomAPI_Shape());
itrShape->setImpl(new TopoDS_Shape(aShape));
loadNextLevels(itrShape, theTag);
}
//=======================================================================
void Model_ResultBody::loadDisconnectedEdges(
- boost::shared_ptr<GeomAPI_Shape> theShape, int& theTag)
+ std::shared_ptr<GeomAPI_Shape> theShape, int& theTag)
{
if(theShape->isNull()) return;
TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
}
}
-void Model_ResultBody::loadDisconnectedVertexes(boost::shared_ptr<GeomAPI_Shape> theShape, int& theTag)
+void Model_ResultBody::loadDisconnectedVertexes(std::shared_ptr<GeomAPI_Shape> theShape, int& theTag)
{
if(theShape->isNull()) return;
TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
std::vector<TNaming_Builder*> myBuilders;
public:
/// Stores the shape (called by the execution method).
- MODEL_EXPORT virtual void store(const boost::shared_ptr<GeomAPI_Shape>& theShape);
+ MODEL_EXPORT virtual void store(const std::shared_ptr<GeomAPI_Shape>& theShape);
/// Stores the generated shape (called by the execution method).
- MODEL_EXPORT virtual void storeGenerated(const boost::shared_ptr<GeomAPI_Shape>& theFromShape,
- const boost::shared_ptr<GeomAPI_Shape>& theToShape);
+ MODEL_EXPORT virtual void storeGenerated(const std::shared_ptr<GeomAPI_Shape>& theFromShape,
+ const std::shared_ptr<GeomAPI_Shape>& theToShape);
/// Stores the modified shape (called by the execution method).
- MODEL_EXPORT virtual void storeModified(const boost::shared_ptr<GeomAPI_Shape>& theOldShape,
- const boost::shared_ptr<GeomAPI_Shape>& theNewShape);
+ MODEL_EXPORT virtual void storeModified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
+ const std::shared_ptr<GeomAPI_Shape>& theNewShape);
/// Returns the shape-result produced by this feature
- MODEL_EXPORT virtual boost::shared_ptr<GeomAPI_Shape> shape();
+ MODEL_EXPORT virtual std::shared_ptr<GeomAPI_Shape> shape();
/// Records the subshape newShape which was generated during a topological construction.
/// As an example, consider the case of a face generated in construction of a box.
- MODEL_EXPORT virtual void generated(const boost::shared_ptr<GeomAPI_Shape>& theNewShape,
+ MODEL_EXPORT virtual void generated(const std::shared_ptr<GeomAPI_Shape>& theNewShape,
const int theTag = 1);
/// 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
/// construction of a prism.
- MODEL_EXPORT virtual void generated(const boost::shared_ptr<GeomAPI_Shape>& theOldShape,
- const boost::shared_ptr<GeomAPI_Shape>& theNewShape, const int theTag = 1);
+ MODEL_EXPORT virtual void generated(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
+ const std::shared_ptr<GeomAPI_Shape>& theNewShape, const int theTag = 1);
/// Records the shape newShape which is a modification of the shape oldShape.
/// As an example, consider the case of a face split or merged in a Boolean operation.
- MODEL_EXPORT virtual void modified(const boost::shared_ptr<GeomAPI_Shape>& theOldShape,
- const boost::shared_ptr<GeomAPI_Shape>& theNewShape, const int theTag = 1);
+ MODEL_EXPORT virtual void modified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
+ const std::shared_ptr<GeomAPI_Shape>& theNewShape, const int theTag = 1);
/// Records the shape oldShape which was deleted from the current label.
/// As an example, consider the case of a face removed by a Boolean operation.
- MODEL_EXPORT virtual void deleted(const boost::shared_ptr<GeomAPI_Shape>& theOldShape,
+ MODEL_EXPORT virtual void deleted(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
const int theTag = 1);
/// load deleted shapes
MODEL_EXPORT virtual void loadDeletedShapes (GeomAlgoAPI_MakeShape* theMS,
- boost::shared_ptr<GeomAPI_Shape> theShapeIn,
+ std::shared_ptr<GeomAPI_Shape> theShapeIn,
const int theKindOfShape,
const int theTag);
/// load and orient modified shapes
MODEL_EXPORT virtual void loadAndOrientModifiedShapes (
GeomAlgoAPI_MakeShape* theMS,
- boost::shared_ptr<GeomAPI_Shape> theShapeIn,
+ std::shared_ptr<GeomAPI_Shape> theShapeIn,
const int theKindOfShape,
const int theTag,
GeomAPI_DataMapOfShapeShape& theSubShapes);
/// load and orient generated shapes
MODEL_EXPORT virtual void loadAndOrientGeneratedShapes (
GeomAlgoAPI_MakeShape* theMS,
- boost::shared_ptr<GeomAPI_Shape> theShapeIn,
+ std::shared_ptr<GeomAPI_Shape> theShapeIn,
const int theKindOfShape,
const int theTag,
GeomAPI_DataMapOfShapeShape& theSubShapes);
/// Loads shapes of the first level (to be used during shape import)
- MODEL_EXPORT virtual void loadFirstLevel(boost::shared_ptr<GeomAPI_Shape> theShape, int& theTag);
+ MODEL_EXPORT virtual void loadFirstLevel(std::shared_ptr<GeomAPI_Shape> theShape, int& theTag);
/// Loads disconnected edges
- MODEL_EXPORT virtual void loadDisconnectedEdges(boost::shared_ptr<GeomAPI_Shape> theShape, int& theTag);
+ MODEL_EXPORT virtual void loadDisconnectedEdges(std::shared_ptr<GeomAPI_Shape> theShape, int& theTag);
/// Loads disconnected vetexes
- MODEL_EXPORT virtual void loadDisconnectedVertexes(boost::shared_ptr<GeomAPI_Shape> theShape, int& theTag);
+ MODEL_EXPORT virtual void loadDisconnectedVertexes(std::shared_ptr<GeomAPI_Shape> theShape, int& theTag);
/// Removes the stored builders
MODEL_EXPORT virtual ~Model_ResultBody();
private:
/// Loads shapes of the next level (to be used during shape import)
- void loadNextLevels(boost::shared_ptr<GeomAPI_Shape> theShape, int& theTag);
+ void loadNextLevels(std::shared_ptr<GeomAPI_Shape> theShape, int& theTag);
friend class Model_Document;
};
#include <Model_ResultConstruction.h>
-void Model_ResultConstruction::setShape(boost::shared_ptr<GeomAPI_Shape> theShape)
+void Model_ResultConstruction::setShape(std::shared_ptr<GeomAPI_Shape> theShape)
{
myShape = theShape;
}
-boost::shared_ptr<GeomAPI_Shape>& Model_ResultConstruction::shape()
+std::shared_ptr<GeomAPI_Shape>& Model_ResultConstruction::shape()
{
return myShape;
}
*/
class Model_ResultConstruction : public ModelAPI_ResultConstruction
{
- boost::shared_ptr<ModelAPI_Feature> myOwner; ///< owner of this result
- boost::shared_ptr<GeomAPI_Shape> myShape; ///< shape of this result created "on the fly"
+ std::shared_ptr<ModelAPI_Feature> myOwner; ///< owner of this result
+ std::shared_ptr<GeomAPI_Shape> myShape; ///< shape of this result created "on the fly"
bool myIsInHistory;
public:
/// By default object is displayed in the object browser.
}
/// Sets the result
- MODEL_EXPORT virtual void setShape(boost::shared_ptr<GeomAPI_Shape> theShape);
+ MODEL_EXPORT virtual void setShape(std::shared_ptr<GeomAPI_Shape> theShape);
/// Returns the shape-result produced by this feature
- MODEL_EXPORT virtual boost::shared_ptr<GeomAPI_Shape>& shape();
+ MODEL_EXPORT virtual std::shared_ptr<GeomAPI_Shape>& shape();
/// Sets the flag that it must be displayed in history (default is true)
MODEL_EXPORT virtual void setIsInHistory(const bool myIsInHistory);
#include <ModelAPI_AttributeSelectionList.h>
#include <GeomAlgoAPI_CompoundBuilder.h>
-Model_ResultGroup::Model_ResultGroup(boost::shared_ptr<ModelAPI_Data> theOwnerData)
+Model_ResultGroup::Model_ResultGroup(std::shared_ptr<ModelAPI_Data> theOwnerData)
{
setIsConcealed(false);
myOwnerData = theOwnerData;
}
-boost::shared_ptr<GeomAPI_Shape> Model_ResultGroup::shape() const
+std::shared_ptr<GeomAPI_Shape> Model_ResultGroup::shape() const
{
- boost::shared_ptr<GeomAPI_Shape> aResult;
+ std::shared_ptr<GeomAPI_Shape> aResult;
if (myOwnerData) {
AttributeSelectionListPtr aList = myOwnerData->selectionList("group_list");
if (aList) {
- std::list<boost::shared_ptr<GeomAPI_Shape> > aSubs;
+ std::list<std::shared_ptr<GeomAPI_Shape> > aSubs;
for(int a = aList->size() - 1; a >= 0; a--) {
- boost::shared_ptr<GeomAPI_Shape> aSelection = aList->value(a)->value();
+ std::shared_ptr<GeomAPI_Shape> aSelection = aList->value(a)->value();
if (aSelection && !aSelection->isNull()) {
aSubs.push_back(aSelection);
}
*/
class Model_ResultGroup : public ModelAPI_ResultGroup
{
- boost::shared_ptr<ModelAPI_Data> myOwnerData; ///< data of owner of this result
+ std::shared_ptr<ModelAPI_Data> myOwnerData; ///< data of owner of this result
public:
/// Returns the compound of selected entities
- MODEL_EXPORT virtual boost::shared_ptr<GeomAPI_Shape> shape() const;
+ MODEL_EXPORT virtual std::shared_ptr<GeomAPI_Shape> shape() const;
/// Removes the stored builders
MODEL_EXPORT virtual ~Model_ResultGroup() {}
protected:
/// Makes a body on the given feature data
- Model_ResultGroup(boost::shared_ptr<ModelAPI_Data> theOwnerData);
+ Model_ResultGroup(std::shared_ptr<ModelAPI_Data> theOwnerData);
friend class Model_Document;
};
#include <ModelAPI_AttributeDocRef.h>
#include <ModelAPI_Session.h>
-boost::shared_ptr<ModelAPI_Document> Model_ResultPart::partDoc()
+std::shared_ptr<ModelAPI_Document> Model_ResultPart::partDoc()
{
return data()->document("PartDocument")->value();
}
-boost::shared_ptr<ModelAPI_Feature> Model_ResultPart::owner()
+std::shared_ptr<ModelAPI_Feature> Model_ResultPart::owner()
{
- return boost::shared_ptr<ModelAPI_Feature>(); // return empty pointer
+ return std::shared_ptr<ModelAPI_Feature>(); // return empty pointer
}
Model_ResultPart::Model_ResultPart()
setIsConcealed(false);
}
-void Model_ResultPart::setData(boost::shared_ptr<ModelAPI_Data> theData)
+void Model_ResultPart::setData(std::shared_ptr<ModelAPI_Data> theData)
{
ModelAPI_Result::setData(theData);
if (theData) {
void Model_ResultPart::activate()
{
- boost::shared_ptr<ModelAPI_AttributeDocRef> aDocRef = data()->document(DOC_REF());
+ std::shared_ptr<ModelAPI_AttributeDocRef> aDocRef = data()->document(DOC_REF());
if (!aDocRef->value()) { // create (or open) a document if it is not yet created
- boost::shared_ptr<ModelAPI_Document> aDoc = document()->subDocument(data()->name());
+ std::shared_ptr<ModelAPI_Document> aDoc = document()->subDocument(data()->name());
if (aDoc) {
aDocRef->setValue(aDoc);
}
{
public:
/// Returns the part-document of this result
- MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Document> partDoc();
+ MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Document> partDoc();
/// Part has no stored feature: this method returns NULL
- MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Feature> owner();
+ MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Feature> owner();
/// Sets this document as current and if it is not loaded yet, loads it
MODEL_EXPORT virtual void activate();
Model_ResultPart();
/// Sets the data manager of an object (document does), here also attributes are initialized
- virtual void setData(boost::shared_ptr<ModelAPI_Data> theData);
+ virtual void setData(std::shared_ptr<ModelAPI_Data> theData);
friend class Model_Document;
};
static Model_Session* myImpl = new Model_Session();
// t oredirect all calls to the root document
-#define ROOT_DOC boost::dynamic_pointer_cast<Model_Document>(moduleDocument())
+#define ROOT_DOC std::dynamic_pointer_cast<Model_Document>(moduleDocument())
bool Model_Session::load(const char* theFileName)
{
void Model_Session::startOperation()
{
ROOT_DOC->startOperation();
- static boost::shared_ptr<Events_Message> aStartedMsg
+ static std::shared_ptr<Events_Message> aStartedMsg
(new Events_Message(Events_Loop::eventByName("StartOperation")));
Events_Loop::loop()->send(aStartedMsg);
}
void Model_Session::abortOperation()
{
ROOT_DOC->abortOperation();
- static boost::shared_ptr<Events_Message> anAbortMsg
+ static std::shared_ptr<Events_Message> anAbortMsg
(new Events_Message(Events_Loop::eventByName("AbortOperation")));
Events_Loop::loop()->send(anAbortMsg);
}
return FeaturePtr(); // return nothing
}
-boost::shared_ptr<ModelAPI_Document> Model_Session::moduleDocument()
+std::shared_ptr<ModelAPI_Document> Model_Session::moduleDocument()
{
- return boost::shared_ptr<ModelAPI_Document>(
+ return std::shared_ptr<ModelAPI_Document>(
Model_Application::getApplication()->getDocument("root"));
}
return Model_Application::getApplication()->hasDocument("root");
}
-boost::shared_ptr<ModelAPI_Document> Model_Session::activeDocument()
+std::shared_ptr<ModelAPI_Document> Model_Session::activeDocument()
{
if (!myCurrentDoc || !Model_Application::getApplication()->hasDocument(myCurrentDoc->id()))
myCurrentDoc = moduleDocument();
}
void Model_Session::setActiveDocument(
- boost::shared_ptr<ModelAPI_Document> theDoc, bool theSendSignal)
+ std::shared_ptr<ModelAPI_Document> theDoc, bool theSendSignal)
{
if (myCurrentDoc != theDoc) {
myCurrentDoc = theDoc;
if (theSendSignal) {
- static boost::shared_ptr<Events_Message> aMsg(new Events_Message(Events_Loop::eventByName("CurrentDocumentChanged")));
+ static std::shared_ptr<Events_Message> aMsg(new Events_Message(Events_Loop::eventByName("CurrentDocumentChanged")));
Events_Loop::loop()->send(aMsg);
}
}
}
-std::list<boost::shared_ptr<ModelAPI_Document> > Model_Session::allOpenedDocuments()
+std::list<std::shared_ptr<ModelAPI_Document> > Model_Session::allOpenedDocuments()
{
- list<boost::shared_ptr<ModelAPI_Document> > aResult;
+ list<std::shared_ptr<ModelAPI_Document> > aResult;
aResult.push_back(moduleDocument());
// add subs recursively
- list<boost::shared_ptr<ModelAPI_Document> >::iterator aDoc = aResult.begin();
+ list<std::shared_ptr<ModelAPI_Document> >::iterator aDoc = aResult.begin();
for(; aDoc != aResult.end(); aDoc++) {
DocumentPtr anAPIDoc = *aDoc;
- boost::shared_ptr<Model_Document> aDoc = boost::dynamic_pointer_cast<Model_Document>(anAPIDoc);
+ std::shared_ptr<Model_Document> aDoc = std::dynamic_pointer_cast<Model_Document>(anAPIDoc);
if (aDoc) {
std::set<std::string>::const_iterator aSubIter = aDoc->subDocuments().cbegin();
for(; aSubIter != aDoc->subDocuments().cend(); aSubIter++) {
return aResult;
}
-boost::shared_ptr<ModelAPI_Document> Model_Session::copy(
- boost::shared_ptr<ModelAPI_Document> theSource, std::string theID)
+std::shared_ptr<ModelAPI_Document> Model_Session::copy(
+ std::shared_ptr<ModelAPI_Document> theSource, std::string theID)
{
// create a new document
- boost::shared_ptr<Model_Document> aNew = boost::dynamic_pointer_cast<Model_Document>(
+ std::shared_ptr<Model_Document> aNew = std::dynamic_pointer_cast<Model_Document>(
Model_Application::getApplication()->getDocument(theID));
// make a copy of all labels
- TDF_Label aSourceRoot = boost::dynamic_pointer_cast<Model_Document>(theSource)->document()->Main()
+ TDF_Label aSourceRoot = std::dynamic_pointer_cast<Model_Document>(theSource)->document()->Main()
.Father();
TDF_Label aTargetRoot = aNew->document()->Main().Father();
Handle(TDF_DataSet) aDS = new TDF_DataSet;
{
myPluginsInfoLoaded = false;
myCheckTransactions = true;
- ModelAPI_Session::setSession(boost::shared_ptr<ModelAPI_Session>(this));
+ 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());
aLoop->registerListener(this, Events_Loop::eventByName(EVENT_VALIDATOR_LOADED));
}
-void Model_Session::processEvent(const boost::shared_ptr<Events_Message>& theMessage)
+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 kValidatorEvent = Events_Loop::eventByName(EVENT_VALIDATOR_LOADED);
if (theMessage->eventID() == kFeatureEvent) {
- const boost::shared_ptr<Config_FeatureMessage> aMsg =
- boost::dynamic_pointer_cast<Config_FeatureMessage>(theMessage);
+ const std::shared_ptr<Config_FeatureMessage> aMsg =
+ std::dynamic_pointer_cast<Config_FeatureMessage>(theMessage);
if (aMsg) {
// proccess the plugin info, load plugin
if (myPlugins.find(aMsg->id()) == myPlugins.end()) {
aMsg->pluginLibrary(), aMsg->documentKind());
}
} else {
- const boost::shared_ptr<Config_AttributeMessage> aMsgAttr =
- boost::dynamic_pointer_cast<Config_AttributeMessage>(theMessage);
+ const std::shared_ptr<Config_AttributeMessage> aMsgAttr =
+ std::dynamic_pointer_cast<Config_AttributeMessage>(theMessage);
if (aMsgAttr) {
if (!aMsgAttr->isObligatory()) {
validators()->registerNotObligatory(aMsgAttr->featureId(), aMsgAttr->attributeId());
// plugins information was started to load, so, it will be loaded
myPluginsInfoLoaded = true;
} else if (theMessage->eventID() == kValidatorEvent) {
- boost::shared_ptr<Config_ValidatorMessage> aMsg =
- boost::dynamic_pointer_cast<Config_ValidatorMessage>(theMessage);
+ std::shared_ptr<Config_ValidatorMessage> aMsg =
+ std::dynamic_pointer_cast<Config_ValidatorMessage>(theMessage);
if (aMsg) {
if (aMsg->attributeId().empty()) { // feature validator
validators()->assignValidator(aMsg->validatorId(), aMsg->featureId(), aMsg->parameters());
std::map<std::string, std::pair<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
- boost::shared_ptr<ModelAPI_Document> myCurrentDoc; ///< current working document
+ std::shared_ptr<ModelAPI_Document> myCurrentDoc; ///< current working document
bool myCheckTransactions; ///< if true, generates error if document is updated outside of transaction
public:
MODEL_EXPORT virtual void redo();
/// Returns the root document of the application (that may contains sub-documents)
- MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Document> moduleDocument();
+ MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Document> moduleDocument();
/// Return true if root document has been already created
MODEL_EXPORT virtual bool hasModuleDocument();
/// Returns the current document that used for current work in the application
- MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Document> activeDocument();
+ MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Document> activeDocument();
/// Defines the current document that used for current work in the application
MODEL_EXPORT virtual void setActiveDocument(
- boost::shared_ptr<ModelAPI_Document> theDoc, bool theSendSignal = true);
+ std::shared_ptr<ModelAPI_Document> theDoc, bool theSendSignal = true);
/// Returns all the opened documents of the session (without postponed)
- MODEL_EXPORT virtual std::list<boost::shared_ptr<ModelAPI_Document> > allOpenedDocuments();
+ MODEL_EXPORT virtual std::list<std::shared_ptr<ModelAPI_Document> > allOpenedDocuments();
/// Registers the plugin that creates features.
/// It is obligatory for each plugin to call this function on loading to be found by
MODEL_EXPORT virtual void registerPlugin(ModelAPI_Plugin* thePlugin);
/// Processes the configuration file reading
- MODEL_EXPORT virtual void processEvent(const boost::shared_ptr<Events_Message>& theMessage);
+ MODEL_EXPORT virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
/// Copies the document to the new one wit hthe given id
- MODEL_EXPORT virtual boost::shared_ptr<ModelAPI_Document> copy(
- boost::shared_ptr<ModelAPI_Document> theSource, std::string theID);
+ MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Document> copy(
+ std::shared_ptr<ModelAPI_Document> theSource, std::string theID);
/// Returns the validators factory: the only one instance per application
MODEL_EXPORT virtual ModelAPI_ValidatorsFactory* validators();
isAutomatic = Config_PropManager::findProp("Model update", "automatic_rebuild")->value() == "true";
}
-void Model_Update::processEvent(const boost::shared_ptr<Events_Message>& theMessage)
+void Model_Update::processEvent(const std::shared_ptr<Events_Message>& theMessage)
{
static Events_Loop* aLoop = Events_Loop::loop();
static const Events_ID kChangedEvent = aLoop->eventByName("PreferenceChanged");
}
} else if (theMessage->eventID() == kCreatedEvent || theMessage->eventID() == kUpdatedEvent ||
theMessage->eventID() == kMovedEvent) {
- boost::shared_ptr<ModelAPI_ObjectUpdatedMessage> aMsg =
- boost::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
+ std::shared_ptr<ModelAPI_ObjectUpdatedMessage> aMsg =
+ std::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
const std::set<ObjectPtr>& anObjs = aMsg->objects();
std::set<ObjectPtr>::const_iterator anObjIter = anObjs.cbegin();
for(; anObjIter != anObjs.cend(); anObjIter++) {
}
// the hardcode (DBC asked): hide the sketch referenced by extrusion on apply
if (theMessage->eventID() == kOpFinishEvent) {
- std::set<boost::shared_ptr<ModelAPI_Object> >::iterator aFIter;
+ std::set<std::shared_ptr<ModelAPI_Object> >::iterator aFIter;
for(aFIter = myJustCreatedOrUpdated.begin(); aFIter != myJustCreatedOrUpdated.end(); aFIter++)
{
- FeaturePtr aF = boost::dynamic_pointer_cast<ModelAPI_Feature>(*aFIter);
+ FeaturePtr aF = std::dynamic_pointer_cast<ModelAPI_Feature>(*aFIter);
if (aF && aF->getKind() == "Extrusion") {
if (aF->selection("extrusion_face")) {
ResultPtr aSketchRes = aF->selection("extrusion_face")->context();
//Events_LongOp::start(this);
isExecuted = true;
- std::list<boost::shared_ptr<ModelAPI_Document> > aDocs;
- boost::shared_ptr<ModelAPI_ObjectUpdatedMessage> aMsg =
- boost::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
+ std::list<std::shared_ptr<ModelAPI_Document> > aDocs;
+ std::shared_ptr<ModelAPI_ObjectUpdatedMessage> aMsg =
+ std::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
if (aMsg) myInitial = aMsg->objects();
else {
myInitial.clear();
}
}
// collect all documents involved into the update process
- set<boost::shared_ptr<ModelAPI_Object> >::iterator aFIter = myInitial.begin();
+ set<std::shared_ptr<ModelAPI_Object> >::iterator aFIter = myInitial.begin();
for (; aFIter != myInitial.end(); aFIter++) {
aDocs.push_back((*aFIter)->document());
}
// iterate all features of features-documents to update them (including hidden)
- std::set<boost::shared_ptr<ModelAPI_Document> > alreadyUsed;
- list<boost::shared_ptr<ModelAPI_Document> >::iterator aDIter = aDocs.begin();
+ std::set<std::shared_ptr<ModelAPI_Document> > alreadyUsed;
+ list<std::shared_ptr<ModelAPI_Document> >::iterator aDIter = aDocs.begin();
for (; aDIter != aDocs.end(); aDIter++) {
if (alreadyUsed.find(*aDIter) != alreadyUsed.end())
continue;
alreadyUsed.insert(*aDIter);
int aNbFeatures = (*aDIter)->size(ModelAPI_Feature::group(), true);
for (int aFIndex = 0; aFIndex < aNbFeatures; aFIndex++) {
- FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(
+ FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(
(*aDIter)->object(ModelAPI_Feature::group(), aFIndex, true));
if (aFeature)
updateFeature(aFeature);
void Model_Update::redisplayWithResults(FeaturePtr theFeature) {
// maske updated and redisplay all results
static Events_ID EVENT_DISP = Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY);
- const std::list<boost::shared_ptr<ModelAPI_Result> >& aResults = theFeature->results();
- std::list<boost::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
+ const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = theFeature->results();
+ std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
for (; aRIter != aResults.cend(); aRIter++) {
- boost::shared_ptr<ModelAPI_Result> aRes = *aRIter;
+ std::shared_ptr<ModelAPI_Result> aRes = *aRIter;
aRes->data()->mustBeUpdated(false);
myUpdated[aRes] = true;
ModelAPI_EventCreator::get()->sendUpdated(aRes, EVENT_DISP);
// composite feature must be executed after sub-features execution
CompositeFeaturePtr aComposite =
- boost::dynamic_pointer_cast<ModelAPI_CompositeFeature>(theFeature);
+ std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(theFeature);
if (aComposite) {
int aSubsNum = aComposite->numberOfSubs();
for(int a = 0; a < aSubsNum; a++) {
}
// check all references: if referenced objects are updated, this object also must be updated
std::list<std::pair<std::string, std::list<ObjectPtr> > > aRefs;
- boost::shared_ptr<Model_Data> aData =
- boost::dynamic_pointer_cast<Model_Data>(theFeature->data());
+ std::shared_ptr<Model_Data> aData =
+ std::dynamic_pointer_cast<Model_Data>(theFeature->data());
aData->referencesToObjects(aRefs);
std::list<std::pair<std::string, std::list<ObjectPtr> > >::iterator aRef = aRefs.begin();
for(; aRef != aRefs.end(); aRef++) {
//std::cout<<"Update feature "<<theFeature->getKind()<<" must be updated = "<<aMustbeUpdated<<std::endl;
// execute feature if it must be updated
if (aMustbeUpdated) {
- if (boost::dynamic_pointer_cast<Model_Document>(theFeature->document())->executeFeatures() ||
+ if (std::dynamic_pointer_cast<Model_Document>(theFeature->document())->executeFeatures() ||
!theFeature->isPersistentResult()) {
if (aFactory->validate(theFeature)) {
if (isAutomatic || (myJustCreatedOrUpdated.find(theFeature) != myJustCreatedOrUpdated.end()) ||
theFeature->data()->attributes(ModelAPI_AttributeSelection::type());
list<AttributePtr>::iterator aRefsIter = aRefs.begin();
for (; aRefsIter != aRefs.end(); aRefsIter++) {
- boost::shared_ptr<ModelAPI_AttributeSelection> aSel =
- boost::dynamic_pointer_cast<ModelAPI_AttributeSelection>(*aRefsIter);
+ std::shared_ptr<ModelAPI_AttributeSelection> aSel =
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(*aRefsIter);
aSel->update(); // this must be done on execution since it may be long operation
}
aRefs = theFeature->data()->attributes(ModelAPI_AttributeSelectionList::type());
for (aRefsIter = aRefs.begin(); aRefsIter != aRefs.end(); aRefsIter++) {
- boost::shared_ptr<ModelAPI_AttributeSelectionList> aSel =
- boost::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(*aRefsIter);
+ std::shared_ptr<ModelAPI_AttributeSelectionList> aSel =
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(*aRefsIter);
for(int a = aSel->size() - 1; a >= 0; a--) {
aSel->value(a)->update();
}
redisplayWithResults(theFeature);
} else { // must be updatet, but not updated yet
theFeature->data()->mustBeUpdated(true);
- const std::list<boost::shared_ptr<ModelAPI_Result> >& aResults = theFeature->results();
- std::list<boost::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
+ const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = theFeature->results();
+ std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
for (; aRIter != aResults.cend(); aRIter++) {
- boost::shared_ptr<ModelAPI_Result> aRes = *aRIter;
+ std::shared_ptr<ModelAPI_Result> aRes = *aRIter;
aRes->data()->mustBeUpdated(true);
}
}
redisplayWithResults(theFeature);
}
} else { // returns also true is results were updated: for sketch that refers to sub-features but results of sub-features were changed
- const std::list<boost::shared_ptr<ModelAPI_Result> >& aResults = theFeature->results();
- std::list<boost::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
+ const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = theFeature->results();
+ std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
for (; aRIter != aResults.cend(); aRIter++) {
if (myInitial.find(*aRIter) != myInitial.end()) {
aMustbeUpdated = true;
return aMustbeUpdated;
}
-bool Model_Update::updateObject(boost::shared_ptr<ModelAPI_Object> theObject, const bool theCyclic)
+bool Model_Update::updateObject(std::shared_ptr<ModelAPI_Object> theObject, const bool theCyclic)
{
if (myUpdated.find(theObject) != myUpdated.end())
return myUpdated[theObject]; // already processed
if (theCyclic) { // algorithm for update of all features by dependencies tree
if (!theObject)
return false;
- FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(theObject);
+ FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theObject);
if (aFeature) { // for feature just call update Feature
return updateFeature(aFeature);
}
if (myUpdated.find(theObject) != myUpdated.end())
return myUpdated[theObject]; // already processed
// check the feature of this object must be executed
- ResultPtr aResult = boost::dynamic_pointer_cast<ModelAPI_Result>(theObject);
+ ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
if (aResult) {
FeaturePtr aResFeature = aResult->document()->feature(aResult);
if (aResFeature) {
#include "Model.h"
#include "Events_Listener.h"
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <set>
#include <map>
class Model_Update : public Events_Listener
{
/// initial set of updated features that must be processed
- std::set<boost::shared_ptr<ModelAPI_Object> > myInitial;
+ std::set<std::shared_ptr<ModelAPI_Object> > myInitial;
/// already updated and processed features and modificated feature flag
- std::map<boost::shared_ptr<ModelAPI_Object>, bool> myUpdated;
+ std::map<std::shared_ptr<ModelAPI_Object>, bool> myUpdated;
/// to know that all next updates are caused by this execution
bool isExecuted;
/// to know execute or not automatically all update
bool isAutomatic;
/// just created features: they must be updated immideately even in not-automatic mode for
/// preview; cleared on commit operations
- std::set<boost::shared_ptr<ModelAPI_Object> > myJustCreatedOrUpdated;
+ std::set<std::shared_ptr<ModelAPI_Object> > myJustCreatedOrUpdated;
public:
/// Is called only once, on startup of the application
Model_Update();
/// Processes the feature argument update: executes the results
- MODEL_EXPORT virtual void processEvent(const boost::shared_ptr<Events_Message>& theMessage);
+ MODEL_EXPORT virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
protected:
/// Recoursively checks and updates the feature if needed (calls the execute method)
/// Returns true if feature was updated.
- bool updateFeature(boost::shared_ptr<ModelAPI_Feature> theFeature);
+ bool updateFeature(std::shared_ptr<ModelAPI_Feature> theFeature);
/// Recoursively checks and updates the object (result or feature) if needed (calls updateFeature)
/// Returns true if object was updated.
- bool updateObject(boost::shared_ptr<ModelAPI_Object> theObject, const bool theCyclic = true);
+ bool updateObject(std::shared_ptr<ModelAPI_Object> theObject, const bool theCyclic = true);
/// Sends the redisplay events for feature and results, updates the updated status
- void redisplayWithResults(boost::shared_ptr<ModelAPI_Feature> theFeature);
+ void redisplayWithResults(std::shared_ptr<ModelAPI_Feature> theFeature);
};
#endif
theValidators.push_back(it->second);
}
-bool Model_ValidatorsFactory::validate(const boost::shared_ptr<ModelAPI_Feature>& theFeature) const
+bool Model_ValidatorsFactory::validate(const std::shared_ptr<ModelAPI_Feature>& theFeature) const
{
const static std::string kDefaultId = "Model_FeatureValidator";
// check feature validators first
}
}
// check all attributes for validity
- boost::shared_ptr<ModelAPI_Data> aData = theFeature->data();
+ std::shared_ptr<ModelAPI_Data> aData = theFeature->data();
if (!aData || !aData->isValid())
return false;
static const std::string kAllTypes = "";
MODEL_EXPORT virtual const ModelAPI_Validator* validator(const std::string& theID) const;
/// Returns true if feature and all its attributes are valid.
- MODEL_EXPORT virtual bool validate(const boost::shared_ptr<ModelAPI_Feature>& theFeature) const;
+ MODEL_EXPORT virtual bool validate(const std::shared_ptr<ModelAPI_Feature>& theFeature) const;
/// register that this attribute in feature is not obligatory for the feature execution
/// so, it is not needed for the standard validation mechanism
#include "ModelAPI_ResultPart.h"
template<class T1, class T2>
- boost::shared_ptr<T1> boost_cast(boost::shared_ptr<T2> theObject)
+ std::shared_ptr<T1> shared_ptr_cast(std::shared_ptr<T2> theObject)
{
- return boost::dynamic_pointer_cast<T1>(theObject);
+ return std::dynamic_pointer_cast<T1>(theObject);
}
%}
%include "typemaps.i"
%include "std_string.i"
%include "std_list.i"
+%include "std_shared_ptr.i"
-// boost pointers
-%include <boost_shared_ptr.i>
+// shared pointers
// For ModelAPI_ResultConstruction.shape()
%shared_ptr(GeomAPI_Interface)
%shared_ptr(GeomAPI_Shape)
%include "ModelAPI_ResultBody.h"
%include "ModelAPI_ResultPart.h"
-%template(ObjectList) std::list<boost::shared_ptr<ModelAPI_Object> >;
-%template(ResultList) std::list<boost::shared_ptr<ModelAPI_Result> >;
+%template(ObjectList) std::list<std::shared_ptr<ModelAPI_Object> >;
+%template(ResultList) std::list<std::shared_ptr<ModelAPI_Result> >;
-template<class T1, class T2> boost::shared_ptr<T1> boost_cast(boost::shared_ptr<T2> theObject);
-%template(modelAPI_CompositeFeature) boost_cast<ModelAPI_CompositeFeature, ModelAPI_Feature>;
-%template(modelAPI_ResultConstruction) boost_cast<ModelAPI_ResultConstruction, ModelAPI_Result>;
-%template(modelAPI_ResultBody) boost_cast<ModelAPI_ResultBody, ModelAPI_Result>;
-%template(modelAPI_ResultPart) boost_cast<ModelAPI_ResultPart, ModelAPI_Result>;
+template<class T1, class T2> std::shared_ptr<T1> shared_ptr_cast(std::shared_ptr<T2> theObject);
+%template(modelAPI_CompositeFeature) shared_ptr_cast<ModelAPI_CompositeFeature, ModelAPI_Feature>;
+%template(modelAPI_ResultConstruction) shared_ptr_cast<ModelAPI_ResultConstruction, ModelAPI_Result>;
+%template(modelAPI_ResultBody) shared_ptr_cast<ModelAPI_ResultBody, ModelAPI_Result>;
+%template(modelAPI_ResultPart) shared_ptr_cast<ModelAPI_ResultPart, ModelAPI_Result>;
#include "ModelAPI.h"
#include <string>
-#include <boost/shared_ptr.hpp>
+#include <memory>
class ModelAPI_Object;
class ModelAPI_Attribute
{
///< needed here to emit signal that feature changed on change of the attribute
- boost::shared_ptr<ModelAPI_Object> myObject;
+ std::shared_ptr<ModelAPI_Object> myObject;
protected:
// accessible from the attributes
bool myIsInitialized;
}
/// Sets the owner of this attribute
- MODELAPI_EXPORT virtual void setObject(const boost::shared_ptr<ModelAPI_Object>& theObject)
+ MODELAPI_EXPORT virtual void setObject(const std::shared_ptr<ModelAPI_Object>& theObject)
{
myObject = theObject;
}
/// Returns the owner of this attribute
- MODELAPI_EXPORT const boost::shared_ptr<ModelAPI_Object>& owner() const
+ MODELAPI_EXPORT const std::shared_ptr<ModelAPI_Object>& owner() const
{
return myObject;
}
};
//! Pointer on attribute object
-typedef boost::shared_ptr<ModelAPI_Attribute> AttributePtr;
+typedef std::shared_ptr<ModelAPI_Attribute> AttributePtr;
#endif
}
};
-typedef boost::shared_ptr<ModelAPI_AttributeBoolean> AttributeBooleanPtr;
+typedef std::shared_ptr<ModelAPI_AttributeBoolean> AttributeBooleanPtr;
#endif
{
public:
/// Defines the document referenced from this attribute
- MODELAPI_EXPORT virtual void setValue(boost::shared_ptr<ModelAPI_Document> theDoc) = 0;
+ MODELAPI_EXPORT virtual void setValue(std::shared_ptr<ModelAPI_Document> theDoc) = 0;
/// Returns document referenced from this attribute
- MODELAPI_EXPORT virtual boost::shared_ptr<ModelAPI_Document> value() = 0;
+ MODELAPI_EXPORT virtual std::shared_ptr<ModelAPI_Document> value() = 0;
/// Returns the type of this class of attributes
MODELAPI_EXPORT static std::string type()
}
};
-typedef boost::shared_ptr<ModelAPI_AttributeDocRef> AttributeDocRefPtr;
+typedef std::shared_ptr<ModelAPI_AttributeDocRef> AttributeDocRefPtr;
#endif
};
//! Pointer on double attribute
-typedef boost::shared_ptr<ModelAPI_AttributeDouble> AttributeDoublePtr;
+typedef std::shared_ptr<ModelAPI_AttributeDouble> AttributeDoublePtr;
#endif
};
//! Pointer on double attribute
-typedef boost::shared_ptr<ModelAPI_AttributeInteger> AttributeIntegerPtr;
+typedef std::shared_ptr<ModelAPI_AttributeInteger> AttributeIntegerPtr;
#endif
MODELAPI_EXPORT virtual bool isObject() = 0;
/// Defines the reference to the attribute
- MODELAPI_EXPORT virtual void setAttr(boost::shared_ptr<ModelAPI_Attribute> theAttr) = 0;
+ MODELAPI_EXPORT virtual void setAttr(std::shared_ptr<ModelAPI_Attribute> theAttr) = 0;
/// Returns attribute referenced from this attribute
- MODELAPI_EXPORT virtual boost::shared_ptr<ModelAPI_Attribute> attr() = 0;
+ MODELAPI_EXPORT virtual std::shared_ptr<ModelAPI_Attribute> attr() = 0;
/// Defines the reference to the object
MODELAPI_EXPORT virtual void setObject(ObjectPtr theFeature) = 0;
}
};
-typedef boost::shared_ptr<ModelAPI_AttributeRefAttr> AttributeRefAttrPtr;
+typedef std::shared_ptr<ModelAPI_AttributeRefAttr> AttributeRefAttrPtr;
#endif
}
};
-typedef boost::shared_ptr<ModelAPI_AttributeRefList> AttributeRefListPtr;
+typedef std::shared_ptr<ModelAPI_AttributeRefList> AttributeRefListPtr;
#endif
}
};
-typedef boost::shared_ptr<ModelAPI_AttributeReference> AttributeReferencePtr;
+typedef std::shared_ptr<ModelAPI_AttributeReference> AttributeReferencePtr;
#endif
public:
/// Defines the result and its selected sub-shape
virtual void setValue(
- const ResultPtr& theContext, const boost::shared_ptr<GeomAPI_Shape>& theSubShape) = 0;
+ const ResultPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape) = 0;
/// Returns the selected subshape
- virtual boost::shared_ptr<GeomAPI_Shape> value() = 0;
+ virtual std::shared_ptr<GeomAPI_Shape> value() = 0;
/// Returns the context of the selection (the whole shape owner)
virtual ResultPtr context() = 0;
};
//! Pointer on double attribute
-typedef boost::shared_ptr<ModelAPI_AttributeSelection> AttributeSelectionPtr;
+typedef std::shared_ptr<ModelAPI_AttributeSelection> AttributeSelectionPtr;
#endif
public:
/// Adds the new reference to the end of the list
virtual void append(
- const ResultPtr& theContext, const boost::shared_ptr<GeomAPI_Shape>& theSubShape) = 0;
+ const ResultPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape) = 0;
/// Returns the number ofselection attributes in the list
virtual int size() = 0;
virtual void setSelectionType(int) = 0;
/// Returns the attribute selection by the index (zero based)
- virtual boost::shared_ptr<ModelAPI_AttributeSelection> value(const int theIndex) = 0;
+ virtual std::shared_ptr<ModelAPI_AttributeSelection> value(const int theIndex) = 0;
/// Returns all attributes
virtual void clear() = 0;
};
//! Pointer on double attribute
-typedef boost::shared_ptr<ModelAPI_AttributeSelectionList> AttributeSelectionListPtr;
+typedef std::shared_ptr<ModelAPI_AttributeSelectionList> AttributeSelectionListPtr;
#endif
};
//! Pointer on double attribute
-typedef boost::shared_ptr<ModelAPI_AttributeString> AttributeStringPtr;
+typedef std::shared_ptr<ModelAPI_AttributeString> AttributeStringPtr;
#endif
{
public:
/// Adds feature to the sketch and to its document
- virtual boost::shared_ptr<ModelAPI_Feature> addFeature(std::string theID) = 0;
+ virtual std::shared_ptr<ModelAPI_Feature> addFeature(std::string theID) = 0;
/// Returns the number of sub-elements
virtual int numberOfSubs() const = 0;
/// Returns the sub-feature by zero-base index
- virtual boost::shared_ptr<ModelAPI_Feature> subFeature(const int theIndex) const = 0;
+ virtual std::shared_ptr<ModelAPI_Feature> subFeature(const int theIndex) const = 0;
/// Returns the sub-feature unique identifier in this composite feature by zero-base index
virtual int subFeatureId(const int theIndex) const = 0;
};
//! Pointer on the composite feature object
-typedef boost::shared_ptr<ModelAPI_CompositeFeature> CompositeFeaturePtr;
+typedef std::shared_ptr<ModelAPI_CompositeFeature> CompositeFeaturePtr;
#endif
#include <string>
#include <list>
#include <set>
-#include <boost/shared_ptr.hpp>
+#include <memory>
class ModelAPI_AttributeDocRef;
class ModelAPI_AttributeInteger;
virtual void setName(const std::string& theName) = 0;
/// Returns the attribute that references to another document
- virtual boost::shared_ptr<ModelAPI_AttributeDocRef> document(const std::string& theID) = 0;
+ virtual std::shared_ptr<ModelAPI_AttributeDocRef> document(const std::string& theID) = 0;
/// Returns the attribute that contains real value with double precision
- virtual boost::shared_ptr<ModelAPI_AttributeDouble> real(const std::string& theID) = 0;
+ virtual std::shared_ptr<ModelAPI_AttributeDouble> real(const std::string& theID) = 0;
/// Returns the attribute that contains integer value
- virtual boost::shared_ptr<ModelAPI_AttributeInteger> integer(const std::string& theID) = 0;
+ virtual std::shared_ptr<ModelAPI_AttributeInteger> integer(const std::string& theID) = 0;
/// Returns the attribute that contains reference to a feature
- virtual boost::shared_ptr<ModelAPI_AttributeReference> reference(const std::string& theID) = 0;
+ virtual std::shared_ptr<ModelAPI_AttributeReference> reference(const std::string& theID) = 0;
/// Returns the attribute that contains selection to a shape
- virtual boost::shared_ptr<ModelAPI_AttributeSelection> selection(const std::string& theID) = 0;
+ virtual std::shared_ptr<ModelAPI_AttributeSelection> selection(const std::string& theID) = 0;
/// Returns the attribute that contains selection to a shape
- virtual boost::shared_ptr<ModelAPI_AttributeSelectionList>
+ virtual std::shared_ptr<ModelAPI_AttributeSelectionList>
selectionList(const std::string& theID) = 0;
/// Returns the attribute that contains reference to an attribute of a feature
- virtual boost::shared_ptr<ModelAPI_AttributeRefAttr> refattr(const std::string& theID) = 0;
+ virtual std::shared_ptr<ModelAPI_AttributeRefAttr> refattr(const std::string& theID) = 0;
/// Returns the attribute that contains list of references to features
- virtual boost::shared_ptr<ModelAPI_AttributeRefList> reflist(const std::string& theID) = 0;
+ virtual std::shared_ptr<ModelAPI_AttributeRefList> reflist(const std::string& theID) = 0;
/// Returns the attribute that contains boolean value
- virtual boost::shared_ptr<ModelAPI_AttributeBoolean> boolean(const std::string& theID) = 0;
+ virtual std::shared_ptr<ModelAPI_AttributeBoolean> boolean(const std::string& theID) = 0;
/// Returns the attribute that contains boolean value
- virtual boost::shared_ptr<ModelAPI_AttributeString> string(const std::string& theID) = 0;
+ virtual std::shared_ptr<ModelAPI_AttributeString> string(const std::string& theID) = 0;
/// Returns the generic attribute by identifier
/// \param theID identifier of the attribute
- virtual boost::shared_ptr<ModelAPI_Attribute> attribute(const std::string& theID) = 0;
+ virtual std::shared_ptr<ModelAPI_Attribute> attribute(const std::string& theID) = 0;
/// Returns all attributes of the feature of the given type
/// or all attributes if "theType" is empty
- virtual std::list<boost::shared_ptr<ModelAPI_Attribute> >
+ virtual std::list<std::shared_ptr<ModelAPI_Attribute> >
attributes(const std::string& theType) = 0;
/// Returns all attributes ids of the feature of the given type
/// or all attributes if "theType" is empty
virtual std::list<std::string> attributesIDs(const std::string& theType) = 0;
/// Identifier by the id (not fast, iteration by map)
/// \param theAttr attribute already created in this data
- virtual const std::string& id(const boost::shared_ptr<ModelAPI_Attribute>& theAttr) = 0;
+ virtual const std::string& id(const std::shared_ptr<ModelAPI_Attribute>& theAttr) = 0;
/// Returns true if data belongs to same features
- virtual bool isEqual(const boost::shared_ptr<ModelAPI_Data>& theData) = 0;
+ virtual bool isEqual(const std::shared_ptr<ModelAPI_Data>& theData) = 0;
/// Returns true if it is correctly connected to the data model
virtual bool isValid() = 0;
virtual int featureId() const = 0;
// returns all objects referenced to this
- virtual const std::set<boost::shared_ptr<ModelAPI_Attribute> >& refsToMe() = 0;
+ virtual const std::set<std::shared_ptr<ModelAPI_Attribute> >& refsToMe() = 0;
protected:
/// Objects are created for features automatically
}
};
-typedef boost::shared_ptr<ModelAPI_Data> DataPtr;
+typedef std::shared_ptr<ModelAPI_Data> DataPtr;
#endif
#include <ModelAPI.h>
#include <string>
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <vector>
#include <list>
//! Adds to the document the new feature of the given feature id
//! \param creates feature and puts it in the document (if it is not action)
- virtual boost::shared_ptr<ModelAPI_Feature> addFeature(std::string theID) = 0;
+ virtual std::shared_ptr<ModelAPI_Feature> addFeature(std::string theID) = 0;
//! Removes the feature from the document
- virtual void removeFeature(boost::shared_ptr<ModelAPI_Feature> theFeature,
+ virtual void removeFeature(std::shared_ptr<ModelAPI_Feature> theFeature,
const bool theCheck = true) = 0;
///! Adds a new sub-document by the identifier, or returns existing one if it is already exist
- virtual boost::shared_ptr<ModelAPI_Document> subDocument(std::string theDocID) = 0;
+ virtual std::shared_ptr<ModelAPI_Document> subDocument(std::string theDocID) = 0;
///! Returns the id of the document
virtual const std::string& id() const = 0;
//! \param theGroupID group that contains an object
//! \param theIndex zero-based index of feature in the group
//! \param theHidden if it is true, it counts also the features that are not in tree
- virtual boost::shared_ptr<ModelAPI_Object> object(const std::string& theGroupID,
+ virtual std::shared_ptr<ModelAPI_Object> object(const std::string& theGroupID,
const int theIndex,
const bool theHidden = false) = 0;
}
/// Creates a construction cresults
- virtual boost::shared_ptr<ModelAPI_ResultConstruction> createConstruction(
- const boost::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0) = 0;
+ virtual std::shared_ptr<ModelAPI_ResultConstruction> createConstruction(
+ const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0) = 0;
/// Creates a body results
- virtual boost::shared_ptr<ModelAPI_ResultBody> createBody(
- const boost::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0) = 0;
+ virtual std::shared_ptr<ModelAPI_ResultBody> createBody(
+ const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0) = 0;
/// Creates a part results
- virtual boost::shared_ptr<ModelAPI_ResultPart> createPart(
- const boost::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0) = 0;
+ virtual std::shared_ptr<ModelAPI_ResultPart> createPart(
+ const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0) = 0;
/// Creates a group results
- virtual boost::shared_ptr<ModelAPI_ResultGroup> createGroup(
- const boost::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0) = 0;
+ virtual std::shared_ptr<ModelAPI_ResultGroup> createGroup(
+ const std::shared_ptr<ModelAPI_Data>& theFeatureData, const int theIndex = 0) = 0;
//! Returns a feature by result (owner of result)
- virtual boost::shared_ptr<ModelAPI_Feature> feature(
- const boost::shared_ptr<ModelAPI_Result>& theResult) = 0;
+ virtual std::shared_ptr<ModelAPI_Feature> feature(
+ const std::shared_ptr<ModelAPI_Result>& theResult) = 0;
protected:
/// Only for SWIG wrapping it is here
};
//! Pointer on document object
-typedef boost::shared_ptr<ModelAPI_Document> DocumentPtr;
+typedef std::shared_ptr<ModelAPI_Document> DocumentPtr;
#endif
#include <ModelAPI.h>
#include <Events_MessageGroup.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <string>
#include <set>
virtual const std::set<ObjectPtr>& objects() const = 0;
//! Creates a new empty group (to store it in the loop before flush)
- virtual boost::shared_ptr<Events_MessageGroup> newEmpty() = 0;
+ virtual std::shared_ptr<Events_MessageGroup> newEmpty() = 0;
//! Allows to join the given message with the current one
- virtual void Join(const boost::shared_ptr<Events_MessageGroup>& theJoined) = 0;
+ virtual void Join(const std::shared_ptr<Events_MessageGroup>& theJoined) = 0;
};
/// Message that feature was deleted (used for Object Browser update)
public:
/// Returns the feature that has been updated
- virtual boost::shared_ptr<ModelAPI_Document> document() const = 0;
+ virtual std::shared_ptr<ModelAPI_Document> document() const = 0;
/// Returns the group where the feature was deleted
virtual const std::set<std::string>& groups() const = 0;
- virtual boost::shared_ptr<Events_MessageGroup> newEmpty() = 0;
+ virtual std::shared_ptr<Events_MessageGroup> newEmpty() = 0;
virtual const Events_ID messageId() = 0;
- virtual void Join(const boost::shared_ptr<Events_MessageGroup>& theJoined) = 0;
+ virtual void Join(const std::shared_ptr<Events_MessageGroup>& theJoined) = 0;
};
/// Allows to create ModelAPI messages
virtual void sendUpdated(const ObjectPtr& theObject, const Events_ID& theEvent,
const bool isGroupped = true) const = 0;
/// creates deleted message and sends to the loop
- virtual void sendDeleted(const boost::shared_ptr<ModelAPI_Document>& theDoc,
+ virtual void sendDeleted(const std::shared_ptr<ModelAPI_Document>& theDoc,
const std::string& theGroup) const = 0;
/// returns the creator instance
#include <ModelAPI_Session.h>
#include <Events_Loop.h>
-const std::list<boost::shared_ptr<ModelAPI_Result> >& ModelAPI_Feature::results()
+const std::list<std::shared_ptr<ModelAPI_Result> >& ModelAPI_Feature::results()
{
return myResults;
}
-boost::shared_ptr<ModelAPI_Result> ModelAPI_Feature::firstResult()
+std::shared_ptr<ModelAPI_Result> ModelAPI_Feature::firstResult()
{
- return myResults.empty() ? boost::shared_ptr<ModelAPI_Result>() : *(myResults.begin());
+ return myResults.empty() ? std::shared_ptr<ModelAPI_Result>() : *(myResults.begin());
}
-boost::shared_ptr<ModelAPI_Result> ModelAPI_Feature::lastResult()
+std::shared_ptr<ModelAPI_Result> ModelAPI_Feature::lastResult()
{
- return myResults.empty() ? boost::shared_ptr<ModelAPI_Result>() : *(myResults.rbegin());
+ return myResults.empty() ? std::shared_ptr<ModelAPI_Result>() : *(myResults.rbegin());
}
-void ModelAPI_Feature::setResult(const boost::shared_ptr<ModelAPI_Result>& theResult)
+void ModelAPI_Feature::setResult(const std::shared_ptr<ModelAPI_Result>& theResult)
{
if (firstResult() == theResult) { // just updated
static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED);
}
// created
while (!myResults.empty()) { // remove one by one with messages
- boost::shared_ptr<ModelAPI_Result> aRes = *(myResults.begin());
+ std::shared_ptr<ModelAPI_Result> aRes = *(myResults.begin());
myResults.erase(myResults.begin());
ModelAPI_EventCreator::get()->sendDeleted(aRes->document(), aRes->groupName());
}
Events_Loop::loop()->flush(anEvent);
}
-void ModelAPI_Feature::setResult(const boost::shared_ptr<ModelAPI_Result>& theResult,
+void ModelAPI_Feature::setResult(const std::shared_ptr<ModelAPI_Result>& theResult,
const int theIndex)
{
- std::list<boost::shared_ptr<ModelAPI_Result> >::iterator aResIter = myResults.begin();
+ std::list<std::shared_ptr<ModelAPI_Result> >::iterator aResIter = myResults.begin();
for (int anIndex = 0; anIndex < theIndex; anIndex++) {
aResIter++;
}
}
}
-void ModelAPI_Feature::removeResult(const boost::shared_ptr<ModelAPI_Result>& theResult)
+void ModelAPI_Feature::removeResult(const std::shared_ptr<ModelAPI_Result>& theResult)
{
- std::list<boost::shared_ptr<ModelAPI_Result> >::iterator aResIter = myResults.begin();
+ std::list<std::shared_ptr<ModelAPI_Result> >::iterator aResIter = myResults.begin();
for(; aResIter != myResults.end(); aResIter++) {
ResultPtr aRes = *aResIter;
if (aRes == theResult) {
static Events_ID EVENT_DISP = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get();
- std::list<boost::shared_ptr<ModelAPI_Result> >::iterator aResIter = myResults.begin();
+ std::list<std::shared_ptr<ModelAPI_Result> >::iterator aResIter = myResults.begin();
for(; aResIter != myResults.end(); aResIter++) {
(*aResIter)->data()->erase();
ModelAPI_EventCreator::get()->sendDeleted(document(), (*aResIter)->groupName());
}
}
-boost::shared_ptr<ModelAPI_Document> ModelAPI_Feature::documentToAdd()
+std::shared_ptr<ModelAPI_Document> ModelAPI_Feature::documentToAdd()
{
return ModelAPI_Session::get()->activeDocument();
}
static const ModelAPI_EventCreator* aECreator = ModelAPI_EventCreator::get();
while (!myResults.empty()) { // remove one by one with messages
- boost::shared_ptr<ModelAPI_Result> aRes = *(myResults.begin());
+ std::shared_ptr<ModelAPI_Result> aRes = *(myResults.begin());
myResults.erase(myResults.begin());
aECreator->sendDeleted(aRes->document(), aRes->groupName());
aECreator->sendUpdated(aRes, EVENT_DISP);
FeaturePtr ModelAPI_Feature::feature(ObjectPtr theObject)
{
- FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(theObject);
+ FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theObject);
if (!aFeature) {
- ResultPtr aResult = boost::dynamic_pointer_cast<ModelAPI_Result>(theObject);
+ ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
if (aResult) {
DocumentPtr aDoc = aResult->document();
return aDoc->feature(aResult);
#include <ModelAPI_Document.h>
#include <ModelAPI_Result.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <list>
#include <string>
class ModelAPI_Feature : public ModelAPI_Object
{
///< list of current results of this feature
- std::list<boost::shared_ptr<ModelAPI_Result> > myResults;
+ std::list<std::shared_ptr<ModelAPI_Result> > myResults;
public:
/// Returns the unique kind of a feature (like "Point")
virtual const std::string& getKind() = 0;
}
/// Returns document this feature belongs to
- virtual boost::shared_ptr<ModelAPI_Document> document() const
+ virtual std::shared_ptr<ModelAPI_Document> document() const
{
return ModelAPI_Object::document();
}
virtual void execute() = 0;
/// returns the current results of the feature
- MODELAPI_EXPORT const std::list<boost::shared_ptr<ModelAPI_Result> >& results();
+ MODELAPI_EXPORT const std::list<std::shared_ptr<ModelAPI_Result> >& results();
/// returns the first result in the list or NULL reference
- MODELAPI_EXPORT boost::shared_ptr<ModelAPI_Result> firstResult();
+ MODELAPI_EXPORT std::shared_ptr<ModelAPI_Result> firstResult();
/// returns the last result in the list or NULL reference
- MODELAPI_EXPORT boost::shared_ptr<ModelAPI_Result> lastResult();
+ MODELAPI_EXPORT std::shared_ptr<ModelAPI_Result> lastResult();
/// sets the alone result
- MODELAPI_EXPORT void setResult(const boost::shared_ptr<ModelAPI_Result>& theResult);
+ MODELAPI_EXPORT void setResult(const std::shared_ptr<ModelAPI_Result>& theResult);
/// sets the result by index (zero based), results before this must be set before
- MODELAPI_EXPORT void setResult(const boost::shared_ptr<ModelAPI_Result>& theResult,
+ MODELAPI_EXPORT void setResult(const std::shared_ptr<ModelAPI_Result>& theResult,
const int theIndex);
/// removes the result from the feature
- MODELAPI_EXPORT void removeResult(const boost::shared_ptr<ModelAPI_Result>& theResult);
+ MODELAPI_EXPORT void removeResult(const std::shared_ptr<ModelAPI_Result>& theResult);
/// removes all results from the feature
MODELAPI_EXPORT void eraseResults();
/// removes all fields from this feature: results, data, etc
/// Must return document where the new feature must be added to
/// By default it is current document
- MODELAPI_EXPORT virtual boost::shared_ptr<ModelAPI_Document> documentToAdd();
+ MODELAPI_EXPORT virtual std::shared_ptr<ModelAPI_Document> documentToAdd();
/// To virtually destroy the fields of successors
MODELAPI_EXPORT virtual ~ModelAPI_Feature();
- MODELAPI_EXPORT static boost::shared_ptr<ModelAPI_Feature> feature(ObjectPtr theObject);
+ MODELAPI_EXPORT static std::shared_ptr<ModelAPI_Feature> feature(ObjectPtr theObject);
//
// Helper methods, aliases for data()->method()
return data()->name();
}
- inline boost::shared_ptr<ModelAPI_AttributeBoolean> boolean(const std::string& theID)
+ inline std::shared_ptr<ModelAPI_AttributeBoolean> boolean(const std::string& theID)
{
return data()->boolean(theID);
}
- inline boost::shared_ptr<ModelAPI_AttributeDocRef> document(const std::string& theID)
+ inline std::shared_ptr<ModelAPI_AttributeDocRef> document(const std::string& theID)
{
return data()->document(theID);
}
- inline boost::shared_ptr<ModelAPI_AttributeDouble> real(const std::string& theID)
+ inline std::shared_ptr<ModelAPI_AttributeDouble> real(const std::string& theID)
{
return data()->real(theID);
}
- inline boost::shared_ptr<ModelAPI_AttributeInteger> integer(const std::string& theID)
+ inline std::shared_ptr<ModelAPI_AttributeInteger> integer(const std::string& theID)
{
return data()->integer(theID);
}
- inline boost::shared_ptr<ModelAPI_AttributeRefAttr> refattr(const std::string& theID)
+ inline std::shared_ptr<ModelAPI_AttributeRefAttr> refattr(const std::string& theID)
{
return data()->refattr(theID);
}
- inline boost::shared_ptr<ModelAPI_AttributeReference> reference(const std::string& theID)
+ inline std::shared_ptr<ModelAPI_AttributeReference> reference(const std::string& theID)
{
return data()->reference(theID);
}
- inline boost::shared_ptr<ModelAPI_AttributeRefList> reflist(const std::string& theID)
+ inline std::shared_ptr<ModelAPI_AttributeRefList> reflist(const std::string& theID)
{
return data()->reflist(theID);
}
- inline boost::shared_ptr<ModelAPI_AttributeSelection> selection(const std::string& theID)
+ inline std::shared_ptr<ModelAPI_AttributeSelection> selection(const std::string& theID)
{
return data()->selection(theID);
}
- inline boost::shared_ptr<ModelAPI_AttributeSelectionList> selectionList(const std::string& theID)
+ inline std::shared_ptr<ModelAPI_AttributeSelectionList> selectionList(const std::string& theID)
{
return data()->selectionList(theID);
}
- inline boost::shared_ptr<ModelAPI_AttributeString> string(const std::string& theID)
+ inline std::shared_ptr<ModelAPI_AttributeString> string(const std::string& theID)
{
return data()->string(theID);
}
- inline boost::shared_ptr<ModelAPI_Attribute> attribute(const std::string& theID)
+ inline std::shared_ptr<ModelAPI_Attribute> attribute(const std::string& theID)
{
return data()->attribute(theID);
}
};
//! Pointer on feature object
-typedef boost::shared_ptr<ModelAPI_Feature> FeaturePtr;
+typedef std::shared_ptr<ModelAPI_Feature> FeaturePtr;
#endif
/// \param theFeature the validated feature
/// \param theAttr the validated attribute ID, empty string of feature is validated
/// \param theArguments list of string, feature attribute names: dependent attributes
- virtual bool isValid(const boost::shared_ptr<ModelAPI_Feature>& theFeature,
+ virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
const std::list<std::string>& theArguments) const = 0;
};
#include "ModelAPI.h"
#include "ModelAPI_Data.h"
-#include <boost/shared_ptr.hpp>
+#include <memory>
class ModelAPI_Data;
class ModelAPI_Document;
*/
class ModelAPI_Object
{
- boost::shared_ptr<ModelAPI_Data> myData; ///< manager of the data model of a feature
- boost::shared_ptr<ModelAPI_Document> myDoc; ///< document this object belongs to
+ std::shared_ptr<ModelAPI_Data> myData; ///< manager of the data model of a feature
+ std::shared_ptr<ModelAPI_Document> myDoc; ///< document this object belongs to
public:
/// By default object is displayed in the object browser.
virtual bool isInHistory()
}
/// Returns the data manager of this object: attributes
- virtual boost::shared_ptr<ModelAPI_Data> data() const
+ virtual std::shared_ptr<ModelAPI_Data> data() const
{
return myData;
}
/// Returns true if object refers to the same data model instance
- virtual bool isSame(const boost::shared_ptr<ModelAPI_Object>& theObject)
+ virtual bool isSame(const std::shared_ptr<ModelAPI_Object>& theObject)
{
return theObject.get() == this;
}
/// Returns document this feature belongs to
- virtual boost::shared_ptr<ModelAPI_Document> document() const
+ virtual std::shared_ptr<ModelAPI_Document> document() const
{
return myDoc;
}
protected:
/// Sets the data manager of an object (document does)
- virtual void setData(boost::shared_ptr<ModelAPI_Data> theData)
+ virtual void setData(std::shared_ptr<ModelAPI_Data> theData)
{
myData = theData;
}
/// Sets the data manager of an object (document does)
- virtual void setDoc(boost::shared_ptr<ModelAPI_Document> theDoc)
+ virtual void setDoc(std::shared_ptr<ModelAPI_Document> theDoc)
{
myDoc = theDoc;
}
};
-typedef boost::shared_ptr<ModelAPI_Object> ObjectPtr;
+typedef std::shared_ptr<ModelAPI_Object> ObjectPtr;
#endif
#include "ModelAPI.h"
#include <string>
-#include <boost/shared_ptr.hpp>
+#include <memory>
class ModelAPI_Feature;
{
public:
/// Creates the feature object of this plugin by the feature string ID
- virtual boost::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID) = 0;
+ virtual std::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID) = 0;
/// To virtually destroy the fields of successors
virtual ~ModelAPI_Plugin()
};
//! Pointer on feature object
-typedef boost::shared_ptr<ModelAPI_Result> ResultPtr;
+typedef std::shared_ptr<ModelAPI_Result> ResultPtr;
#endif
#include <GeomAPI_Shape.h>
#include <GeomAlgoAPI_MakeShape.h>
#include <GeomAPI_DataMapOfShapeShape.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <string>
/**\class ModelAPI_ResultBody
}
/// Stores the shape (called by the execution method).
- virtual void store(const boost::shared_ptr<GeomAPI_Shape>& theShape) = 0;
+ virtual void store(const std::shared_ptr<GeomAPI_Shape>& theShape) = 0;
/// Stores the generated shape (called by the execution method).
- virtual void storeGenerated(const boost::shared_ptr<GeomAPI_Shape>& theFromShape,
- const boost::shared_ptr<GeomAPI_Shape>& theToShape) = 0;
+ virtual void storeGenerated(const std::shared_ptr<GeomAPI_Shape>& theFromShape,
+ const std::shared_ptr<GeomAPI_Shape>& theToShape) = 0;
/// Stores the modified shape (called by the execution method).
- virtual void storeModified(const boost::shared_ptr<GeomAPI_Shape>& theOldShape,
- const boost::shared_ptr<GeomAPI_Shape>& theNewShape) = 0;
+ virtual void storeModified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
+ const std::shared_ptr<GeomAPI_Shape>& theNewShape) = 0;
/// Returns the shape-result produced by this feature
- virtual boost::shared_ptr<GeomAPI_Shape> shape() = 0;
+ virtual std::shared_ptr<GeomAPI_Shape> shape() = 0;
/// Records the subshape newShape which was generated during a topological construction.
/// As an example, consider the case of a face generated in construction of a box.
virtual void generated(
- const boost::shared_ptr<GeomAPI_Shape>& theNewShape, const int theTag = 1) = 0;
+ const std::shared_ptr<GeomAPI_Shape>& theNewShape, const int theTag = 1) = 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
/// construction of a prism.
- virtual void generated(const boost::shared_ptr<GeomAPI_Shape>& theOldShape,
- const boost::shared_ptr<GeomAPI_Shape>& theNewShape, const int theTag = 1) = 0;
+ virtual void generated(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
+ const std::shared_ptr<GeomAPI_Shape>& theNewShape, const int theTag = 1) = 0;
/// Records the shape newShape which is a modification of the shape oldShape.
/// As an example, consider the case of a face split or merged in a Boolean operation.
- virtual void modified(const boost::shared_ptr<GeomAPI_Shape>& theOldShape,
- const boost::shared_ptr<GeomAPI_Shape>& theNewShape, const int theTag = 1) = 0;
+ virtual void modified(const std::shared_ptr<GeomAPI_Shape>& theOldShape,
+ const std::shared_ptr<GeomAPI_Shape>& theNewShape, const int theTag = 1) = 0;
/// Records the shape oldShape which was deleted from the current label.
/// As an example, consider the case of a face removed by a Boolean operation.
virtual void deleted(
- const boost::shared_ptr<GeomAPI_Shape>& theOldShape, const int theTag = 1) = 0;
+ const std::shared_ptr<GeomAPI_Shape>& theOldShape, const int theTag = 1) = 0;
/// load deleted shapes
virtual void loadDeletedShapes (GeomAlgoAPI_MakeShape* theMS,
- boost::shared_ptr<GeomAPI_Shape> theShapeIn,
+ std::shared_ptr<GeomAPI_Shape> theShapeIn,
const int theKindOfShape,
const int theTag) = 0;
/// load and orient modified shapes
virtual void loadAndOrientModifiedShapes (
GeomAlgoAPI_MakeShape* theMS,
- boost::shared_ptr<GeomAPI_Shape> theShapeIn,
+ std::shared_ptr<GeomAPI_Shape> theShapeIn,
const int theKindOfShape,
const int theTag,
GeomAPI_DataMapOfShapeShape& theSubShapes) = 0;
/// load and orient generated shapes
virtual void loadAndOrientGeneratedShapes (
GeomAlgoAPI_MakeShape* theMS,
- boost::shared_ptr<GeomAPI_Shape> theShapeIn,
+ std::shared_ptr<GeomAPI_Shape> theShapeIn,
const int theKindOfShape,
const int theTag,
GeomAPI_DataMapOfShapeShape& theSubShapes) = 0;
/// load shapes of the first level (to be used during shape import)
- virtual void loadFirstLevel(boost::shared_ptr<GeomAPI_Shape> theShape, int& theTag) = 0;
+ virtual void loadFirstLevel(std::shared_ptr<GeomAPI_Shape> theShape, int& theTag) = 0;
/// load disconnected edges
- virtual void loadDisconnectedEdges(boost::shared_ptr<GeomAPI_Shape> theShape, int& theTag) = 0;
+ virtual void loadDisconnectedEdges(std::shared_ptr<GeomAPI_Shape> theShape, int& theTag) = 0;
/// load disconnected vetexes
- virtual void loadDisconnectedVertexes(boost::shared_ptr<GeomAPI_Shape> theShape, int& theTag) = 0;
+ virtual void loadDisconnectedVertexes(std::shared_ptr<GeomAPI_Shape> theShape, int& theTag) = 0;
protected:
};
//! Pointer on feature object
-typedef boost::shared_ptr<ModelAPI_ResultBody> ResultBodyPtr;
+typedef std::shared_ptr<ModelAPI_ResultBody> ResultBodyPtr;
#endif
}
/// Returns the shape-result produced by this feature
- virtual boost::shared_ptr<GeomAPI_Shape>& shape() = 0;
+ virtual std::shared_ptr<GeomAPI_Shape>& shape() = 0;
/// Sets the result
- virtual void setShape(boost::shared_ptr<GeomAPI_Shape> theShape) = 0;
+ virtual void setShape(std::shared_ptr<GeomAPI_Shape> theShape) = 0;
/// Sets the flag that it must be displayed in history (default is true)
virtual void setIsInHistory(const bool isInHistory) = 0;
};
//! Pointer on feature object
-typedef boost::shared_ptr<ModelAPI_ResultConstruction> ResultConstructionPtr;
+typedef std::shared_ptr<ModelAPI_ResultConstruction> ResultConstructionPtr;
#endif
#include "ModelAPI_Result.h"
#include <GeomAPI_Shape.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <string>
/**\class ModelAPI_ResultGroup
}
/// Returns the compound of selected entities
- virtual boost::shared_ptr<GeomAPI_Shape> shape() const = 0;
+ virtual std::shared_ptr<GeomAPI_Shape> shape() const = 0;
};
//! Pointer on feature object
-typedef boost::shared_ptr<ModelAPI_ResultGroup> ResultGroupPtr;
+typedef std::shared_ptr<ModelAPI_ResultGroup> ResultGroupPtr;
#endif
};
//! Pointer on feature object
-typedef boost::shared_ptr<ModelAPI_ResultParameters> ResultParametersPtr;
+typedef std::shared_ptr<ModelAPI_ResultParameters> ResultParametersPtr;
#endif
}
/// Returns the part-document of this result
- virtual boost::shared_ptr<ModelAPI_Document> partDoc() = 0;
+ virtual std::shared_ptr<ModelAPI_Document> partDoc() = 0;
/// Sets this document as current and if it is not loaded yet, loads it
virtual void activate() = 0;
};
//! Pointer on feature object
-typedef boost::shared_ptr<ModelAPI_ResultPart> ResultPartPtr;
+typedef std::shared_ptr<ModelAPI_ResultPart> ResultPartPtr;
#endif
#endif
/// Manager that will be initialized from Model package, one per application
-boost::shared_ptr<ModelAPI_Session> MY_MANAGER;
+std::shared_ptr<ModelAPI_Session> MY_MANAGER;
ModelAPI_Session::ModelAPI_Session()
{
}
-void ModelAPI_Session::setSession(boost::shared_ptr<ModelAPI_Session> theManager)
+void ModelAPI_Session::setSession(std::shared_ptr<ModelAPI_Session> theManager)
{
MY_MANAGER = theManager;
}
-boost::shared_ptr<ModelAPI_Session> ModelAPI_Session::get()
+std::shared_ptr<ModelAPI_Session> ModelAPI_Session::get()
{
if (!MY_MANAGER) { // import Model library that implements this interface of ModelAPI
Config_ModuleReader::loadLibrary("Model");
#include "ModelAPI.h"
#include <string>
#include <list>
-#include <boost/shared_ptr.hpp>
+#include <memory>
class ModelAPI_Feature;
class ModelAPI_Plugin;
{
public:
/// Returns the real implementation (the alone instance per application) of the plugin manager
- static boost::shared_ptr<ModelAPI_Session> get();
+ static std::shared_ptr<ModelAPI_Session> get();
//! Loads the OCAF document from the file.
//! \param theFileName full name of the file to load
virtual void registerPlugin(ModelAPI_Plugin* thePlugin) = 0;
/// Returns the root document of the application (that may contains sub-documents)
- virtual boost::shared_ptr<ModelAPI_Document> moduleDocument() = 0;
+ virtual std::shared_ptr<ModelAPI_Document> moduleDocument() = 0;
/// Return true if root document has been already created
virtual bool hasModuleDocument() = 0;
/// Returns the current document that used for current work in the application
- virtual boost::shared_ptr<ModelAPI_Document> activeDocument() = 0;
+ virtual std::shared_ptr<ModelAPI_Document> activeDocument() = 0;
/// Defines the current document that used for current work in the application
virtual void setActiveDocument(
- boost::shared_ptr<ModelAPI_Document> theDoc, bool theSendSignal = true) = 0;
+ std::shared_ptr<ModelAPI_Document> theDoc, bool theSendSignal = true) = 0;
/// Returns all the opened documents of the session (without postponed)
- virtual std::list<boost::shared_ptr<ModelAPI_Document> > allOpenedDocuments() = 0;
+ virtual std::list<std::shared_ptr<ModelAPI_Document> > allOpenedDocuments() = 0;
/// Copies the document to the new one with the given id
- virtual boost::shared_ptr<ModelAPI_Document> copy(boost::shared_ptr<ModelAPI_Document> theSource,
+ virtual std::shared_ptr<ModelAPI_Document> copy(std::shared_ptr<ModelAPI_Document> theSource,
std::string theID) = 0;
/// Returns the validators factory: the only one instance per application
protected:
/// Creates the feature object using plugins functionality
- virtual boost::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID) = 0;
+ virtual std::shared_ptr<ModelAPI_Feature> createFeature(std::string theFeatureID) = 0;
- static void setSession(boost::shared_ptr<ModelAPI_Session> theManager);
+ static void setSession(std::shared_ptr<ModelAPI_Session> theManager);
friend class Model_Document;
};
-typedef boost::shared_ptr<ModelAPI_Session> SessionPtr;
+typedef std::shared_ptr<ModelAPI_Session> SessionPtr;
#endif
namespace ModelAPI_Tools {
- boost::shared_ptr<GeomAPI_Shape> shape(const ResultPtr& theResult)
+ std::shared_ptr<GeomAPI_Shape> shape(const ResultPtr& theResult)
{
- ResultBodyPtr aBody = boost::dynamic_pointer_cast<ModelAPI_ResultBody>(theResult);
+ ResultBodyPtr aBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(theResult);
if (aBody)
return aBody->shape();
- ResultConstructionPtr aConstruct = boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(
+ ResultConstructionPtr aConstruct = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(
theResult);
if (aConstruct)
return aConstruct->shape();
- ResultGroupPtr aGroup = boost::dynamic_pointer_cast<ModelAPI_ResultGroup>(theResult);
+ ResultGroupPtr aGroup = std::dynamic_pointer_cast<ModelAPI_ResultGroup>(theResult);
if (aGroup)
return aGroup->shape();
- return boost::shared_ptr<GeomAPI_Shape>();
+ return std::shared_ptr<GeomAPI_Shape>();
}
}
namespace ModelAPI_Tools {
/// Returns shape from the given Result object
-MODELAPI_EXPORT boost::shared_ptr<GeomAPI_Shape> shape(const ResultPtr& theResult);
+MODELAPI_EXPORT std::shared_ptr<GeomAPI_Shape> shape(const ResultPtr& theResult);
}
;
#define ModelAPI_Validator_H_
#include <ModelAPI.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <list>
class ModelAPI_Feature;
}
};
-typedef boost::shared_ptr<ModelAPI_Validator> ValidatorPtr;
+typedef std::shared_ptr<ModelAPI_Validator> ValidatorPtr;
/**\class ModelAPI_ValidatorsFactory
* \ingroup DataModel
virtual const ModelAPI_Validator* validator(const std::string& theID) const = 0;
/// Returns true if feature and all its attributes are valid.
- virtual bool validate(const boost::shared_ptr<ModelAPI_Feature>& theFeature) const = 0;
+ virtual bool validate(const std::shared_ptr<ModelAPI_Feature>& theFeature) const = 0;
/// register that this attribute in feature is not obligatory for the feature execution
/// so, it is not needed for the standard validation mechanism
void ModuleBase_IModule::sendOperation(ModuleBase_Operation* theOperation)
{
static Events_ID aModuleEvent = Events_Loop::eventByName(EVENT_OPERATION_LAUNCHED);
- boost::shared_ptr<Config_PointerMessage> aMessage =
- boost::shared_ptr<Config_PointerMessage>(new Config_PointerMessage(aModuleEvent, this));
+ std::shared_ptr<Config_PointerMessage> aMessage =
+ std::shared_ptr<Config_PointerMessage>(new Config_PointerMessage(aModuleEvent, this));
aMessage->setPointer(theOperation);
Events_Loop::loop()->send(aMessage);
}
#include <QObject>
-#include <boost/shared_ptr.hpp>
+#include <memory>
class Config_WidgetAPI;
class ModuleBase_WidgetValue;
if (theCompositeFeature) {
myFeature = theCompositeFeature->addFeature(getDescription()->operationId().toStdString());
} else {
- boost::shared_ptr<ModelAPI_Document> aDoc = document();
+ std::shared_ptr<ModelAPI_Document> aDoc = document();
myFeature = aDoc->addFeature(getDescription()->operationId().toStdString());
}
if (myFeature) { // TODO: generate an error if feature was not created
}
-boost::shared_ptr<ModelAPI_Document> ModuleBase_Operation::document() const
+std::shared_ptr<ModelAPI_Document> ModuleBase_Operation::document() const
{
return ModelAPI_Session::get()->moduleDocument();
}
double aX, anY;
if (getViewerPoint(aPrs, theViewer, aX, anY))
- aValue->setPoint(boost::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(aX, anY)));
+ aValue->setPoint(std::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(aX, anY)));
myPreSelection.append(aValue);
}
}
return false;
ModuleBase_WidgetValueFeature* aValue = new ModuleBase_WidgetValueFeature();
aValue->setObject(theFeature);
- aValue->setPoint(boost::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(theX, theY)));
+ aValue->setPoint(std::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(theX, theY)));
bool isApplyed = aActiveWgt->setValue(aValue);
delete aValue;
virtual bool canBeCommitted() const;
/// Returns pointer to the root document.
- boost::shared_ptr<ModelAPI_Document> document() const;
+ std::shared_ptr<ModelAPI_Document> document() const;
/// Set value to the active widget
/// \param theFeature the feature
ModuleBase_ResultPrs::ModuleBase_ResultPrs(ResultPtr theResult)
: AIS_Shape(TopoDS_Shape()), myResult(theResult), myIsSketchMode(false)
{
- boost::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(theResult);
- boost::shared_ptr<GeomAPI_PlanarEdges> aWirePtr =
- boost::dynamic_pointer_cast<GeomAPI_PlanarEdges>(aShapePtr);
+ std::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(theResult);
+ std::shared_ptr<GeomAPI_PlanarEdges> aWirePtr =
+ std::dynamic_pointer_cast<GeomAPI_PlanarEdges>(aShapePtr);
if (aWirePtr) {
if (aWirePtr->hasPlane() ) {
// If this is a wire with plane defined thin it is a sketch-like object
const Handle(Prs3d_Presentation)& thePresentation,
const Standard_Integer theMode)
{
- boost::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(myResult);
+ std::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(myResult);
if (!aShapePtr)
return;
myOriginalShape = aShapePtr->impl<TopoDS_Shape>();
TopoDS_Compound aComp;
aBuilder.MakeCompound(aComp);
aBuilder.Add(aComp, myOriginalShape);
- std::list<boost::shared_ptr<GeomAPI_Shape>>::const_iterator aIt;
+ std::list<std::shared_ptr<GeomAPI_Shape>>::const_iterator aIt;
for (aIt = myFacesList.cbegin(); aIt != myFacesList.cend(); ++aIt) {
TopoDS_Shape aFace = (*aIt)->impl<TopoDS_Shape>();
aBuilder.Add(aComp, aFace);
bool myIsSketchMode;
TopoDS_Shape myOriginalShape;
- std::list<boost::shared_ptr<GeomAPI_Shape> > myFacesList;
+ std::list<std::shared_ptr<GeomAPI_Shape> > myFacesList;
};
Handle(AIS_InteractiveObject) aAisObj =
Handle(AIS_InteractiveObject)::DownCast(theOwner->Selectable());
if (!aAisObj.IsNull()) {
- boost::shared_ptr<GeomAPI_AISObject> aAISObj = AISObjectPtr(new GeomAPI_AISObject());
+ std::shared_ptr<GeomAPI_AISObject> aAISObj = AISObjectPtr(new GeomAPI_AISObject());
aAISObj->setImpl(new Handle(AIS_InteractiveObject)(aAisObj));
ObjectPtr aObj = myWorkshop->findPresentedObject(aAISObj);
if (aObj) {
Handle(AIS_InteractiveObject) aAisObj =
Handle(AIS_InteractiveObject)::DownCast(theOwner->Selectable());
if (!aAisObj.IsNull()) {
- boost::shared_ptr<GeomAPI_AISObject> aAISObj = AISObjectPtr(new GeomAPI_AISObject());
+ std::shared_ptr<GeomAPI_AISObject> aAISObj = AISObjectPtr(new GeomAPI_AISObject());
aAISObj->setImpl(new Handle(AIS_InteractiveObject)(aAisObj));
ObjectPtr aObj = myWorkshop->findPresentedObject(aAISObj);
foreach (QString aType, myTypes) {
if (aType.toLower() == "construction") {
ResultConstructionPtr aConstr =
- boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aObj);
+ std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aObj);
return (aConstr != NULL);
} // ToDo: Process other types of objects
}
#include "ModuleBase.h"
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <TopoDS_Shape.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <AIS_InteractiveObject.hxx>
bool ModuleBase_WidgetBoolValue::storeValue() const
{
DataPtr aData = myFeature->data();
- boost::shared_ptr<ModelAPI_AttributeBoolean> aBool = aData->boolean(attributeID());
+ std::shared_ptr<ModelAPI_AttributeBoolean> aBool = aData->boolean(attributeID());
aBool->setValue(myCheckBox->isChecked());
updateObject(myFeature);
return true;
bool ModuleBase_WidgetBoolValue::restoreValue()
{
DataPtr aData = myFeature->data();
- boost::shared_ptr<ModelAPI_AttributeBoolean> aRef = aData->boolean(attributeID());
+ std::shared_ptr<ModelAPI_AttributeBoolean> aRef = aData->boolean(attributeID());
bool isBlocked = myCheckBox->blockSignals(true);
myCheckBox->setChecked(aRef->value());
bool ModuleBase_WidgetChoice::storeValue() const
{
DataPtr aData = myFeature->data();
- boost::shared_ptr<ModelAPI_AttributeInteger> aIntAttr = aData->integer(attributeID());
+ std::shared_ptr<ModelAPI_AttributeInteger> aIntAttr = aData->integer(attributeID());
aIntAttr->setValue(myCombo->currentIndex());
updateObject(myFeature);
bool ModuleBase_WidgetChoice::restoreValue()
{
DataPtr aData = myFeature->data();
- boost::shared_ptr<ModelAPI_AttributeInteger> aIntAttr = aData->integer(attributeID());
+ std::shared_ptr<ModelAPI_AttributeInteger> aIntAttr = aData->integer(attributeID());
bool isBlocked = myCombo->blockSignals(true);
myCombo->setCurrentIndex(aIntAttr->value());
bool ModuleBase_WidgetFeature::storeValue() const
{
- //FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(theObject);
+ //FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theObject);
if (!myObject)
return false;
- boost::shared_ptr<ModelAPI_Data> aData = myFeature->data();
- boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_Data> aData = myFeature->data();
+ std::shared_ptr<ModelAPI_AttributeRefAttr> aRef = std::dynamic_pointer_cast<
ModelAPI_AttributeRefAttr>(aData->attribute(attributeID()));
ModuleBase_WidgetFeature* that = (ModuleBase_WidgetFeature*) this;
bool ModuleBase_WidgetFeature::restoreValue()
{
- boost::shared_ptr<ModelAPI_Data> aData = myFeature->data();
- boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_Data> aData = myFeature->data();
+ std::shared_ptr<ModelAPI_AttributeRefAttr> aRef = std::dynamic_pointer_cast<
ModelAPI_AttributeRefAttr>(aData->attribute(attributeID()));
ObjectPtr anObjPtr = aRef->object();
if (aFeatureValue) {
ObjectPtr aObject = aFeatureValue->object();
- boost::shared_ptr<ModelAPI_Attribute> anAttribute = findAttribute(aFeatureValue);
+ std::shared_ptr<ModelAPI_Attribute> anAttribute = findAttribute(aFeatureValue);
if (anAttribute) {
isDone = setAttribute(anAttribute, false);
}
bool ModuleBase_WidgetFeatureOrAttribute::storeValue() const
{
- //FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(theFeature);
+ //FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theFeature);
//if (!aFeature)
// return false;
- boost::shared_ptr<ModelAPI_Data> aData = myFeature->data();
- boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_Data> aData = myFeature->data();
+ std::shared_ptr<ModelAPI_AttributeRefAttr> aRef = std::dynamic_pointer_cast<
ModelAPI_AttributeRefAttr>(aData->attribute(attributeID()));
if (myObject)
bool ModuleBase_WidgetFeatureOrAttribute::restoreValue()
{
- boost::shared_ptr<ModelAPI_Data> aData = myFeature->data();
- boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_Data> aData = myFeature->data();
+ std::shared_ptr<ModelAPI_AttributeRefAttr> aRef = std::dynamic_pointer_cast<
ModelAPI_AttributeRefAttr>(aData->attribute(attributeID()));
ObjectPtr aObj = aRef->object();
return false;
}
-boost::shared_ptr<ModelAPI_Attribute> ModuleBase_WidgetFeatureOrAttribute::findAttribute(
+std::shared_ptr<ModelAPI_Attribute> ModuleBase_WidgetFeatureOrAttribute::findAttribute(
ModuleBase_WidgetValue* theValue)
{
- boost::shared_ptr<ModelAPI_Attribute> anAttribute;
+ std::shared_ptr<ModelAPI_Attribute> anAttribute;
ModuleBase_WidgetValueFeature* aFeatureValue =
dynamic_cast<ModuleBase_WidgetValueFeature*>(theValue);
if (!aFeatureValue)
return anAttribute;
- boost::shared_ptr<GeomAPI_Pnt2d> aValuePoint = aFeatureValue->point();
+ std::shared_ptr<GeomAPI_Pnt2d> aValuePoint = aFeatureValue->point();
if (aValuePoint) {
ObjectPtr aObject = aFeatureValue->object();
FeaturePtr aFeature = ModelAPI_Feature::feature(aObject);
if (aFeature) {
// find the given point in the feature attributes
- std::list<boost::shared_ptr<ModelAPI_Attribute> > anAttiributes = aFeature->data()
+ std::list<std::shared_ptr<ModelAPI_Attribute> > anAttiributes = aFeature->data()
->attributes(GeomDataAPI_Point2D::type());
- std::list<boost::shared_ptr<ModelAPI_Attribute> >::const_iterator anIt = anAttiributes
+ std::list<std::shared_ptr<ModelAPI_Attribute> >::const_iterator anIt = anAttiributes
.begin(), aLast = anAttiributes.end();
for (; anIt != aLast && !anAttribute; anIt++) {
- boost::shared_ptr<GeomDataAPI_Point2D> aCurPoint = boost::dynamic_pointer_cast<
+ std::shared_ptr<GeomDataAPI_Point2D> aCurPoint = std::dynamic_pointer_cast<
GeomDataAPI_Point2D>(*anIt);
if (aCurPoint && aCurPoint->pnt()->distance(aValuePoint) < Precision::Confusion())
anAttribute = aCurPoint;
}
bool ModuleBase_WidgetFeatureOrAttribute::setAttribute(
- const boost::shared_ptr<ModelAPI_Attribute>& theAttribute, bool theSendEvent)
+ const std::shared_ptr<ModelAPI_Attribute>& theAttribute, bool theSendEvent)
{
if (!theAttribute) // || !featureKinds().contains(theAttribute->attributeType().c_str()))
return false;
/// Returns the feature attribute if it can be found by the given value
/// \param theValue the widget value
/// \return an attribute or null
- boost::shared_ptr<ModelAPI_Attribute> findAttribute(ModuleBase_WidgetValue* theValue);
+ std::shared_ptr<ModelAPI_Attribute> findAttribute(ModuleBase_WidgetValue* theValue);
/// Set the attribute
/// \param theAttribute value
/// \return the boolean result of the attribute set
- bool setAttribute(const boost::shared_ptr<ModelAPI_Attribute>& theAttribute, bool theSendEvent =
+ bool setAttribute(const std::shared_ptr<ModelAPI_Attribute>& theAttribute, bool theSendEvent =
true);
protected:
- boost::shared_ptr<ModelAPI_Attribute> myAttribute; /// < the attribute
+ std::shared_ptr<ModelAPI_Attribute> myAttribute; /// < the attribute
};
#endif
#include <QString>
#include <QLabel>
-#include <boost/smart_ptr/shared_ptr.hpp>
+#include <memory>
#include <string>
ModuleBase_WidgetFileSelector::ModuleBase_WidgetFileSelector(QWidget* theParent,
#include <QObject>
#include <QString>
-#include <boost/smart_ptr/shared_ptr.hpp>
+#include <memory>
#include <string>
ModuleBase_WidgetLineEdit::ModuleBase_WidgetLineEdit(QWidget* theParent,
#include <QComboBox>
#include <QEvent>
-#include <boost/smart_ptr/shared_ptr.hpp>
+#include <memory>
#include <string>
ModuleBase_WidgetMultiSelector::ModuleBase_WidgetMultiSelector(QWidget* theParent,
return false;
DataPtr aData = myFeature->data();
AttributeSelectionListPtr aSelectionListAttr =
- boost::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(aData->attribute(attributeID()));
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(aData->attribute(attributeID()));
if (aSelectionListAttr) {
aSelectionListAttr->clear();
return false;
DataPtr aData = myFeature->data();
AttributeSelectionListPtr aSelectionListAttr =
- boost::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(aData->attribute(attributeID()));
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(aData->attribute(attributeID()));
if (aSelectionListAttr) {
mySelection.clear();
NCollection_List<TopoDS_Shape>::Iterator aShpIt(aSelectedShapes);
GeomShapePtr aShape;
for (aIt = aOwnersList.cbegin(); aIt != aOwnersList.cend(); aShpIt.Next(), aIt++) {
- ResultPtr aResult = boost::dynamic_pointer_cast<ModelAPI_Result>(*aIt);
+ ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(*aIt);
if (myFeature) {
// We can not select a result of our feature
const std::list<ResultPtr>& aResList = myFeature->results();
if(isSkipSelf)
continue;
}
- aShape = boost::shared_ptr<GeomAPI_Shape>(new GeomAPI_Shape());
+ aShape = std::shared_ptr<GeomAPI_Shape>(new GeomAPI_Shape());
aShape->setImpl(new TopoDS_Shape(aShpIt.Value()));
mySelection.append(GeomSelection(aResult, aShape));
}
ModuleBase_WidgetValueFeature* aFeatureValue =
dynamic_cast<ModuleBase_WidgetValueFeature*>(theValue);
if (aFeatureValue) {
- boost::shared_ptr<GeomAPI_Pnt2d> aPoint = aFeatureValue->point();
+ std::shared_ptr<GeomAPI_Pnt2d> aPoint = aFeatureValue->point();
if (aPoint) {
setPoint(aPoint);
isDone = true;
return isDone;
}
-void ModuleBase_WidgetPoint2D::setPoint(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint)
+void ModuleBase_WidgetPoint2D::setPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint)
{
bool isBlocked = this->blockSignals(true);
bool ModuleBase_WidgetPoint2D::storeValue() const
{
- boost::shared_ptr<ModelAPI_Data> aData = myFeature->data();
- boost::shared_ptr<GeomDataAPI_Point2D> aPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ std::shared_ptr<ModelAPI_Data> aData = myFeature->data();
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aData->attribute(attributeID()));
ModuleBase_WidgetPoint2D* that = (ModuleBase_WidgetPoint2D*) this;
bool ModuleBase_WidgetPoint2D::restoreValue()
{
- boost::shared_ptr<ModelAPI_Data> aData = myFeature->data();
- boost::shared_ptr<GeomDataAPI_Point2D> aPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ std::shared_ptr<ModelAPI_Data> aData = myFeature->data();
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aData->attribute(attributeID()));
#ifdef _DEBUG
{
if (myOptionParam.length() == 0)
return false;
- boost::shared_ptr<ModelAPI_Data> aData = theObject->data();
- boost::shared_ptr<GeomDataAPI_Point2D> aPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ std::shared_ptr<ModelAPI_Data> aData = theObject->data();
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aData->attribute(myOptionParam));
if (aPoint) {
bool isBlocked = this->blockSignals(true);
protected:
/// Fill the widget values by given point
/// \param thePoint the point
- void setPoint(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint);
+ void setPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
private:
QGroupBox* myGroupBox; ///< the parent group box for all intenal widgets
ModuleBase_WidgetValueFeature* aFeatureValue =
dynamic_cast<ModuleBase_WidgetValueFeature*>(theValue);
if (aFeatureValue) {
- boost::shared_ptr<GeomAPI_Pnt2d> aPnt = aFeatureValue->point();
+ std::shared_ptr<GeomAPI_Pnt2d> aPnt = aFeatureValue->point();
ObjectPtr aObject = aFeatureValue->object();
- FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(aObject);
+ FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObject);
if (aFeature && aPnt) {
setPoint(aFeature, aPnt);
isDone = true;
}
void ModuleBase_WidgetPoint2dDistance::setPoint(FeaturePtr theFeature,
- const boost::shared_ptr<GeomAPI_Pnt2d>& thePnt)
+ const std::shared_ptr<GeomAPI_Pnt2d>& thePnt)
{
- boost::shared_ptr<ModelAPI_Data> aData = theFeature->data();
- boost::shared_ptr<GeomDataAPI_Point2D> aPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ std::shared_ptr<ModelAPI_Data> aData = theFeature->data();
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aData->attribute(myFirstPntName));
if (!aPoint)
return;
protected:
/// Set the second point which defines a value in the widget as a distance with a first point defined by feature
- void setPoint(FeaturePtr theFeature, const boost::shared_ptr<GeomAPI_Pnt2d>& thePnt);
+ void setPoint(FeaturePtr theFeature, const std::shared_ptr<GeomAPI_Pnt2d>& thePnt);
private:
std::string myFirstPntName;
#include <TopExp_Explorer.hxx>
#include <TopoDS_Shape.hxx>
-#include <boost/smart_ptr/shared_ptr.hpp>
+#include <memory>
#include <list>
#include <string>
DataPtr aData = myFeature->data();
if (myUseSubShapes) {
- boost::shared_ptr<ModelAPI_AttributeSelection> aSelect =
- boost::dynamic_pointer_cast<ModelAPI_AttributeSelection>(aData->attribute(attributeID()));
+ std::shared_ptr<ModelAPI_AttributeSelection> aSelect =
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(aData->attribute(attributeID()));
- ResultPtr aBody = boost::dynamic_pointer_cast<ModelAPI_Result>(mySelectedObject);
+ ResultPtr aBody = std::dynamic_pointer_cast<ModelAPI_Result>(mySelectedObject);
if (aBody) {
aSelect->setValue(aBody, myShape);
updateObject(myFeature);
return true;
}
} else {
- boost::shared_ptr<ModelAPI_AttributeReference> aRef =
- boost::dynamic_pointer_cast<ModelAPI_AttributeReference>(aData->attribute(attributeID()));
+ std::shared_ptr<ModelAPI_AttributeReference> aRef =
+ std::dynamic_pointer_cast<ModelAPI_AttributeReference>(aData->attribute(attributeID()));
ObjectPtr aObject = aRef->value();
if (!(aObject && aObject->isSame(mySelectedObject))) {
DataPtr aData = myFeature->data();
bool isBlocked = this->blockSignals(true);
if (myUseSubShapes) {
- boost::shared_ptr<ModelAPI_AttributeSelection> aSelect = aData->selection(attributeID());
+ std::shared_ptr<ModelAPI_AttributeSelection> aSelect = aData->selection(attributeID());
if (aSelect) {
mySelectedObject = aSelect->context();
myShape = aSelect->value();
}
} else {
- boost::shared_ptr<ModelAPI_AttributeReference> aRef = aData->reference(attributeID());
+ std::shared_ptr<ModelAPI_AttributeReference> aRef = aData->reference(attributeID());
mySelectedObject = aRef->value();
}
updateSelectionName();
return;
// Check that the selected object is result (others can not be accepted)
- ResultPtr aRes = boost::dynamic_pointer_cast<ModelAPI_Result>(aObject);
+ ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(aObject);
if (!aRes)
return;
if (myFeature) {
// We can not select a result of our feature
- const std::list<boost::shared_ptr<ModelAPI_Result>>& aResList = myFeature->results();
- std::list<boost::shared_ptr<ModelAPI_Result> >::const_iterator aIt;
+ const std::list<std::shared_ptr<ModelAPI_Result>>& aResList = myFeature->results();
+ std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aIt;
for (aIt = aResList.cbegin(); aIt != aResList.cend(); ++aIt) {
if ((*aIt) == aRes)
return;
std::list<ObjectPtr> aOwners;
myWorkshop->selection()->selectedShapes(aShapeList, aOwners);
if (aShapeList.Extent() > 0) {
- aShape = boost::shared_ptr<GeomAPI_Shape>(new GeomAPI_Shape());
+ aShape = std::shared_ptr<GeomAPI_Shape>(new GeomAPI_Shape());
aShape->setImpl(new TopoDS_Shape(aShapeList.First()));
}
}
}
//********************************************************************
-void ModuleBase_WidgetShapeSelector::setObject(ObjectPtr theObj, boost::shared_ptr<GeomAPI_Shape> theShape)
+void ModuleBase_WidgetShapeSelector::setObject(ObjectPtr theObj, std::shared_ptr<GeomAPI_Shape> theShape)
{
mySelectedObject = theObj;
myShape = theShape;
//********************************************************************
bool ModuleBase_WidgetShapeSelector::acceptObjectShape(const ObjectPtr theResult) const
{
- ResultPtr aResult = boost::dynamic_pointer_cast<ModelAPI_Result>(theResult);
+ ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theResult);
// Check that the shape of necessary type
- boost::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(aResult);
+ std::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(aResult);
if (!aShapePtr)
return false;
TopoDS_Shape aShape = aShapePtr->impl<TopoDS_Shape>();
}
//********************************************************************
-bool ModuleBase_WidgetShapeSelector::acceptSubShape(boost::shared_ptr<GeomAPI_Shape> theShape) const
+bool ModuleBase_WidgetShapeSelector::acceptSubShape(std::shared_ptr<GeomAPI_Shape> theShape) const
{
TopoDS_Shape aShape = theShape->impl<TopoDS_Shape>();
foreach (QString aType, myShapeTypes) {
foreach (QString aType, myObjectTypes) {
if (aType.toLower() == "construction") {
ResultConstructionPtr aConstr =
- boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(theObject);
+ std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(theObject);
return (aConstr != NULL);
} // ToDo: Process other types of objects
}
/// Returns true if selected shape corresponds to requested shape types
/// This method is called only in sub-shapes selection mode
- virtual bool acceptSubShape(boost::shared_ptr<GeomAPI_Shape> theShape) const;
+ virtual bool acceptSubShape(std::shared_ptr<GeomAPI_Shape> theShape) const;
/// Returns true if selected object corresponds to requested Object type
/// Thid method is used in any selection mode
// Set the given object as a value of the widget
- void setObject(ObjectPtr theObj, boost::shared_ptr<GeomAPI_Shape> theShape = boost::shared_ptr<GeomAPI_Shape>());
+ void setObject(ObjectPtr theObj, std::shared_ptr<GeomAPI_Shape> theShape = std::shared_ptr<GeomAPI_Shape>());
//----------- Class members -------------
private:
ModuleBase_IWorkshop* myWorkshop;
ObjectPtr mySelectedObject;
- boost::shared_ptr<GeomAPI_Shape> myShape;
+ std::shared_ptr<GeomAPI_Shape> myShape;
QStringList myShapeTypes;
QStringList myObjectTypes;
return myResult;
}
-void ModuleBase_WidgetValueFeature::setPoint(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint)
+void ModuleBase_WidgetValueFeature::setPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint)
{
myPoint = thePoint;
}
-const boost::shared_ptr<GeomAPI_Pnt2d>& ModuleBase_WidgetValueFeature::point() const
+const std::shared_ptr<GeomAPI_Pnt2d>& ModuleBase_WidgetValueFeature::point() const
{
return myPoint;
}
#include <ModelAPI_Result.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
class GeomAPI_Pnt2d;
/// Fill the widget values by given point
/// \param thePoint the point
- MODULEBASE_EXPORT void setPoint(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint);
+ MODULEBASE_EXPORT void setPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
/// Returns the widget point
/// \return the current point
- MODULEBASE_EXPORT const boost::shared_ptr<GeomAPI_Pnt2d>& point() const;
+ MODULEBASE_EXPORT const std::shared_ptr<GeomAPI_Pnt2d>& point() const;
private:
ObjectPtr myResult;
- boost::shared_ptr<GeomAPI_Pnt2d> myPoint;
+ std::shared_ptr<GeomAPI_Pnt2d> myPoint;
};
#endif
}
//******************************************************
-void PartSet_Listener::processEvent(const boost::shared_ptr<Events_Message>& theMessage)
+void PartSet_Listener::processEvent(const std::shared_ptr<Events_Message>& theMessage)
{
ModuleBase_Operation* anOperation = myModule->xWorkshop()->operationMgr()->currentOperation();
PartSet_OperationSketchBase* aSketchOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
XGUI_Displayer* aDisplayer = myModule->xWorkshop()->displayer();
QString aType = QString(theMessage->eventID().eventText());
if (aType == EVENT_OBJECT_CREATED) {
- boost::shared_ptr<ModelAPI_ObjectUpdatedMessage> aUpdMsg =
- boost::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
+ std::shared_ptr<ModelAPI_ObjectUpdatedMessage> aUpdMsg =
+ std::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
std::set<ObjectPtr> aFeatures = aUpdMsg->objects();
PartSet_OperationSketch* aSketchOp =
XGUI_Displayer* aDisplayer = myModule->xWorkshop()->displayer();
FeaturePtr aFeature = aCreationOp->feature();
const std::list<ResultPtr>& aResults = aFeature->results();
- boost::shared_ptr<ModelAPI_ObjectUpdatedMessage> aUpdMsg =
- boost::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
+ std::shared_ptr<ModelAPI_ObjectUpdatedMessage> aUpdMsg =
+ std::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
std::set<ObjectPtr> aFeatures = aUpdMsg->objects();
std::set<ObjectPtr>::const_iterator aObjIt, aNoObj = aFeatures.cend();
}
}
} else if (aType == EVENT_OBJECT_DELETED) {
- boost::shared_ptr<ModelAPI_ObjectDeletedMessage> aDelMsg =
- boost::dynamic_pointer_cast<ModelAPI_ObjectDeletedMessage>(theMessage);
- boost::shared_ptr<ModelAPI_Document> aDoc = aDelMsg->document();
+ std::shared_ptr<ModelAPI_ObjectDeletedMessage> aDelMsg =
+ std::dynamic_pointer_cast<ModelAPI_ObjectDeletedMessage>(theMessage);
+ std::shared_ptr<ModelAPI_Document> aDoc = aDelMsg->document();
std::set<std::string> aGroups = aDelMsg->groups();
std::set<std::string>::const_iterator anIt = aGroups.begin(), aLast = aGroups.end();
virtual ~PartSet_Listener();
/// This method is called by loop when the event is started to process.
- virtual void processEvent(const boost::shared_ptr<Events_Message>& theMessage);
+ virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
private:
PartSet_Module* myModule; ///< the current module
{
QList<ObjectPtr> aFeatures = workshop()->selection()->selectedObjects();
if (theId == "EDIT_CMD" && (aFeatures.size() > 0)) {
- FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(aFeatures.first());
+ FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aFeatures.first());
if (aFeature)
editFeature(aFeature);
}
std::list<FeaturePtr>::const_iterator anIt = aList.begin(), aLast = aList.end();
for (; anIt != aLast; anIt++) {
- boost::shared_ptr<SketchPlugin_Feature> aSPFeature = boost::dynamic_pointer_cast<
+ std::shared_ptr<SketchPlugin_Feature> aSPFeature = std::dynamic_pointer_cast<
SketchPlugin_Feature>(*anIt);
if (!aSPFeature)
continue;
// if (theFeature->getKind() == SKETCH_KIND) {
//FeaturePtr aFeature = theFeature;
//if (XGUI_Tools::isModelObject(aFeature)) {
- // ObjectPtr aObject = boost::dynamic_pointer_cast<ModelAPI_Object>(aFeature);
+ // ObjectPtr aObject = std::dynamic_pointer_cast<ModelAPI_Object>(aFeature);
// aFeature = aObject->featureRef();
//}
void PartSet_Module::onStorePoint2D(ObjectPtr theFeature, const std::string& theAttribute)
{
- FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(theFeature);
+ FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theFeature);
PartSet_OperationSketchBase* aPreviewOp =
dynamic_cast<PartSet_OperationSketchBase*>(myWorkshop->currentOperation());
if (!aPreviewOp)
return;
- boost::shared_ptr<GeomDataAPI_Point2D> aPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aFeature->data()->attribute(theAttribute));
PartSet_Tools::setConstraints(aPreviewOp->sketch(), aFeature, theAttribute, aPoint->x(),
QIntList PartSet_Module::sketchSelectionModes(ObjectPtr theFeature)
{
QIntList aModes;
- FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(theFeature);
+ FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theFeature);
if (aFeature) {
if (aFeature->getKind() == SketchPlugin_Sketch::ID()) {
aModes.append(TopAbs_FACE);
gp_Pln PartSet_Module::getSketchPlane(FeaturePtr theSketch) const
{
DataPtr aData = theSketch->data();
- boost::shared_ptr<GeomDataAPI_Point> anOrigin = boost::dynamic_pointer_cast<GeomDataAPI_Point>(
+ std::shared_ptr<GeomDataAPI_Point> anOrigin = std::dynamic_pointer_cast<GeomDataAPI_Point>(
aData->attribute(SketchPlugin_Sketch::ORIGIN_ID()));
- boost::shared_ptr<GeomDataAPI_Dir> aNorm = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+ std::shared_ptr<GeomDataAPI_Dir> aNorm = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
aData->attribute(SketchPlugin_Sketch::NORM_ID()));
gp_Pnt aOrig(anOrigin->x(), anOrigin->y(), anOrigin->z());
gp_Dir aDir(aNorm->x(), aNorm->y(), aNorm->z());
#include <string>
-#include <boost/shared_ptr.hpp>
+#include <memory>
class PartSet_Listener;
class ModelAPI_Feature;
return false;
ModuleBase_WidgetValueFeature* aValue = new ModuleBase_WidgetValueFeature();
aValue->setObject(theFeature);
- aValue->setPoint(boost::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(theX, theY)));
+ aValue->setPoint(std::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(theX, theY)));
bool isApplyed = aActiveWgt->setValue(aValue);
delete aValue;
continue;
// append the attribute of the vertex if it is found on the current feature
- boost::shared_ptr<GeomDataAPI_Point2D> aPoint2D = PartSet_Tools::getFeaturePoint(
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint2D = PartSet_Tools::getFeaturePoint(
aFeature, aX, anY);
std::string anAttribute = aFeature->data()->id(aPoint2D);
std::list<std::string> aList;
// std::list<std::string> anAttributes = aFeatIter->second;
// // perform edit for the feature
// if (anAttributes.empty()) {
- // boost::shared_ptr<SketchPlugin_Feature> aSketchFeature =
- // boost::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
+ // std::shared_ptr<SketchPlugin_Feature> aSketchFeature =
+ // std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
// if (aSketchFeature) {
// aSketchFeature->move(aDeltaX, aDeltaY);
// }
// std::list<std::string>::const_iterator anAttrIter = anAttributes.begin(),
// anAttrEnd = anAttributes.end();
// for (; anAttrIter != anAttrEnd; anAttrIter++) {
- // boost::shared_ptr<GeomDataAPI_Point2D> aPointAttr = boost::dynamic_pointer_cast<
+ // std::shared_ptr<GeomDataAPI_Point2D> aPointAttr = std::dynamic_pointer_cast<
// GeomDataAPI_Point2D>(aFeature->data()->attribute(*anAttrIter));
// if (aPointAttr) {
// aPointAttr->move(aDeltaX, aDeltaY);
//}
//else { // multieditoperation
- //boost::shared_ptr<SketchPlugin_Feature> aSketchFeature = boost::dynamic_pointer_cast<
+ //std::shared_ptr<SketchPlugin_Feature> aSketchFeature = std::dynamic_pointer_cast<
// SketchPlugin_Feature>(feature());
bool isMoved = false;
std::list<std::string> anAttributes = aFeatIter->second;
// perform edit for the feature
if (anAttributes.empty()) {
- boost::shared_ptr<SketchPlugin_Feature> aSketchFeature =
- boost::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
+ std::shared_ptr<SketchPlugin_Feature> aSketchFeature =
+ std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
if (aSketchFeature) {
aSketchFeature->move(aDeltaX, aDeltaY);
isMoved = true;
std::list<std::string>::const_iterator anAttrIter = anAttributes.begin(),
anAttrEnd = anAttributes.end();
for (; anAttrIter != anAttrEnd; anAttrIter++) {
- boost::shared_ptr<GeomDataAPI_Point2D> aPointAttr = boost::dynamic_pointer_cast<
+ std::shared_ptr<GeomDataAPI_Point2D> aPointAttr = std::dynamic_pointer_cast<
GeomDataAPI_Point2D>(aFeature->data()->attribute(*anAttrIter));
if (aPointAttr) {
aPointAttr->move(aDeltaX, aDeltaY);
CompositeFeaturePtr PartSet_OperationSketch::sketch() const
{
- return boost::dynamic_pointer_cast<ModelAPI_CompositeFeature>(feature());
+ return std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(feature());
}
void PartSet_OperationSketch::mousePressed(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer, ModuleBase_ISelection* theSelection)
// We have to select a plane before any operation
TopoDS_Shape aShape = aPrs.shape();
if (!aShape.IsNull()) {
- boost::shared_ptr<GeomAPI_Dir> aDir = setSketchPlane(aShape);
+ std::shared_ptr<GeomAPI_Dir> aDir = setSketchPlane(aShape);
flushUpdated();
emit featureConstructed(feature(), FM_Hide);
// If selection is not a sketcher presentation then it has to be stored as
// External shape
if (feature() != aPrs.object()) {
- //boost::shared_ptr<SketchPlugin_Sketch> aSketch =
- // boost::dynamic_pointer_cast<SketchPlugin_Sketch>(feature());
+ //std::shared_ptr<SketchPlugin_Sketch> aSketch =
+ // std::dynamic_pointer_cast<SketchPlugin_Sketch>(feature());
DataPtr aData = feature()->data();
AttributeSelectionPtr aSelAttr =
- boost::dynamic_pointer_cast<ModelAPI_AttributeSelection>
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelection>
(aData->attribute(SketchPlugin_Feature::EXTERNAL_ID()));
if (aSelAttr) {
- ResultPtr aRes = boost::dynamic_pointer_cast<ModelAPI_Result>(aPrs.object());
+ ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(aPrs.object());
if (aRes) {
GeomShapePtr aShapePtr(new GeomAPI_Shape());
aShapePtr->setImpl(new TopoDS_Shape(aShape));
if (!aFeature)
return aFeaList;
- boost::shared_ptr<ModelAPI_Data> aData = aFeature->data();
+ std::shared_ptr<ModelAPI_Data> aData = aFeature->data();
if (!aData->isValid())
return std::list<FeaturePtr>();
- boost::shared_ptr<ModelAPI_AttributeRefList> aRefList = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_AttributeRefList> aRefList = std::dynamic_pointer_cast<
ModelAPI_AttributeRefList>(aData->attribute(SketchPlugin_Sketch::FEATURES_ID()));
std::list<ObjectPtr> aList = aRefList->list();
std::list<ObjectPtr>::iterator aIt;
for (aIt = aList.begin(); aIt != aList.end(); ++aIt) {
- FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(*aIt);
+ FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(*aIt);
if (aFeature)
aFeaList.push_back(aFeature);
}
bool aHasPlane = false;
if (feature()) {
- boost::shared_ptr<ModelAPI_Data> aData = feature()->data();
+ std::shared_ptr<ModelAPI_Data> aData = feature()->data();
AttributeDoublePtr anAttr;
- boost::shared_ptr<GeomDataAPI_Dir> aNormal = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+ std::shared_ptr<GeomDataAPI_Dir> aNormal = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
aData->attribute(SketchPlugin_Sketch::NORM_ID()));
aHasPlane = aNormal && !(aNormal->x() == 0 && aNormal->y() == 0 && aNormal->z() == 0);
}
return aHasPlane;
}
-boost::shared_ptr<GeomAPI_Dir> PartSet_OperationSketch::setSketchPlane(const TopoDS_Shape& theShape)
+std::shared_ptr<GeomAPI_Dir> PartSet_OperationSketch::setSketchPlane(const TopoDS_Shape& theShape)
{
if (theShape.IsNull())
- return boost::shared_ptr<GeomAPI_Dir>();
+ return std::shared_ptr<GeomAPI_Dir>();
// get selected shape
- boost::shared_ptr<GeomAPI_Shape> aGShape(new GeomAPI_Shape);
+ std::shared_ptr<GeomAPI_Shape> aGShape(new GeomAPI_Shape);
aGShape->setImpl(new TopoDS_Shape(theShape));
// get plane parameters
- boost::shared_ptr<GeomAPI_Pln> aPlane = GeomAlgoAPI_FaceBuilder::plane(aGShape);
+ std::shared_ptr<GeomAPI_Pln> aPlane = GeomAlgoAPI_FaceBuilder::plane(aGShape);
// set plane parameters to feature
- boost::shared_ptr<ModelAPI_Data> aData = feature()->data();
+ std::shared_ptr<ModelAPI_Data> aData = feature()->data();
double anA, aB, aC, aD;
aPlane->coefficients(anA, aB, aC, aD);
// calculate attributes of the sketch
- boost::shared_ptr<GeomAPI_Dir> aNormDir(new GeomAPI_Dir(anA, aB, aC));
- boost::shared_ptr<GeomAPI_XYZ> aCoords = aNormDir->xyz();
- boost::shared_ptr<GeomAPI_XYZ> aZero(new GeomAPI_XYZ(0, 0, 0));
+ std::shared_ptr<GeomAPI_Dir> aNormDir(new GeomAPI_Dir(anA, aB, aC));
+ std::shared_ptr<GeomAPI_XYZ> aCoords = aNormDir->xyz();
+ std::shared_ptr<GeomAPI_XYZ> aZero(new GeomAPI_XYZ(0, 0, 0));
aCoords = aCoords->multiplied(-aD * aCoords->distance(aZero));
- boost::shared_ptr<GeomAPI_Pnt> anOrigPnt(new GeomAPI_Pnt(aCoords));
+ std::shared_ptr<GeomAPI_Pnt> anOrigPnt(new GeomAPI_Pnt(aCoords));
// X axis is preferable to be dirX on the sketch
const double tol = Precision::Confusion();
bool isX = fabs(anA - 1.0) < tol && fabs(aB) < tol && fabs(aC) < tol;
- boost::shared_ptr<GeomAPI_Dir> aTempDir(
+ std::shared_ptr<GeomAPI_Dir> aTempDir(
isX ? new GeomAPI_Dir(0, 1, 0) : new GeomAPI_Dir(1, 0, 0));
- boost::shared_ptr<GeomAPI_Dir> aYDir(new GeomAPI_Dir(aNormDir->cross(aTempDir)));
- boost::shared_ptr<GeomAPI_Dir> aXDir(new GeomAPI_Dir(aYDir->cross(aNormDir)));
+ std::shared_ptr<GeomAPI_Dir> aYDir(new GeomAPI_Dir(aNormDir->cross(aTempDir)));
+ std::shared_ptr<GeomAPI_Dir> aXDir(new GeomAPI_Dir(aYDir->cross(aNormDir)));
- boost::shared_ptr<GeomDataAPI_Point> anOrigin = boost::dynamic_pointer_cast<GeomDataAPI_Point>(
+ std::shared_ptr<GeomDataAPI_Point> anOrigin = std::dynamic_pointer_cast<GeomDataAPI_Point>(
aData->attribute(SketchPlugin_Sketch::ORIGIN_ID()));
anOrigin->setValue(anOrigPnt);
- boost::shared_ptr<GeomDataAPI_Dir> aNormal = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+ std::shared_ptr<GeomDataAPI_Dir> aNormal = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
aData->attribute(SketchPlugin_Sketch::NORM_ID()));
aNormal->setValue(aNormDir);
- boost::shared_ptr<GeomDataAPI_Dir> aDirX = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+ std::shared_ptr<GeomDataAPI_Dir> aDirX = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
aData->attribute(SketchPlugin_Sketch::DIRX_ID()));
aDirX->setValue(aXDir);
- boost::shared_ptr<GeomDataAPI_Dir> aDirY = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+ std::shared_ptr<GeomDataAPI_Dir> aDirY = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
aData->attribute(SketchPlugin_Sketch::DIRY_ID()));
aDirY->setValue(aYDir);
- boost::shared_ptr<GeomAPI_Dir> aDir = aPlane->direction();
+ std::shared_ptr<GeomAPI_Dir> aDir = aPlane->direction();
return aDir;
}
/// Set the plane to the current sketch
/// \param theShape the shape
/// \return selected direction
- boost::shared_ptr<GeomAPI_Dir> setSketchPlane(const TopoDS_Shape& theShape);
+ std::shared_ptr<GeomAPI_Dir> setSketchPlane(const TopoDS_Shape& theShape);
/// Called on selection changed when the operation is active
virtual void selectionChanged(ModuleBase_ISelection* theSelection);
{
}
-boost::shared_ptr<GeomAPI_Shape> PartSet_OperationSketchBase::preview(FeaturePtr theFeature)
+std::shared_ptr<GeomAPI_Shape> PartSet_OperationSketchBase::preview(FeaturePtr theFeature)
{
- boost::shared_ptr<SketchPlugin_Feature> aFeature = boost::dynamic_pointer_cast<
+ std::shared_ptr<SketchPlugin_Feature> aFeature = std::dynamic_pointer_cast<
SketchPlugin_Feature>(theFeature);
if (aFeature) {
ResultPtr aRes = aFeature->firstResult();
- ResultBodyPtr aBody = boost::dynamic_pointer_cast<ModelAPI_ResultBody>(aRes);
+ ResultBodyPtr aBody = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aRes);
if (aBody)
return aBody->shape();
}
- return boost::shared_ptr<GeomAPI_Shape>();
+ return std::shared_ptr<GeomAPI_Shape>();
}
std::list<FeaturePtr> PartSet_OperationSketchBase::subFeatures() const
/// Returns the feature preview shape
/// \param theFeature the feature object to obtain the preview
- static boost::shared_ptr<GeomAPI_Shape> preview(FeaturePtr theFeature);
+ static std::shared_ptr<GeomAPI_Shape> preview(FeaturePtr theFeature);
/// Returns the list of the nested features
/// \return the list of subfeatures
theWorkshop->viewer()->activeView());
PartSet_TestOCC::changeTestLine(theWorkshop);
}
- boost::shared_ptr<GeomAPI_AISObject> anIO = theWorkshop->displayer()->getAISObject(myTestObject);
+ std::shared_ptr<GeomAPI_AISObject> anIO = theWorkshop->displayer()->getAISObject(myTestObject);
if (!anIO->empty()) {
theWorkshop->viewer()->AISContext()->MoveTo(0, 0, theWorkshop->viewer()->activeView());
theWorkshop->viewer()->AISContext()->Select(0, 0, 2500, 2500,
if (aPreviewOp) {
// create a line
- boost::shared_ptr<ModelAPI_Document> aDoc = ModelAPI_Session::get()->moduleDocument();
+ std::shared_ptr<ModelAPI_Document> aDoc = ModelAPI_Session::get()->moduleDocument();
FeaturePtr aFeature = aDoc->addFeature(SketchPlugin_Line::ID());
if (aFeature) // TODO: generate an error if feature was not created
aFeature->execute();
- boost::shared_ptr<SketchPlugin_Feature> aSketch = boost::dynamic_pointer_cast<
+ std::shared_ptr<SketchPlugin_Feature> aSketch = std::dynamic_pointer_cast<
SketchPlugin_Feature>(aPreviewOp->sketch());
aSketch->addSub(aFeature);
PartSet_Tools::setFeaturePoint(aFeature, 100, 100, SketchPlugin_Line::START_ID());
PartSet_Tools::setFeaturePoint(aFeature, 150, 300, SketchPlugin_Line::END_ID());
- boost::shared_ptr<GeomAPI_Shape> aPreview = PartSet_OperationSketchBase::preview(aFeature);
+ std::shared_ptr<GeomAPI_Shape> aPreview = PartSet_OperationSketchBase::preview(aFeature);
XGUI_Displayer* aDisplayer = theWorkshop->displayer();
- boost::shared_ptr<GeomAPI_AISObject> aPrevAIS;
- boost::shared_ptr<SketchPlugin_Feature> aSPFeature = boost::dynamic_pointer_cast<
+ std::shared_ptr<GeomAPI_AISObject> aPrevAIS;
+ std::shared_ptr<SketchPlugin_Feature> aSPFeature = std::dynamic_pointer_cast<
SketchPlugin_Feature>(aFeature);
- //boost::shared_ptr<GeomAPI_AISObject> anAIS = aSPFeature->getAISObject(aPrevAIS);
+ //std::shared_ptr<GeomAPI_AISObject> anAIS = aSPFeature->getAISObject(aPrevAIS);
//if (!anAIS->empty())
aDisplayer->display(aFeature, false);
//aDisplayer->redisplay(aFeature->firstResult(), anAIS, false);
PartSet_Tools::setFeaturePoint(aFeature, 100+aDelta, 200+aDelta, SketchPlugin_Line::START_ID());
PartSet_Tools::setFeaturePoint(aFeature, 300+aDelta, 500+aDelta, SketchPlugin_Line::END_ID());
- boost::shared_ptr<GeomAPI_Shape> aPreview = PartSet_OperationSketchBase::preview(aFeature);
+ std::shared_ptr<GeomAPI_Shape> aPreview = PartSet_OperationSketchBase::preview(aFeature);
Handle(AIS_InteractiveObject) anAIS = PartSet_Presentation::createPresentation(
aFeature, aSketch,
aPreview ? aPreview->impl<TopoDS_Shape>() : TopoDS_Shape(), NULL);
// TODO
//PartSet_Tools::setFeaturePoint(aFeature, -100/*aDelta*/, -100/*aDelta*/, LINE_ATTR_START);
//PartSet_Tools::setFeaturePoint(aFeature, 200/*aDelta*2*/, 200/*aDelta*2*/, LINE_ATTR_END);
- //boost::shared_ptr<GeomAPI_Shape> aPreview = PartSet_OperationSketchBase::preview(aFeature);
+ //std::shared_ptr<GeomAPI_Shape> aPreview = PartSet_OperationSketchBase::preview(aFeature);
- boost::shared_ptr<GeomAPI_AISObject> aPrevAIS;
- boost::shared_ptr<SketchPlugin_Feature> aSPFeature = boost::dynamic_pointer_cast<
+ std::shared_ptr<GeomAPI_AISObject> aPrevAIS;
+ std::shared_ptr<SketchPlugin_Feature> aSPFeature = std::dynamic_pointer_cast<
SketchPlugin_Feature>(aFeature);
- //boost::shared_ptr<GeomAPI_AISObject> anAIS = aSPFeature->getAISObject(aPrevAIS);
+ //std::shared_ptr<GeomAPI_AISObject> anAIS = aSPFeature->getAISObject(aPrevAIS);
//if (!anAIS->empty())
theWorkshop->displayer()->display(aFeature, true);
// theWorkshop->displayer()->redisplay(aFeature, anAIS, true);
return;
AttributeDoublePtr anAttr;
- boost::shared_ptr<ModelAPI_Data> aData = theSketch->data();
+ std::shared_ptr<ModelAPI_Data> aData = theSketch->data();
- boost::shared_ptr<GeomDataAPI_Point> anOrigin = boost::dynamic_pointer_cast<GeomDataAPI_Point>(
+ std::shared_ptr<GeomDataAPI_Point> anOrigin = std::dynamic_pointer_cast<GeomDataAPI_Point>(
aData->attribute(SketchPlugin_Sketch::ORIGIN_ID()));
- boost::shared_ptr<GeomDataAPI_Dir> aX = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+ std::shared_ptr<GeomDataAPI_Dir> aX = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
aData->attribute(SketchPlugin_Sketch::DIRX_ID()));
- boost::shared_ptr<GeomDataAPI_Dir> anY = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+ std::shared_ptr<GeomDataAPI_Dir> anY = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
aData->attribute(SketchPlugin_Sketch::DIRY_ID()));
gp_Pnt anOriginPnt(anOrigin->x(), anOrigin->y(), anOrigin->z());
gp_Vec anEyeVec(EyePoint, AtPoint);
anEyeVec.Normalize();
- boost::shared_ptr<GeomDataAPI_Dir> aNormal = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+ std::shared_ptr<GeomDataAPI_Dir> aNormal = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
aData->attribute(SketchPlugin_Sketch::NORM_ID()));
gp_Vec aNormalVec(aNormal->x(), aNormal->y(), aNormal->z());
if (!theSketch)
return;
- boost::shared_ptr<ModelAPI_Data> aData = theSketch->data();
+ std::shared_ptr<ModelAPI_Data> aData = theSketch->data();
- boost::shared_ptr<GeomDataAPI_Point> aC = boost::dynamic_pointer_cast<GeomDataAPI_Point>(
+ std::shared_ptr<GeomDataAPI_Point> aC = std::dynamic_pointer_cast<GeomDataAPI_Point>(
aData->attribute(SketchPlugin_Sketch::ORIGIN_ID()));
- boost::shared_ptr<GeomDataAPI_Dir> aX = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+ std::shared_ptr<GeomDataAPI_Dir> aX = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
aData->attribute(SketchPlugin_Sketch::DIRX_ID()));
- boost::shared_ptr<GeomDataAPI_Dir> aY = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+ std::shared_ptr<GeomDataAPI_Dir> aY = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
aData->attribute(SketchPlugin_Sketch::DIRY_ID()));
- boost::shared_ptr<GeomAPI_XYZ> aSum = aC->pnt()->xyz()->added(aX->dir()->xyz()->multiplied(theX))
+ std::shared_ptr<GeomAPI_XYZ> aSum = aC->pnt()->xyz()->added(aX->dir()->xyz()->multiplied(theX))
->added(aY->dir()->xyz()->multiplied(theY));
- boost::shared_ptr<GeomAPI_Pnt> aPoint = boost::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aSum));
+ std::shared_ptr<GeomAPI_Pnt> aPoint = std::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aSum));
thePoint = gp_Pnt(aPoint->x(), aPoint->y(), aPoint->z());
}
ObjectPtr aDeltaObject;
CompositeFeaturePtr aSketch =
- boost::dynamic_pointer_cast<ModelAPI_CompositeFeature>(theSketch);
+ std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(theSketch);
// 1. find it in the selected list by the selected point
if (!aDeltaObject) {
double aX, anY;
if (!aPrs.object())
continue;
FeaturePtr aFeature = ModelAPI_Feature::feature(aPrs.object());
- boost::shared_ptr<SketchPlugin_Feature> aSketchFeature = boost::dynamic_pointer_cast<
+ std::shared_ptr<SketchPlugin_Feature> aSketchFeature = std::dynamic_pointer_cast<
SketchPlugin_Feature>(aFeature);
if (!aSketchFeature || !aSketch->isSub(aSketchFeature))
continue;
double aDelta = aSketchFeature->distanceToPoint(
- boost::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(aX, anY)));
+ std::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(aX, anY)));
if (aMinDelta < 0 || aMinDelta > aDelta) {
aMinDelta = aDelta;
// TODO aDeltaObject = aPrs.result();
return aDeltaObject;
}
-boost::shared_ptr<ModelAPI_Document> PartSet_Tools::document()
+std::shared_ptr<ModelAPI_Document> PartSet_Tools::document()
{
return ModelAPI_Session::get()->moduleDocument();
}
-boost::shared_ptr<GeomDataAPI_Point2D> PartSet_Tools::getFeaturePoint(FeaturePtr theFeature,
+std::shared_ptr<GeomDataAPI_Point2D> PartSet_Tools::getFeaturePoint(FeaturePtr theFeature,
double theX, double theY)
{
- boost::shared_ptr<GeomAPI_Pnt2d> aClickedPoint = boost::shared_ptr<GeomAPI_Pnt2d>(
+ std::shared_ptr<GeomAPI_Pnt2d> aClickedPoint = std::shared_ptr<GeomAPI_Pnt2d>(
new GeomAPI_Pnt2d(theX, theY));
- std::list<boost::shared_ptr<ModelAPI_Attribute> > anAttiributes =
+ std::list<std::shared_ptr<ModelAPI_Attribute> > anAttiributes =
theFeature->data()->attributes(GeomDataAPI_Point2D::type());
- std::list<boost::shared_ptr<ModelAPI_Attribute> >::const_iterator anIt = anAttiributes.begin(),
+ std::list<std::shared_ptr<ModelAPI_Attribute> >::const_iterator anIt = anAttiributes.begin(),
aLast = anAttiributes.end();
- boost::shared_ptr<GeomDataAPI_Point2D> aFPoint;
+ std::shared_ptr<GeomDataAPI_Point2D> aFPoint;
for (; anIt != aLast && !aFPoint; anIt++) {
- boost::shared_ptr<GeomDataAPI_Point2D> aCurPoint = boost::dynamic_pointer_cast<
+ std::shared_ptr<GeomDataAPI_Point2D> aCurPoint = std::dynamic_pointer_cast<
GeomDataAPI_Point2D>(*anIt);
if (aCurPoint && aCurPoint->pnt()->distance(aClickedPoint) < Precision::Confusion())
aFPoint = aCurPoint;
{
if (!theFeature)
return;
- boost::shared_ptr<ModelAPI_Data> aData = theFeature->data();
- AttributeDoublePtr anAttribute = boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(
+ std::shared_ptr<ModelAPI_Data> aData = theFeature->data();
+ AttributeDoublePtr anAttribute = std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(
aData->attribute(theAttribute));
if (anAttribute)
anAttribute->setValue(theValue);
isValid = false;
double aValue = 0;
if (theFeature) {
- boost::shared_ptr<ModelAPI_Data> aData = theFeature->data();
- AttributeDoublePtr anAttribute = boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(
+ std::shared_ptr<ModelAPI_Data> aData = theFeature->data();
+ AttributeDoublePtr anAttribute = std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(
aData->attribute(theAttribute));
if (anAttribute) {
aValue = anAttribute->value();
if (!theFeature)
return aFeature;
- boost::shared_ptr<ModelAPI_Data> aData = theFeature->data();
- boost::shared_ptr<ModelAPI_AttributeRefAttr> anAttr = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_Data> aData = theFeature->data();
+ std::shared_ptr<ModelAPI_AttributeRefAttr> anAttr = std::dynamic_pointer_cast<
ModelAPI_AttributeRefAttr>(aData->attribute(theAttribute));
if (anAttr) {
- aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(anAttr->object());
+ aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(anAttr->object());
if (!theKind.empty() && aFeature && aFeature->getKind() != theKind) {
aFeature = FeaturePtr();
}
}
void PartSet_Tools::createConstraint(CompositeFeaturePtr theSketch,
- boost::shared_ptr<GeomDataAPI_Point2D> thePoint1,
- boost::shared_ptr<GeomDataAPI_Point2D> thePoint2)
+ std::shared_ptr<GeomDataAPI_Point2D> thePoint1,
+ std::shared_ptr<GeomDataAPI_Point2D> thePoint2)
{
FeaturePtr aFeature;
if (theSketch) {
aFeature = theSketch->addFeature(SketchPlugin_ConstraintCoincidence::ID());
} else {
- boost::shared_ptr<ModelAPI_Document> aDoc = document();
+ std::shared_ptr<ModelAPI_Document> aDoc = document();
aFeature = aDoc->addFeature(SketchPlugin_ConstraintCoincidence::ID());
}
- boost::shared_ptr<ModelAPI_Data> aData = aFeature->data();
+ std::shared_ptr<ModelAPI_Data> aData = aFeature->data();
- boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef1 = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_AttributeRefAttr> aRef1 = std::dynamic_pointer_cast<
ModelAPI_AttributeRefAttr>(aData->attribute(SketchPlugin_Constraint::ENTITY_A()));
aRef1->setAttr(thePoint1);
- boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef2 = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_AttributeRefAttr> aRef2 = std::dynamic_pointer_cast<
ModelAPI_AttributeRefAttr>(aData->attribute(SketchPlugin_Constraint::ENTITY_B()));
aRef2->setAttr(thePoint2);
double theClickedY)
{
// find a feature point by the selection mode
- //boost::shared_ptr<GeomDataAPI_Point2D> aPoint = featurePoint(theMode);
- boost::shared_ptr<GeomDataAPI_Point2D> aFeaturePoint = boost::dynamic_pointer_cast<
+ //std::shared_ptr<GeomDataAPI_Point2D> aPoint = featurePoint(theMode);
+ std::shared_ptr<GeomDataAPI_Point2D> aFeaturePoint = std::dynamic_pointer_cast<
GeomDataAPI_Point2D>(theFeature->data()->attribute(theAttribute));
if (!aFeaturePoint)
return;
// get all sketch features. If the point with the given coordinates belong to any sketch feature,
// the constraint is created between the feature point and the found sketch point
- boost::shared_ptr<ModelAPI_Data> aData = theSketch->data();
- boost::shared_ptr<ModelAPI_AttributeRefList> aRefList = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_Data> aData = theSketch->data();
+ std::shared_ptr<ModelAPI_AttributeRefList> aRefList = std::dynamic_pointer_cast<
ModelAPI_AttributeRefList>(aData->attribute(SketchPlugin_Sketch::FEATURES_ID()));
std::list<ObjectPtr> aFeatures = aRefList->list();
std::list<ObjectPtr>::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end();
- std::list<boost::shared_ptr<ModelAPI_Attribute> > anAttiributes;
- boost::shared_ptr<GeomAPI_Pnt2d> aClickedPoint = boost::shared_ptr<GeomAPI_Pnt2d>(
+ std::list<std::shared_ptr<ModelAPI_Attribute> > anAttiributes;
+ std::shared_ptr<GeomAPI_Pnt2d> aClickedPoint = std::shared_ptr<GeomAPI_Pnt2d>(
new GeomAPI_Pnt2d(theClickedX, theClickedY));
for (; anIt != aLast; anIt++) {
- FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(*anIt);
+ FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(*anIt);
// find the given point in the feature attributes
anAttiributes = aFeature->data()->attributes(GeomDataAPI_Point2D::type());
- std::list<boost::shared_ptr<ModelAPI_Attribute> >::const_iterator anIt = anAttiributes.begin(),
+ std::list<std::shared_ptr<ModelAPI_Attribute> >::const_iterator anIt = anAttiributes.begin(),
aLast = anAttiributes.end();
- boost::shared_ptr<GeomDataAPI_Point2D> aFPoint;
+ std::shared_ptr<GeomDataAPI_Point2D> aFPoint;
for (; anIt != aLast && !aFPoint; anIt++) {
- boost::shared_ptr<GeomDataAPI_Point2D> aCurPoint = boost::dynamic_pointer_cast<
+ std::shared_ptr<GeomDataAPI_Point2D> aCurPoint = std::dynamic_pointer_cast<
GeomDataAPI_Point2D>(*anIt);
if (aCurPoint && aCurPoint->pnt()->distance(aClickedPoint) < Precision::Confusion())
aFPoint = aCurPoint;
}
}
-boost::shared_ptr<GeomAPI_Pln> PartSet_Tools::sketchPlane(CompositeFeaturePtr theSketch)
+std::shared_ptr<GeomAPI_Pln> PartSet_Tools::sketchPlane(CompositeFeaturePtr theSketch)
{
- boost::shared_ptr<GeomAPI_Pln> aPlane;
+ std::shared_ptr<GeomAPI_Pln> aPlane;
double aA, aB, aC, aD;
- boost::shared_ptr<ModelAPI_Data> aData = theSketch->data();
- boost::shared_ptr<GeomDataAPI_Point> anOrigin = boost::dynamic_pointer_cast<GeomDataAPI_Point>(
+ std::shared_ptr<ModelAPI_Data> aData = theSketch->data();
+ std::shared_ptr<GeomDataAPI_Point> anOrigin = std::dynamic_pointer_cast<GeomDataAPI_Point>(
aData->attribute(SketchPlugin_Sketch::ORIGIN_ID()));
- boost::shared_ptr<GeomDataAPI_Dir> aNormal = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+ std::shared_ptr<GeomDataAPI_Dir> aNormal = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
aData->attribute(SketchPlugin_Sketch::NORM_ID()));
aA = aNormal->x();
aB = aNormal->y();
aC = aNormal->z();
aD = 0;
- aPlane = boost::shared_ptr<GeomAPI_Pln>(new GeomAPI_Pln(aA, aB, aC, aD));
+ aPlane = std::shared_ptr<GeomAPI_Pln>(new GeomAPI_Pln(aA, aB, aC, aD));
return aPlane;
}
-boost::shared_ptr<GeomAPI_Pnt> PartSet_Tools::point3D(boost::shared_ptr<GeomAPI_Pnt2d> thePoint2D,
+std::shared_ptr<GeomAPI_Pnt> PartSet_Tools::point3D(std::shared_ptr<GeomAPI_Pnt2d> thePoint2D,
CompositeFeaturePtr theSketch)
{
- boost::shared_ptr<GeomAPI_Pnt> aPoint;
+ std::shared_ptr<GeomAPI_Pnt> aPoint;
if (!theSketch || !thePoint2D)
return aPoint;
- boost::shared_ptr<GeomDataAPI_Point> aC = boost::dynamic_pointer_cast<GeomDataAPI_Point>(
+ std::shared_ptr<GeomDataAPI_Point> aC = std::dynamic_pointer_cast<GeomDataAPI_Point>(
theSketch->data()->attribute(SketchPlugin_Sketch::ORIGIN_ID()));
- boost::shared_ptr<GeomDataAPI_Dir> aX = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+ std::shared_ptr<GeomDataAPI_Dir> aX = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
theSketch->data()->attribute(SketchPlugin_Sketch::DIRX_ID()));
- boost::shared_ptr<GeomDataAPI_Dir> aY = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+ std::shared_ptr<GeomDataAPI_Dir> aY = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
theSketch->data()->attribute(SketchPlugin_Sketch::DIRY_ID()));
return thePoint2D->to3D(aC->pnt(), aX->dir(), aY->dir());
return ResultPtr();
// Check that we already have such external edge
- boost::shared_ptr<GeomAPI_Edge> aInEdge = boost::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge());
+ std::shared_ptr<GeomAPI_Edge> aInEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge());
aInEdge->setImpl(new TopoDS_Shape(aShape));
ResultPtr aResult = findExternalEdge(theSketch, aInEdge);
if (aResult)
aMyFeature = theSketch->addFeature(SketchPlugin_Line::ID());
//DataPtr aData = myFeature->data();
- //boost::shared_ptr<GeomDataAPI_Point2D> anEndAttr =
- // boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Line::END_ID()));
+ //std::shared_ptr<GeomDataAPI_Point2D> anEndAttr =
+ // std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Line::END_ID()));
//double aX, aY;
//gp_Pnt Pnt1 = aAdaptor.Value(aStart);
if (aMyFeature) {
DataPtr aData = aMyFeature->data();
AttributeSelectionPtr anAttr =
- boost::dynamic_pointer_cast<ModelAPI_AttributeSelection>
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelection>
(aData->attribute(SketchPlugin_Feature::EXTERNAL_ID()));
- ResultPtr aRes = boost::dynamic_pointer_cast<ModelAPI_Result>(thePrs.object());
+ ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(thePrs.object());
if (anAttr && aRes) {
- boost::shared_ptr<GeomAPI_Shape> anEdge(new GeomAPI_Shape);
+ std::shared_ptr<GeomAPI_Shape> anEdge(new GeomAPI_Shape);
anEdge->setImpl(new TopoDS_Shape(aShape));
anAttr->setValue(aRes, anEdge);
return false;
}
-ResultPtr PartSet_Tools::findExternalEdge(CompositeFeaturePtr theSketch, boost::shared_ptr<GeomAPI_Edge> theEdge)
+ResultPtr PartSet_Tools::findExternalEdge(CompositeFeaturePtr theSketch, std::shared_ptr<GeomAPI_Edge> theEdge)
{
for (int i = 0; i < theSketch->numberOfSubs(); i++) {
FeaturePtr aFeature = theSketch->subFeature(i);
- boost::shared_ptr<SketchPlugin_Feature> aSketchFea =
- boost::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
+ std::shared_ptr<SketchPlugin_Feature> aSketchFea =
+ std::dynamic_pointer_cast<SketchPlugin_Feature>(aFeature);
if (aSketchFea) {
if (aSketchFea->isExternal()) {
std::list<ResultPtr> aResults = aSketchFea->results();
std::list<ResultPtr>::const_iterator aIt;
for (aIt = aResults.cbegin(); aIt != aResults.cend(); ++aIt) {
ResultConstructionPtr aRes =
- boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aIt);
+ std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(*aIt);
if (aRes) {
- boost::shared_ptr<GeomAPI_Shape> aShape = aRes->shape();
+ std::shared_ptr<GeomAPI_Shape> aShape = aRes->shape();
if (aShape) {
if (theEdge->isEqual(aShape))
return aRes;
#include <ModelAPI_CompositeFeature.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
class Handle_V3d_View;
class ModuleBase_ViewerPrs;
const QList<ModuleBase_ViewerPrs>& theHighlighted);
/// Returns pointer to the root document.
- static boost::shared_ptr<ModelAPI_Document> document();
+ static std::shared_ptr<ModelAPI_Document> document();
/// Returns a point attribute of the feature by the coordinates if it is
/// \param theFeature the feature
/// \param theX the horizontal coordinate
/// \param theY the vertical coordinate
- static boost::shared_ptr<GeomDataAPI_Point2D> getFeaturePoint(FeaturePtr theFeature,
+ static std::shared_ptr<GeomDataAPI_Point2D> getFeaturePoint(FeaturePtr theFeature,
double theX, double theY);
/// \brief Save the double to the feature. If the attribute is double, it is filled.
/// \param thePoint1 the first point
/// \param thePoint1 the second point
static void createConstraint(CompositeFeaturePtr theSketch,
- boost::shared_ptr<GeomDataAPI_Point2D> thePoint1,
- boost::shared_ptr<GeomDataAPI_Point2D> thePoint2);
+ std::shared_ptr<GeomDataAPI_Point2D> thePoint1,
+ std::shared_ptr<GeomDataAPI_Point2D> thePoint2);
/// Creates constrains of the current
/// \param theSketch a sketch feature
/// Create a sketch plane instance
/// \param theSketch a sketch feature
/// \return API object of geom plane
- static boost::shared_ptr<GeomAPI_Pln> sketchPlane(CompositeFeaturePtr theSketch);
+ static std::shared_ptr<GeomAPI_Pln> sketchPlane(CompositeFeaturePtr theSketch);
/// Create a point 3D on a basis of point 2D and sketch feature
/// \param thePoint2D a point on a sketch
/// \param theSketch a sketch feature
/// \return API object of point 3D
- static boost::shared_ptr<GeomAPI_Pnt> point3D(boost::shared_ptr<GeomAPI_Pnt2d> thePoint2D,
+ static std::shared_ptr<GeomAPI_Pnt> point3D(std::shared_ptr<GeomAPI_Pnt2d> thePoint2D,
CompositeFeaturePtr theSketch);
/// Check whether there is a constraint with the feature kind given
/// \param theKind a feature kind
/// \param theSketch - the sketch feature
/// \param theEdge - the edge
/// \return result object with external edge if it is found
- static ResultPtr findExternalEdge(CompositeFeaturePtr theSketch, boost::shared_ptr<GeomAPI_Edge> theEdge);
+ static ResultPtr findExternalEdge(CompositeFeaturePtr theSketch, std::shared_ptr<GeomAPI_Edge> theEdge);
/// Returns whether the selected presentation has a shape with the vertex type
/// \param thePrs a selected presentation
PartSetPlugin_Part::initAttributes();
data()->addAttribute(ORIGIN_REF(), ModelAPI_AttributeRefAttr::type());
- boost::shared_ptr<ModelAPI_Session> aPManager = ModelAPI_Session::get();
- boost::shared_ptr<ModelAPI_Document> aRoot = aPManager->moduleDocument();
- boost::shared_ptr<ModelAPI_ResultPart> aSource; // searching for source document attribute
+ std::shared_ptr<ModelAPI_Session> aPManager = ModelAPI_Session::get();
+ std::shared_ptr<ModelAPI_Document> aRoot = aPManager->moduleDocument();
+ std::shared_ptr<ModelAPI_ResultPart> aSource; // searching for source document attribute
for (int a = aRoot->size(getGroup()) - 1; a >= 0; a--) {
- aSource = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(aRoot->object(getGroup(), a));
+ aSource = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aRoot->object(getGroup(), a));
if (aSource && aSource->data()
&& aSource->data()->document(ModelAPI_ResultPart::DOC_REF())->value()
== aPManager->activeDocument())
aSource.reset();
}
if (aSource) {
- boost::shared_ptr<ModelAPI_Document> aCopy = aPManager->copy(
+ std::shared_ptr<ModelAPI_Document> aCopy = aPManager->copy(
aSource->data()->document(ModelAPI_ResultPart::DOC_REF())->value(), data()->name());
data()->refattr(ORIGIN_REF())->setObject(aSource);
}
void PartSetPlugin_Part::execute()
{
- ResultPartPtr aResult = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(firstResult());
+ ResultPartPtr aResult = std::dynamic_pointer_cast<ModelAPI_ResultPart>(firstResult());
if (!aResult) {
aResult = document()->createPart(data());
setResult(aResult);
}
}
-boost::shared_ptr<ModelAPI_Document> PartSetPlugin_Part::documentToAdd()
+std::shared_ptr<ModelAPI_Document> PartSetPlugin_Part::documentToAdd()
{
return ModelAPI_Session::get()->moduleDocument();
}
/// Request for initialization of data model of the feature: adding all attributes
PARTSETPLUGIN_EXPORT virtual void initAttributes();
- PARTSETPLUGIN_EXPORT virtual boost::shared_ptr<ModelAPI_Document> documentToAdd();
+ PARTSETPLUGIN_EXPORT virtual std::shared_ptr<ModelAPI_Document> documentToAdd();
/// Returns true if this feature must be displayed in the history (top level of Part tree)
PARTSETPLUGIN_EXPORT virtual bool isInHistory()
void PartSetPlugin_Remove::execute()
{
- boost::shared_ptr<ModelAPI_Session> aPManager = ModelAPI_Session::get();
- boost::shared_ptr<ModelAPI_Document> aRoot = aPManager->moduleDocument();
- boost::shared_ptr<ModelAPI_Document> aCurrent;
- boost::shared_ptr<PartSetPlugin_Part> a;
+ std::shared_ptr<ModelAPI_Session> aPManager = ModelAPI_Session::get();
+ std::shared_ptr<ModelAPI_Document> aRoot = aPManager->moduleDocument();
+ std::shared_ptr<ModelAPI_Document> aCurrent;
+ std::shared_ptr<PartSetPlugin_Part> a;
for (int a = aRoot->size(ModelAPI_ResultPart::group()) - 1; a >= 0; a--) {
- ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(
+ ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(
aRoot->object(ModelAPI_ResultPart::group(), a));
if (aPart
&& aPart->data()->document(ModelAPI_ResultPart::DOC_REF())->value()
// otherwise AIS object is used to visualize the arc's preview
if (aSketch && isFeatureValid()) {
// compute a circle point in 3D view
- boost::shared_ptr<GeomDataAPI_Point2D> aCenterAttr = boost::dynamic_pointer_cast<
+ std::shared_ptr<GeomDataAPI_Point2D> aCenterAttr = std::dynamic_pointer_cast<
GeomDataAPI_Point2D>(data()->attribute(SketchPlugin_Arc::CENTER_ID()));
// compute the arc start point
- boost::shared_ptr<GeomDataAPI_Point2D> aStartAttr = boost::dynamic_pointer_cast<
+ std::shared_ptr<GeomDataAPI_Point2D> aStartAttr = std::dynamic_pointer_cast<
GeomDataAPI_Point2D>(data()->attribute(SketchPlugin_Arc::START_ID()));
- boost::shared_ptr<GeomAPI_Pnt> aCenter(aSketch->to3D(aCenterAttr->x(), aCenterAttr->y()));
+ std::shared_ptr<GeomAPI_Pnt> aCenter(aSketch->to3D(aCenterAttr->x(), aCenterAttr->y()));
// make a visible point
- boost::shared_ptr<GeomAPI_Shape> aCenterPointShape = GeomAlgoAPI_PointBuilder::point(aCenter);
- boost::shared_ptr<ModelAPI_ResultConstruction> aConstr1 = document()->createConstruction(
+ std::shared_ptr<GeomAPI_Shape> aCenterPointShape = GeomAlgoAPI_PointBuilder::point(aCenter);
+ std::shared_ptr<ModelAPI_ResultConstruction> aConstr1 = document()->createConstruction(
data(), 0);
aConstr1->setShape(aCenterPointShape);
aConstr1->setIsInHistory(false);
setResult(aConstr1, 0);
// make a visible circle
- boost::shared_ptr<GeomDataAPI_Dir> aNDir = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+ std::shared_ptr<GeomDataAPI_Dir> aNDir = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
aSketch->data()->attribute(SketchPlugin_Sketch::NORM_ID()));
bool aHasPlane = aNDir && !(aNDir->x() == 0 && aNDir->y() == 0 && aNDir->z() == 0);
if (aHasPlane) {
- boost::shared_ptr<GeomAPI_Dir> aNormal = aNDir->dir();
- boost::shared_ptr<GeomAPI_Pnt> aStartPoint(aSketch->to3D(aStartAttr->x(), aStartAttr->y()));
+ std::shared_ptr<GeomAPI_Dir> aNormal = aNDir->dir();
+ std::shared_ptr<GeomAPI_Pnt> aStartPoint(aSketch->to3D(aStartAttr->x(), aStartAttr->y()));
// compute and change the arc end point
- boost::shared_ptr<GeomDataAPI_Point2D> anEndAttr = boost::dynamic_pointer_cast<
+ std::shared_ptr<GeomDataAPI_Point2D> anEndAttr = std::dynamic_pointer_cast<
GeomDataAPI_Point2D>(data()->attribute(SketchPlugin_Arc::END_ID()));
- boost::shared_ptr<GeomAPI_Circ2d> aCircleForArc(
+ std::shared_ptr<GeomAPI_Circ2d> aCircleForArc(
new GeomAPI_Circ2d(aCenterAttr->pnt(), aStartAttr->pnt()));
- boost::shared_ptr<GeomAPI_Pnt2d> aProjection = aCircleForArc->project(anEndAttr->pnt());
+ std::shared_ptr<GeomAPI_Pnt2d> aProjection = aCircleForArc->project(anEndAttr->pnt());
if (aProjection && anEndAttr->pnt()->distance(aProjection) > tolerance)
anEndAttr->setValue(aProjection);
- boost::shared_ptr<GeomAPI_Pnt> aEndPoint(aSketch->to3D(anEndAttr->x(), anEndAttr->y()));
+ std::shared_ptr<GeomAPI_Pnt> aEndPoint(aSketch->to3D(anEndAttr->x(), anEndAttr->y()));
- boost::shared_ptr<GeomAPI_Shape> aCircleShape = GeomAlgoAPI_EdgeBuilder::lineCircleArc(
+ std::shared_ptr<GeomAPI_Shape> aCircleShape = GeomAlgoAPI_EdgeBuilder::lineCircleArc(
aCenter, aStartPoint, aEndPoint, aNormal);
if (aCircleShape) {
- boost::shared_ptr<ModelAPI_ResultConstruction> aConstr2 = document()->createConstruction(
+ std::shared_ptr<ModelAPI_ResultConstruction> aConstr2 = document()->createConstruction(
data(), 1);
aConstr2->setShape(aCircleShape);
aConstr2->setIsInHistory(false);
// if the feature is valid, the execute() method should be performed, AIS object is empty
if (!isFeatureValid()) {
// compute a circle point in 3D view
- boost::shared_ptr<GeomDataAPI_Point2D> aCenterAttr = boost::dynamic_pointer_cast<
+ std::shared_ptr<GeomDataAPI_Point2D> aCenterAttr = std::dynamic_pointer_cast<
GeomDataAPI_Point2D>(data()->attribute(SketchPlugin_Arc::CENTER_ID()));
if (aCenterAttr->isInitialized()) {
- boost::shared_ptr<GeomAPI_Pnt> aCenter(aSketch->to3D(aCenterAttr->x(), aCenterAttr->y()));
+ std::shared_ptr<GeomAPI_Pnt> aCenter(aSketch->to3D(aCenterAttr->x(), aCenterAttr->y()));
- boost::shared_ptr<GeomDataAPI_Point2D> aStartAttr = boost::dynamic_pointer_cast<
+ std::shared_ptr<GeomDataAPI_Point2D> aStartAttr = std::dynamic_pointer_cast<
GeomDataAPI_Point2D>(data()->attribute(SketchPlugin_Arc::START_ID()));
if (aStartAttr->isInitialized()) {
// make a visible circle
- boost::shared_ptr<GeomDataAPI_Dir> aNDir = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+ std::shared_ptr<GeomDataAPI_Dir> aNDir = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
aSketch->data()->attribute(SketchPlugin_Sketch::NORM_ID()));
bool aHasPlane = aNDir && !(aNDir->x() == 0 && aNDir->y() == 0 && aNDir->z() == 0);
if (aHasPlane) {
- boost::shared_ptr<GeomAPI_Dir> aNormal = aNDir->dir();
- boost::shared_ptr<GeomAPI_Pnt> aStartPoint(aSketch->to3D(aStartAttr->x(), aStartAttr->y()));
- boost::shared_ptr<GeomAPI_Shape> aCircleShape = GeomAlgoAPI_EdgeBuilder::lineCircleArc(
+ std::shared_ptr<GeomAPI_Dir> aNormal = aNDir->dir();
+ std::shared_ptr<GeomAPI_Pnt> aStartPoint(aSketch->to3D(aStartAttr->x(), aStartAttr->y()));
+ std::shared_ptr<GeomAPI_Shape> aCircleShape = GeomAlgoAPI_EdgeBuilder::lineCircleArc(
aCenter, aStartPoint, aStartPoint, aNormal);
if (aCircleShape) {
- std::list<boost::shared_ptr<GeomAPI_Shape> > aShapes;
+ std::list<std::shared_ptr<GeomAPI_Shape> > aShapes;
// make a visible point
- boost::shared_ptr<GeomAPI_Shape> aCenterPointShape = GeomAlgoAPI_PointBuilder::point(aCenter);
+ std::shared_ptr<GeomAPI_Shape> aCenterPointShape = GeomAlgoAPI_PointBuilder::point(aCenter);
aShapes.push_back(aCenterPointShape);
aShapes.push_back(aCircleShape);
if (!aShapes.empty())
{
- boost::shared_ptr<GeomAPI_Shape> aCompound = GeomAlgoAPI_CompoundBuilder::compound(aShapes);
+ std::shared_ptr<GeomAPI_Shape> aCompound = GeomAlgoAPI_CompoundBuilder::compound(aShapes);
AISObjectPtr anAIS = thePrevious;
if (!anAIS)
anAIS = AISObjectPtr(new GeomAPI_AISObject);
void SketchPlugin_Arc::move(double theDeltaX, double theDeltaY)
{
- boost::shared_ptr<ModelAPI_Data> aData = data();
+ std::shared_ptr<ModelAPI_Data> aData = data();
if (!aData->isValid())
return;
- boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint1 = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aData->attribute(SketchPlugin_Arc::CENTER_ID()));
aPoint1->move(theDeltaX, theDeltaY);
- boost::shared_ptr<GeomDataAPI_Point2D> aPoint2 = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint2 = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aData->attribute(SketchPlugin_Arc::START_ID()));
aPoint2->move(theDeltaX, theDeltaY);
- boost::shared_ptr<GeomDataAPI_Point2D> aPoint3 = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint3 = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aData->attribute(SketchPlugin_Arc::END_ID()));
aPoint3->move(theDeltaX, theDeltaY);
}
-double SketchPlugin_Arc::distanceToPoint(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint)
+double SketchPlugin_Arc::distanceToPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint)
{
double aDelta = 0;
- boost::shared_ptr<ModelAPI_Data> aData = data();
+ std::shared_ptr<ModelAPI_Data> aData = data();
- boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint1 = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aData->attribute(SketchPlugin_Arc::CENTER_ID()));
aDelta = aPoint1->pnt()->distance(thePoint);
- boost::shared_ptr<GeomDataAPI_Point2D> aPoint2 = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint2 = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aData->attribute(SketchPlugin_Arc::START_ID()));
double aDistance = aPoint2->pnt()->distance(thePoint);
if (aDelta < aDistance)
aDelta = aDistance;
- boost::shared_ptr<GeomDataAPI_Point2D> aPoint3 = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint3 = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aData->attribute(SketchPlugin_Arc::END_ID()));
aDistance = aPoint3->pnt()->distance(thePoint);
if (aDelta < aDistance)
bool SketchPlugin_Arc::isFeatureValid()
{
- boost::shared_ptr<GeomDataAPI_Point2D> aCenterAttr = boost::dynamic_pointer_cast<
+ std::shared_ptr<GeomDataAPI_Point2D> aCenterAttr = std::dynamic_pointer_cast<
GeomDataAPI_Point2D>(data()->attribute(SketchPlugin_Arc::CENTER_ID()));
- boost::shared_ptr<GeomDataAPI_Point2D> aStartAttr = boost::dynamic_pointer_cast<
+ std::shared_ptr<GeomDataAPI_Point2D> aStartAttr = std::dynamic_pointer_cast<
GeomDataAPI_Point2D>(data()->attribute(SketchPlugin_Arc::START_ID()));
- boost::shared_ptr<GeomDataAPI_Point2D> anEndAttr = boost::dynamic_pointer_cast<
+ std::shared_ptr<GeomDataAPI_Point2D> anEndAttr = std::dynamic_pointer_cast<
GeomDataAPI_Point2D>(data()->attribute(SketchPlugin_Arc::END_ID()));
return aCenterAttr->isInitialized() && aStartAttr->isInitialized() && anEndAttr->isInitialized();
/// Return the distance between the feature and the point
/// \param thePoint the point
- virtual double distanceToPoint(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint);
+ virtual double distanceToPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
/// Use plugin manager for features creation
SketchPlugin_Arc();
{
SketchPlugin_Sketch* aSketch = sketch();
if (aSketch) {
- std::list<boost::shared_ptr<GeomAPI_Shape> > aShapes;
+ std::list<std::shared_ptr<GeomAPI_Shape> > aShapes;
// compute a circle point in 3D view
- boost::shared_ptr<GeomDataAPI_Point2D> aCenterAttr = boost::dynamic_pointer_cast<
+ std::shared_ptr<GeomDataAPI_Point2D> aCenterAttr = std::dynamic_pointer_cast<
GeomDataAPI_Point2D>(data()->attribute(CENTER_ID()));
AttributeDoublePtr aRadiusAttr =
- boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(data()->attribute(RADIUS_ID()));
+ std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(data()->attribute(RADIUS_ID()));
if (aCenterAttr->isInitialized() && aRadiusAttr->isInitialized()) {
- boost::shared_ptr<GeomAPI_Pnt> aCenter(aSketch->to3D(aCenterAttr->x(), aCenterAttr->y()));
+ std::shared_ptr<GeomAPI_Pnt> aCenter(aSketch->to3D(aCenterAttr->x(), aCenterAttr->y()));
//std::cout<<"Execute circle "<<aCenter->x()<<" "<<aCenter->y()<<" "<<aCenter->z()<<std::endl;
// make a visible point
- boost::shared_ptr<GeomAPI_Shape> aCenterPointShape = GeomAlgoAPI_PointBuilder::point(aCenter);
- boost::shared_ptr<ModelAPI_ResultConstruction> aConstr1 = document()->createConstruction(
+ std::shared_ptr<GeomAPI_Shape> aCenterPointShape = GeomAlgoAPI_PointBuilder::point(aCenter);
+ std::shared_ptr<ModelAPI_ResultConstruction> aConstr1 = document()->createConstruction(
data(), 0);
aConstr1->setShape(aCenterPointShape);
aConstr1->setIsInHistory(false);
setResult(aConstr1, 0);
// make a visible circle
- boost::shared_ptr<GeomDataAPI_Dir> aNDir = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+ std::shared_ptr<GeomDataAPI_Dir> aNDir = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
aSketch->data()->attribute(SketchPlugin_Sketch::NORM_ID()));
bool aHasPlane = aNDir && !(aNDir->x() == 0 && aNDir->y() == 0 && aNDir->z() == 0);
if (aHasPlane) {
- boost::shared_ptr<GeomAPI_Dir> aNormal(new GeomAPI_Dir(aNDir->x(), aNDir->y(), aNDir->z()));
+ std::shared_ptr<GeomAPI_Dir> aNormal(new GeomAPI_Dir(aNDir->x(), aNDir->y(), aNDir->z()));
// compute the circle radius
double aRadius = aRadiusAttr->value();
- boost::shared_ptr<GeomAPI_Shape> aCircleShape = GeomAlgoAPI_EdgeBuilder::lineCircle(
+ std::shared_ptr<GeomAPI_Shape> aCircleShape = GeomAlgoAPI_EdgeBuilder::lineCircle(
aCenter, aNormal, aRadius);
aShapes.push_back(aCircleShape);
- boost::shared_ptr<ModelAPI_ResultConstruction> aConstr2 = document()->createConstruction(
+ std::shared_ptr<ModelAPI_ResultConstruction> aConstr2 = document()->createConstruction(
data(), 1);
aConstr2->setShape(aCircleShape);
aConstr2->setIsInHistory(false);
void SketchPlugin_Circle::move(double theDeltaX, double theDeltaY)
{
- boost::shared_ptr<ModelAPI_Data> aData = data();
+ std::shared_ptr<ModelAPI_Data> aData = data();
if (!aData->isValid())
return;
- boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint1 = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aData->attribute(CENTER_ID()));
aPoint1->move(theDeltaX, theDeltaY);
}
-double SketchPlugin_Circle::distanceToPoint(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint)
+double SketchPlugin_Circle::distanceToPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint)
{
- boost::shared_ptr<ModelAPI_Data> aData = data();
- boost::shared_ptr<GeomDataAPI_Point2D> aPoint =
- boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(CENTER_ID()));
+ std::shared_ptr<ModelAPI_Data> aData = data();
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint =
+ std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(CENTER_ID()));
return aPoint->pnt()->distance(thePoint);
}
void SketchPlugin_Circle::attributeChanged() {
static bool myIsUpdated = false; // to avoid infinitive cycle on attrubtes change
- boost::shared_ptr<GeomAPI_Shape> aSelection = data()->selection(EXTERNAL_ID())->value();
+ std::shared_ptr<GeomAPI_Shape> aSelection = data()->selection(EXTERNAL_ID())->value();
// update arguments due to the selection value
if (aSelection && !aSelection->isNull() && aSelection->isEdge() && !myIsUpdated) {
myIsUpdated = true;
- boost::shared_ptr<GeomAPI_Edge> anEdge( new GeomAPI_Edge(aSelection));
- boost::shared_ptr<GeomAPI_Circ> aCirc = anEdge->circle();
- boost::shared_ptr<GeomDataAPI_Point2D> aCenterAttr =
- boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(attribute(CENTER_ID()));
+ std::shared_ptr<GeomAPI_Edge> anEdge( new GeomAPI_Edge(aSelection));
+ std::shared_ptr<GeomAPI_Circ> aCirc = anEdge->circle();
+ std::shared_ptr<GeomDataAPI_Point2D> aCenterAttr =
+ std::dynamic_pointer_cast<GeomDataAPI_Point2D>(attribute(CENTER_ID()));
aCenterAttr->setValue(sketch()->to2D(aCirc->center()));
real(RADIUS_ID())->setValue(aCirc->radius());
myIsUpdated = false;
/// Return the distance between the feature and the point
/// \param thePoint the point
- virtual double distanceToPoint(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint);
+ virtual double distanceToPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
/// Called on change of any argument-attribute of this object
SKETCHPLUGIN_EXPORT virtual void attributeChanged();
}
double SketchPlugin_ConstraintBase::distanceToPoint(
- const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint)
+ const std::shared_ptr<GeomAPI_Pnt2d>& thePoint)
{
return 0;
}
/// Return the distance between the feature and the point
/// \param thePoint the point
- virtual double distanceToPoint(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint);
+ virtual double distanceToPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
protected:
/// \brief Use plugin manager for features creation
//*************************************************************************************
void SketchPlugin_ConstraintDistance::execute()
{
- boost::shared_ptr<ModelAPI_Data> aData = data();
- AttributeDoublePtr anAttrValue = boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(
+ std::shared_ptr<ModelAPI_Data> aData = data();
+ AttributeDoublePtr anAttrValue = std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(
aData->attribute(SketchPlugin_Constraint::VALUE()));
if(anAttrValue->isInitialized())
if (!sketch())
return thePrevious;
- boost::shared_ptr<GeomAPI_Pln> aPlane = sketch()->plane();
+ std::shared_ptr<GeomAPI_Pln> aPlane = sketch()->plane();
DataPtr aData = data();
- boost::shared_ptr<GeomDataAPI_Point2D> aPoint_A = getFeaturePoint(
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint_A = getFeaturePoint(
aData, SketchPlugin_Constraint::ENTITY_A());
- boost::shared_ptr<GeomDataAPI_Point2D> aPoint_B = getFeaturePoint(
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint_B = getFeaturePoint(
aData, SketchPlugin_Constraint::ENTITY_B());
- boost::shared_ptr<GeomAPI_Pnt2d> aPnt_A;
- boost::shared_ptr<GeomAPI_Pnt2d> aPnt_B;
+ std::shared_ptr<GeomAPI_Pnt2d> aPnt_A;
+ std::shared_ptr<GeomAPI_Pnt2d> aPnt_B;
if (aPoint_A && aPoint_B) {
aPnt_A = aPoint_A->pnt();
aPnt_B = aPoint_B->pnt();
} else if (!aPoint_A && aPoint_B) {
- boost::shared_ptr<SketchPlugin_Line> aLine = getFeatureLine(
+ std::shared_ptr<SketchPlugin_Line> aLine = getFeatureLine(
aData, SketchPlugin_Constraint::ENTITY_A());
if (aLine) {
aPnt_B = aPoint_B->pnt();
aPnt_A = getProjectionPoint(aLine, aPnt_B);
}
} else if (aPoint_A && !aPoint_B) {
- boost::shared_ptr<SketchPlugin_Line> aLine = getFeatureLine(
+ std::shared_ptr<SketchPlugin_Line> aLine = getFeatureLine(
aData, SketchPlugin_Constraint::ENTITY_B());
if (aLine) {
aPnt_A = aPoint_A->pnt();
if (!aPnt_A || !aPnt_B)
return AISObjectPtr();
- boost::shared_ptr<GeomDataAPI_Point2D> aFlyOutAttr = boost::dynamic_pointer_cast<
+ std::shared_ptr<GeomDataAPI_Point2D> aFlyOutAttr = std::dynamic_pointer_cast<
GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
- boost::shared_ptr<GeomAPI_Pnt> aPoint1 = sketch()->to3D(aPnt_A->x(), aPnt_A->y());
- boost::shared_ptr<GeomAPI_Pnt> aPoint2 = sketch()->to3D(aPnt_B->x(), aPnt_B->y());
- boost::shared_ptr<GeomAPI_Pnt> aFlyoutPnt = boost::shared_ptr<GeomAPI_Pnt>();
+ std::shared_ptr<GeomAPI_Pnt> aPoint1 = sketch()->to3D(aPnt_A->x(), aPnt_A->y());
+ std::shared_ptr<GeomAPI_Pnt> aPoint2 = sketch()->to3D(aPnt_B->x(), aPnt_B->y());
+ std::shared_ptr<GeomAPI_Pnt> aFlyoutPnt = std::shared_ptr<GeomAPI_Pnt>();
if(aFlyOutAttr->isInitialized()) {
aFlyoutPnt = sketch()->to3D(aFlyOutAttr->x(), aFlyOutAttr->y());
} else {
- boost::shared_ptr<GeomAPI_Lin2d> aLine = boost::shared_ptr<GeomAPI_Lin2d>(new GeomAPI_Lin2d(aPnt_A, aPnt_B));
+ std::shared_ptr<GeomAPI_Lin2d> aLine = std::shared_ptr<GeomAPI_Lin2d>(new GeomAPI_Lin2d(aPnt_A, aPnt_B));
double aDist = aPoint1->distance(aPoint2)/5.;
- boost::shared_ptr<GeomAPI_Pnt2d> aFPnt = aLine->shiftedLocation(aDist);
+ std::shared_ptr<GeomAPI_Pnt2d> aFPnt = aLine->shiftedLocation(aDist);
aFlyOutAttr->setValue(aFPnt);
aFlyoutPnt = sketch()->to3D(aFPnt->x(), aFPnt->y());
}
// value calculation
- boost::shared_ptr<ModelAPI_AttributeDouble> aValueAttr = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_AttributeDouble> aValueAttr = std::dynamic_pointer_cast<
ModelAPI_AttributeDouble>(aData->attribute(SketchPlugin_Constraint::VALUE()));
double aValue = aValueAttr->value();
// Issue #196: checking the positivity of the distance constraint
//*************************************************************************************
void SketchPlugin_ConstraintDistance::move(double theDeltaX, double theDeltaY)
{
- boost::shared_ptr<ModelAPI_Data> aData = data();
+ std::shared_ptr<ModelAPI_Data> aData = data();
if (!aData->isValid())
return;
- boost::shared_ptr<GeomDataAPI_Point2D> aPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
aPoint->move(theDeltaX, theDeltaY);
}
{
double aDistance = -1.;
- boost::shared_ptr<ModelAPI_Data> aData = data();
- boost::shared_ptr<GeomDataAPI_Point2D> aPointA =
+ std::shared_ptr<ModelAPI_Data> aData = data();
+ std::shared_ptr<GeomDataAPI_Point2D> aPointA =
getFeaturePoint(aData, SketchPlugin_Constraint::ENTITY_A());
- boost::shared_ptr<GeomDataAPI_Point2D> aPointB =
+ std::shared_ptr<GeomDataAPI_Point2D> aPointB =
getFeaturePoint(aData, SketchPlugin_Constraint::ENTITY_B());
if (aPointA && aPointB) { // both points
aDistance = aPointA->pnt()->distance(aPointB->pnt());
} else {
if (!aPointA && aPointB) { //Line and point
- boost::shared_ptr<SketchPlugin_Line> aLine =
+ std::shared_ptr<SketchPlugin_Line> aLine =
getFeatureLine(aData, SketchPlugin_Constraint::ENTITY_A());
if (aLine) {
aDistance = aLine->distanceToPoint(aPointB->pnt());
}
} else if (aPointA && !aPointB) { // Point and line
- boost::shared_ptr<SketchPlugin_Line> aLine =
+ std::shared_ptr<SketchPlugin_Line> aLine =
getFeatureLine(aData, SketchPlugin_Constraint::ENTITY_B());
if (aLine) {
aDistance = aLine->distanceToPoint(aPointA->pnt());
//*************************************************************************************
-boost::shared_ptr<GeomDataAPI_Point2D> getFeaturePoint(DataPtr theData,
+std::shared_ptr<GeomDataAPI_Point2D> getFeaturePoint(DataPtr theData,
const std::string& theAttribute)
{
- boost::shared_ptr<GeomDataAPI_Point2D> aPointAttr;
+ std::shared_ptr<GeomDataAPI_Point2D> aPointAttr;
if (!theData)
return aPointAttr;
FeaturePtr aFeature;
- boost::shared_ptr<ModelAPI_AttributeRefAttr> anAttr = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_AttributeRefAttr> anAttr = std::dynamic_pointer_cast<
ModelAPI_AttributeRefAttr>(theData->attribute(theAttribute));
if (anAttr)
aFeature = ModelAPI_Feature::feature(anAttr->object());
if (aFeature && aFeature->getKind() == SketchPlugin_Point::ID())
- aPointAttr = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ aPointAttr = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aFeature->data()->attribute(SketchPlugin_Point::COORD_ID()));
else if (aFeature && aFeature->getKind() == SketchPlugin_Circle::ID())
- aPointAttr = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ aPointAttr = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aFeature->data()->attribute(SketchPlugin_Circle::CENTER_ID()));
else if (anAttr->attr()) {
- aPointAttr = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(anAttr->attr());
+ aPointAttr = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(anAttr->attr());
}
return aPointAttr;
}
//*************************************************************************************
-boost::shared_ptr<SketchPlugin_Line> getFeatureLine(DataPtr theData,
+std::shared_ptr<SketchPlugin_Line> getFeatureLine(DataPtr theData,
const std::string& theAttribute)
{
- boost::shared_ptr<SketchPlugin_Line> aLine;
+ std::shared_ptr<SketchPlugin_Line> aLine;
if (!theData)
return aLine;
- boost::shared_ptr<ModelAPI_AttributeRefAttr> anAttr = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_AttributeRefAttr> anAttr = std::dynamic_pointer_cast<
ModelAPI_AttributeRefAttr>(theData->attribute(theAttribute));
if (anAttr) {
FeaturePtr aFeature = ModelAPI_Feature::feature(anAttr->object());
if (aFeature && aFeature->getKind() == SketchPlugin_Line::ID()) {
- aLine = boost::dynamic_pointer_cast<SketchPlugin_Line>(aFeature);
+ aLine = std::dynamic_pointer_cast<SketchPlugin_Line>(aFeature);
}
}
return aLine;
}
//*************************************************************************************
-boost::shared_ptr<GeomAPI_Pnt2d> getProjectionPoint(
- const boost::shared_ptr<SketchPlugin_Line>& theLine,
- const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint)
+std::shared_ptr<GeomAPI_Pnt2d> getProjectionPoint(
+ const std::shared_ptr<SketchPlugin_Line>& theLine,
+ const std::shared_ptr<GeomAPI_Pnt2d>& thePoint)
{
- boost::shared_ptr<ModelAPI_Data> aData = theLine->data();
- boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ std::shared_ptr<ModelAPI_Data> aData = theLine->data();
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint1 = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aData->attribute(SketchPlugin_Line::START_ID()));
- boost::shared_ptr<GeomDataAPI_Point2D> aPoint2 = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint2 = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aData->attribute(SketchPlugin_Line::END_ID()));
GeomAPI_Lin2d aLin2d(aPoint1->x(), aPoint1->y(), aPoint2->x(), aPoint2->y());
};
/// Obtain the point object from specified constraint parameter
-boost::shared_ptr<GeomDataAPI_Point2D> getFeaturePoint(DataPtr theData,
+std::shared_ptr<GeomDataAPI_Point2D> getFeaturePoint(DataPtr theData,
const std::string& theAttribute);
-boost::shared_ptr<SketchPlugin_Line> getFeatureLine(DataPtr theData,
+std::shared_ptr<SketchPlugin_Line> getFeatureLine(DataPtr theData,
const std::string& theAttribute);
-boost::shared_ptr<GeomAPI_Pnt2d> getProjectionPoint(
- const boost::shared_ptr<SketchPlugin_Line>& theLine,
- const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint);
+std::shared_ptr<GeomAPI_Pnt2d> getProjectionPoint(
+ const std::shared_ptr<SketchPlugin_Line>& theLine,
+ const std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
#endif
void SketchPlugin_ConstraintLength::execute()
{
- boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_AttributeRefAttr> aRef = std::dynamic_pointer_cast<
ModelAPI_AttributeRefAttr>(data()->attribute(SketchPlugin_Constraint::ENTITY_A()));
FeaturePtr aFeature = ModelAPI_Feature::feature(aRef->object());
if (aFeature) {
// set length value
- boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 = boost::dynamic_pointer_cast<
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint1 = std::dynamic_pointer_cast<
GeomDataAPI_Point2D>(aFeature->data()->attribute(SketchPlugin_Line::START_ID()));
- boost::shared_ptr<GeomDataAPI_Point2D> aPoint2 = boost::dynamic_pointer_cast<
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint2 = std::dynamic_pointer_cast<
GeomDataAPI_Point2D>(aFeature->data()->attribute(SketchPlugin_Line::END_ID()));
double aLenght = aPoint1->pnt()->distance(aPoint2->pnt());
- boost::shared_ptr<ModelAPI_AttributeDouble> aValueAttr = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_AttributeDouble> aValueAttr = std::dynamic_pointer_cast<
ModelAPI_AttributeDouble>(data()->attribute(SketchPlugin_Constraint::VALUE()));
if(!aValueAttr->isInitialized()) {
aValueAttr->setValue(aLenght);
if (!sketch())
return thePrevious;
- boost::shared_ptr<GeomAPI_Pln> aPlane = sketch()->plane();
+ std::shared_ptr<GeomAPI_Pln> aPlane = sketch()->plane();
- boost::shared_ptr<ModelAPI_AttributeRefAttr> anAttr = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_AttributeRefAttr> anAttr = std::dynamic_pointer_cast<
ModelAPI_AttributeRefAttr>(data()->attribute(SketchPlugin_Constraint::ENTITY_A()));
if (!anAttr)
return thePrevious;
if (!aFeature || aFeature->getKind() != SketchPlugin_Line::ID())
return thePrevious;
- boost::shared_ptr<GeomDataAPI_Point2D> aFlyOutAttr = boost::dynamic_pointer_cast<
+ std::shared_ptr<GeomDataAPI_Point2D> aFlyOutAttr = std::dynamic_pointer_cast<
GeomDataAPI_Point2D>(data()->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
DataPtr aData = aFeature->data();
- boost::shared_ptr<GeomDataAPI_Point2D> aStartPoint = boost::dynamic_pointer_cast<
+ std::shared_ptr<GeomDataAPI_Point2D> aStartPoint = std::dynamic_pointer_cast<
GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Line::START_ID()));
- boost::shared_ptr<GeomDataAPI_Point2D> anEndPoint = boost::dynamic_pointer_cast<
+ std::shared_ptr<GeomDataAPI_Point2D> anEndPoint = std::dynamic_pointer_cast<
GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Line::END_ID()));
- boost::shared_ptr<GeomAPI_Pnt> aPoint1 = sketch()->to3D(aStartPoint->x(), aStartPoint->y());
- boost::shared_ptr<GeomAPI_Pnt> aPoint2 = sketch()->to3D(anEndPoint->x(), anEndPoint->y());
- boost::shared_ptr<GeomAPI_Pnt> aFlyoutPnt = boost::shared_ptr<GeomAPI_Pnt>();
+ std::shared_ptr<GeomAPI_Pnt> aPoint1 = sketch()->to3D(aStartPoint->x(), aStartPoint->y());
+ std::shared_ptr<GeomAPI_Pnt> aPoint2 = sketch()->to3D(anEndPoint->x(), anEndPoint->y());
+ std::shared_ptr<GeomAPI_Pnt> aFlyoutPnt = std::shared_ptr<GeomAPI_Pnt>();
if (aFlyOutAttr->isInitialized()) {
aFlyoutPnt = sketch()->to3D(aFlyOutAttr->x(), aFlyOutAttr->y());
} else {
- boost::shared_ptr<GeomAPI_Lin2d> aLine =
- boost::shared_ptr<GeomAPI_Lin2d>(new GeomAPI_Lin2d(aStartPoint->pnt(), anEndPoint->pnt()));
+ std::shared_ptr<GeomAPI_Lin2d> aLine =
+ std::shared_ptr<GeomAPI_Lin2d>(new GeomAPI_Lin2d(aStartPoint->pnt(), anEndPoint->pnt()));
double aDist = aPoint1->distance(aPoint2)/5.;
- boost::shared_ptr<GeomAPI_Pnt2d> aFPnt = aLine->shiftedLocation(aDist);
+ std::shared_ptr<GeomAPI_Pnt2d> aFPnt = aLine->shiftedLocation(aDist);
aFlyOutAttr->setValue(aFPnt);
aFlyoutPnt = sketch()->to3D(aFPnt->x(), aFPnt->y());
}
// value calculation
- boost::shared_ptr<ModelAPI_AttributeDouble> aValueAttr = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_AttributeDouble> aValueAttr = std::dynamic_pointer_cast<
ModelAPI_AttributeDouble>(data()->attribute(SketchPlugin_Constraint::VALUE()));
double aValue = aValueAttr->value();
void SketchPlugin_ConstraintLength::move(double theDeltaX, double theDeltaY)
{
- boost::shared_ptr<ModelAPI_Data> aData = data();
+ std::shared_ptr<ModelAPI_Data> aData = data();
if (!aData->isValid())
return;
- boost::shared_ptr<GeomDataAPI_Point2D> aPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
aPoint->move(theDeltaX, theDeltaY);
}
if (!sketch())
return thePrevious;
- boost::shared_ptr<ModelAPI_Data> aData = data();
- boost::shared_ptr<ModelAPI_AttributeRefAttr> anAttr1 = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_Data> aData = data();
+ std::shared_ptr<ModelAPI_AttributeRefAttr> anAttr1 = std::dynamic_pointer_cast<
ModelAPI_AttributeRefAttr>(aData->attribute(SketchPlugin_Constraint::ENTITY_A()));
- boost::shared_ptr<ModelAPI_AttributeRefAttr> anAttr2 = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_AttributeRefAttr> anAttr2 = std::dynamic_pointer_cast<
ModelAPI_AttributeRefAttr>(aData->attribute(SketchPlugin_Constraint::ENTITY_B()));
if (!anAttr1 || !anAttr1->isObject() || !anAttr2 || !anAttr2->isObject())
return thePrevious;
FeaturePtr aFeature = ModelAPI_Feature::feature(anAttr1->object());
if (!aFeature)
return thePrevious;
- boost::shared_ptr<SketchPlugin_Line> aLine1Feature =
- boost::dynamic_pointer_cast<SketchPlugin_Line>(aFeature);
+ std::shared_ptr<SketchPlugin_Line> aLine1Feature =
+ std::dynamic_pointer_cast<SketchPlugin_Line>(aFeature);
aFeature = ModelAPI_Feature::feature(anAttr2->object());
if (!aFeature)
return thePrevious;
- boost::shared_ptr<SketchPlugin_Line> aLine2Feature =
- boost::dynamic_pointer_cast<SketchPlugin_Line>(aFeature);
+ std::shared_ptr<SketchPlugin_Line> aLine2Feature =
+ std::dynamic_pointer_cast<SketchPlugin_Line>(aFeature);
if (!aLine1Feature || !aLine2Feature)
return thePrevious;
- boost::shared_ptr<GeomAPI_Pln> aPlane = sketch()->plane();
- boost::shared_ptr<GeomAPI_Shape> aLine1, aLine2;
- boost::shared_ptr<ModelAPI_ResultConstruction> aConst1 = boost::dynamic_pointer_cast<
+ std::shared_ptr<GeomAPI_Pln> aPlane = sketch()->plane();
+ std::shared_ptr<GeomAPI_Shape> aLine1, aLine2;
+ std::shared_ptr<ModelAPI_ResultConstruction> aConst1 = std::dynamic_pointer_cast<
ModelAPI_ResultConstruction>(anAttr1->object());
if (aConst1)
aLine1 = aConst1->shape();
- boost::shared_ptr<ModelAPI_ResultConstruction> aConst2 = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_ResultConstruction> aConst2 = std::dynamic_pointer_cast<
ModelAPI_ResultConstruction>(anAttr2->object());
if (aConst2)
aLine2 = aConst2->shape();
- boost::shared_ptr<GeomDataAPI_Point2D> aFlyoutAttr = boost::dynamic_pointer_cast<
+ std::shared_ptr<GeomDataAPI_Point2D> aFlyoutAttr = std::dynamic_pointer_cast<
GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
- boost::shared_ptr<GeomAPI_Pnt> aFlyoutPnt = boost::shared_ptr<GeomAPI_Pnt>();;
+ std::shared_ptr<GeomAPI_Pnt> aFlyoutPnt = std::shared_ptr<GeomAPI_Pnt>();;
if(aFlyoutAttr->isInitialized()) {
aFlyoutPnt = sketch()->to3D(aFlyoutAttr->x(), aFlyoutAttr->y());
}
void SketchPlugin_ConstraintParallel::move(double theDeltaX, double theDeltaY)
{
- boost::shared_ptr<ModelAPI_Data> aData = data();
+ std::shared_ptr<ModelAPI_Data> aData = data();
if (!aData->isValid())
return;
- boost::shared_ptr<GeomDataAPI_Point2D> aPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
aPoint->move(theDeltaX, theDeltaY);
}
if (!sketch())
return thePrevious;
- boost::shared_ptr<ModelAPI_Data> aData = data();
- boost::shared_ptr<ModelAPI_AttributeRefAttr> anAttr1 = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_Data> aData = data();
+ std::shared_ptr<ModelAPI_AttributeRefAttr> anAttr1 = std::dynamic_pointer_cast<
ModelAPI_AttributeRefAttr>(aData->attribute(SketchPlugin_Constraint::ENTITY_A()));
- boost::shared_ptr<ModelAPI_AttributeRefAttr> anAttr2 = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_AttributeRefAttr> anAttr2 = std::dynamic_pointer_cast<
ModelAPI_AttributeRefAttr>(aData->attribute(SketchPlugin_Constraint::ENTITY_B()));
if (!anAttr1 || !anAttr1->isObject() || !anAttr2 || !anAttr2->isObject())
return thePrevious;
FeaturePtr aFeature = ModelAPI_Feature::feature(anAttr1->object());
if (!aFeature)
return thePrevious;
- boost::shared_ptr<SketchPlugin_Line> aLine1Feature =
- boost::dynamic_pointer_cast<SketchPlugin_Line>(aFeature);
+ std::shared_ptr<SketchPlugin_Line> aLine1Feature =
+ std::dynamic_pointer_cast<SketchPlugin_Line>(aFeature);
aFeature = ModelAPI_Feature::feature(anAttr2->object());
if (!aFeature)
return thePrevious;
- boost::shared_ptr<SketchPlugin_Line> aLine2Feature =
- boost::dynamic_pointer_cast<SketchPlugin_Line>(aFeature);
+ std::shared_ptr<SketchPlugin_Line> aLine2Feature =
+ std::dynamic_pointer_cast<SketchPlugin_Line>(aFeature);
if (!aLine1Feature || !aLine2Feature)
return thePrevious;
- boost::shared_ptr<GeomAPI_Pln> aPlane = sketch()->plane();
- boost::shared_ptr<GeomAPI_Shape> aLine1, aLine2;
- boost::shared_ptr<ModelAPI_ResultConstruction> aConst1 = boost::dynamic_pointer_cast<
+ std::shared_ptr<GeomAPI_Pln> aPlane = sketch()->plane();
+ std::shared_ptr<GeomAPI_Shape> aLine1, aLine2;
+ std::shared_ptr<ModelAPI_ResultConstruction> aConst1 = std::dynamic_pointer_cast<
ModelAPI_ResultConstruction>(anAttr1->object());
if (aConst1)
aLine1 = aConst1->shape();
- boost::shared_ptr<ModelAPI_ResultConstruction> aConst2 = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_ResultConstruction> aConst2 = std::dynamic_pointer_cast<
ModelAPI_ResultConstruction>(anAttr2->object());
if (aConst2)
aLine2 = aConst2->shape();
void SketchPlugin_ConstraintRadius::execute()
{
- boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_AttributeRefAttr> aRef = std::dynamic_pointer_cast<
ModelAPI_AttributeRefAttr>(data()->attribute(SketchPlugin_Constraint::ENTITY_A()));
FeaturePtr aFeature = ModelAPI_Feature::feature(aRef->object());
if (aFeature) {
double aRadius = 0;
- boost::shared_ptr<ModelAPI_Data> aData = aFeature->data();
+ std::shared_ptr<ModelAPI_Data> aData = aFeature->data();
if (aFeature->getKind() == SketchPlugin_Circle::ID()) {
- AttributeDoublePtr anAttribute = boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(
+ AttributeDoublePtr anAttribute = std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(
aData->attribute(SketchPlugin_Circle::RADIUS_ID()));
if (anAttribute)
aRadius = anAttribute->value();
} else if (aFeature->getKind() == SketchPlugin_Arc::ID()) {
- boost::shared_ptr<GeomDataAPI_Point2D> aCenterAttr = boost::dynamic_pointer_cast<
+ std::shared_ptr<GeomDataAPI_Point2D> aCenterAttr = std::dynamic_pointer_cast<
GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Arc::CENTER_ID()));
- boost::shared_ptr<GeomDataAPI_Point2D> aStartAttr = boost::dynamic_pointer_cast<
+ std::shared_ptr<GeomDataAPI_Point2D> aStartAttr = std::dynamic_pointer_cast<
GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Arc::START_ID()));
if (aCenterAttr && aStartAttr)
aRadius = aCenterAttr->pnt()->distance(aStartAttr->pnt());
}
- boost::shared_ptr<ModelAPI_AttributeDouble> aValueAttr = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_AttributeDouble> aValueAttr = std::dynamic_pointer_cast<
ModelAPI_AttributeDouble>(data()->attribute(SketchPlugin_Constraint::VALUE()));
if(!aValueAttr->isInitialized()) {
aValueAttr->setValue(aRadius);
if (!sketch())
return thePrevious;
- boost::shared_ptr<ModelAPI_Data> aData = data();
- boost::shared_ptr<ModelAPI_AttributeRefAttr> anAttr = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_Data> aData = data();
+ std::shared_ptr<ModelAPI_AttributeRefAttr> anAttr = std::dynamic_pointer_cast<
ModelAPI_AttributeRefAttr>(aData->attribute(SketchPlugin_Constraint::ENTITY_A()));
if (!anAttr)
return thePrevious;
return thePrevious;
// Flyout point
- boost::shared_ptr<GeomDataAPI_Point2D> aFlyoutAttr = boost::dynamic_pointer_cast<
+ std::shared_ptr<GeomDataAPI_Point2D> aFlyoutAttr = std::dynamic_pointer_cast<
GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
- boost::shared_ptr<GeomAPI_Pnt> aFlyoutPnt;
+ std::shared_ptr<GeomAPI_Pnt> aFlyoutPnt;
if (aFlyoutAttr->isInitialized()) {
aFlyoutPnt = sketch()->to3D(aFlyoutAttr->x(), aFlyoutAttr->y());
}
// Prepare a circle
aData = aFeature->data();
- boost::shared_ptr<GeomDataAPI_Point2D> aCenterAttr;
+ std::shared_ptr<GeomDataAPI_Point2D> aCenterAttr;
double aRadius;
if (aKind == SketchPlugin_Circle::ID()) {
- aCenterAttr = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ aCenterAttr = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aData->attribute(SketchPlugin_Circle::CENTER_ID()));
- AttributeDoublePtr aCircRadius = boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(
+ AttributeDoublePtr aCircRadius = std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(
aData->attribute(SketchPlugin_Circle::RADIUS_ID()));
aRadius = aCircRadius->value();
if (!aFlyoutPnt) {
double aShift = aRadius * 1.1;
- boost::shared_ptr<GeomAPI_Pnt2d> aPnt = aCenterAttr->pnt();
- boost::shared_ptr<GeomAPI_Pnt2d> aFPnt =
- boost::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(aPnt->x() + aShift, aPnt->y() + aShift));
+ std::shared_ptr<GeomAPI_Pnt2d> aPnt = aCenterAttr->pnt();
+ std::shared_ptr<GeomAPI_Pnt2d> aFPnt =
+ std::shared_ptr<GeomAPI_Pnt2d>(new GeomAPI_Pnt2d(aPnt->x() + aShift, aPnt->y() + aShift));
aFlyoutAttr->setValue(aFPnt);
aFlyoutPnt = sketch()->to3D(aFPnt->x(), aFPnt->y());
}
} else if (aKind == SketchPlugin_Arc::ID()) {
- aCenterAttr = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ aCenterAttr = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aData->attribute(SketchPlugin_Arc::CENTER_ID()));
- boost::shared_ptr<GeomDataAPI_Point2D> aStartAttr = boost::dynamic_pointer_cast<
+ std::shared_ptr<GeomDataAPI_Point2D> aStartAttr = std::dynamic_pointer_cast<
GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Arc::START_ID()));
aRadius = aCenterAttr->pnt()->distance(aStartAttr->pnt());
if (!aFlyoutPnt) {
- boost::shared_ptr<GeomDataAPI_Point2D> aStartAttr = boost::dynamic_pointer_cast<
+ std::shared_ptr<GeomDataAPI_Point2D> aStartAttr = std::dynamic_pointer_cast<
GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Arc::START_ID()));
aFlyoutAttr->setValue(aStartAttr->pnt());
aFlyoutPnt = sketch()->to3D(aStartAttr->pnt()->x(), aStartAttr->pnt()->y());
}
}
- boost::shared_ptr<GeomAPI_Pnt> aCenter = sketch()->to3D(aCenterAttr->x(), aCenterAttr->y());
- boost::shared_ptr<GeomDataAPI_Dir> aNDir = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+ std::shared_ptr<GeomAPI_Pnt> aCenter = sketch()->to3D(aCenterAttr->x(), aCenterAttr->y());
+ std::shared_ptr<GeomDataAPI_Dir> aNDir = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
sketch()->data()->attribute(SketchPlugin_Sketch::NORM_ID()));
- boost::shared_ptr<GeomAPI_Dir> aNormal = aNDir->dir();
- boost::shared_ptr<GeomAPI_Circ> aCircle(new GeomAPI_Circ(aCenter, aNormal, aRadius));
+ std::shared_ptr<GeomAPI_Dir> aNormal = aNDir->dir();
+ std::shared_ptr<GeomAPI_Circ> aCircle(new GeomAPI_Circ(aCenter, aNormal, aRadius));
// Value
- boost::shared_ptr<ModelAPI_AttributeDouble> aValueAttr = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_AttributeDouble> aValueAttr = std::dynamic_pointer_cast<
ModelAPI_AttributeDouble>(aData->attribute(SketchPlugin_Constraint::VALUE()));
double aValue = aRadius;
if (aValueAttr && aValueAttr->isInitialized())
void SketchPlugin_ConstraintRadius::move(double theDeltaX, double theDeltaY)
{
- boost::shared_ptr<ModelAPI_Data> aData = data();
+ std::shared_ptr<ModelAPI_Data> aData = data();
if (!aData->isValid())
return;
- boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_AttributeRefAttr> aRef = std::dynamic_pointer_cast<
ModelAPI_AttributeRefAttr>(data()->attribute(SketchPlugin_Constraint::ENTITY_A()));
FeaturePtr aFeature = ModelAPI_Feature::feature(aRef->object());
if (!aFeature)
aCenterAttrName = SketchPlugin_Circle::CENTER_ID();
else if (aFeature->getKind() == SketchPlugin_Arc::ID())
aCenterAttrName = SketchPlugin_Arc::CENTER_ID();
- boost::shared_ptr<GeomDataAPI_Point2D> aCenterAttr = boost::dynamic_pointer_cast<
+ std::shared_ptr<GeomDataAPI_Point2D> aCenterAttr = std::dynamic_pointer_cast<
GeomDataAPI_Point2D>(aFeature->data()->attribute(aCenterAttrName));
- boost::shared_ptr<GeomAPI_Pnt2d> aCenter = aCenterAttr->pnt();
+ std::shared_ptr<GeomAPI_Pnt2d> aCenter = aCenterAttr->pnt();
// The specified delta applied on the circle curve,
// so it will be scaled due to distance between flyout and center points
- boost::shared_ptr<GeomDataAPI_Point2D> aFlyoutAttr = boost::dynamic_pointer_cast<
+ std::shared_ptr<GeomDataAPI_Point2D> aFlyoutAttr = std::dynamic_pointer_cast<
GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
- boost::shared_ptr<GeomAPI_Pnt2d> aFlyout = aFlyoutAttr->pnt();
+ std::shared_ptr<GeomAPI_Pnt2d> aFlyout = aFlyoutAttr->pnt();
- boost::shared_ptr<ModelAPI_AttributeDouble> aRadius = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_AttributeDouble> aRadius = std::dynamic_pointer_cast<
ModelAPI_AttributeDouble>(aData->attribute(SketchPlugin_Constraint::VALUE()));
double aScale = aFlyout->distance(aCenter) / aRadius->value();
- boost::shared_ptr<GeomAPI_Circ2d> aCircle(new GeomAPI_Circ2d(aCenter, aFlyout));
+ std::shared_ptr<GeomAPI_Circ2d> aCircle(new GeomAPI_Circ2d(aCenter, aFlyout));
aFlyout->setX(aFlyout->x() + aScale * theDeltaX);
aFlyout->setY(aFlyout->y() + aScale * theDeltaY);
aFlyout = aCircle->project(aFlyout);
if (!sketch())
return thePrevious;
- boost::shared_ptr<ModelAPI_Data> aData = data();
- boost::shared_ptr<ModelAPI_AttributeRefAttr> anAttr = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_Data> aData = data();
+ std::shared_ptr<ModelAPI_AttributeRefAttr> anAttr = std::dynamic_pointer_cast<
ModelAPI_AttributeRefAttr>(aData->attribute(SketchPlugin_Constraint::ENTITY_A()));
if (!anAttr /*|| !anAttr->isObject()*/)
return thePrevious;
- boost::shared_ptr<GeomAPI_Shape> aShape;
+ std::shared_ptr<GeomAPI_Shape> aShape;
if (anAttr->isObject()) {
- boost::shared_ptr<ModelAPI_ResultConstruction> aConst;
- aConst = boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(anAttr->object());
+ std::shared_ptr<ModelAPI_ResultConstruction> aConst;
+ aConst = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(anAttr->object());
if (!aConst)
return thePrevious;
aShape = aConst->shape();
}
else {
- boost::shared_ptr<GeomDataAPI_Point2D> aPointAttr =
- boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(anAttr->attr());
+ std::shared_ptr<GeomDataAPI_Point2D> aPointAttr =
+ std::dynamic_pointer_cast<GeomDataAPI_Point2D>(anAttr->attr());
if (!aPointAttr)
return thePrevious;
- boost::shared_ptr<GeomAPI_Pnt> aPoint(sketch()->to3D(aPointAttr->x(), aPointAttr->y()));
+ std::shared_ptr<GeomAPI_Pnt> aPoint(sketch()->to3D(aPointAttr->x(), aPointAttr->y()));
aShape = GeomAlgoAPI_PointBuilder::point(aPoint);
}
if (!anAIS)
anAIS = AISObjectPtr(new GeomAPI_AISObject);
- boost::shared_ptr<GeomAPI_Pln> aPlane = sketch()->plane();
+ std::shared_ptr<GeomAPI_Pln> aPlane = sketch()->plane();
anAIS->createFixed(aShape, aPlane);
// Set color from preferences
const std::set<AttributePtr>& aBackRefs = data()->refsToMe();
std::set<AttributePtr>::const_iterator aBackRef = aBackRefs.begin();
for(; aBackRef != aBackRefs.end(); aBackRef++) {
- boost::shared_ptr<SketchPlugin_Sketch> aSketch =
- boost::dynamic_pointer_cast<SketchPlugin_Sketch>((*aBackRef)->owner());
+ std::shared_ptr<SketchPlugin_Sketch> aSketch =
+ std::dynamic_pointer_cast<SketchPlugin_Sketch>((*aBackRef)->owner());
if (aSketch) {
mySketch = aSketch.get();
break;
return mySketch;
}
-AISObjectPtr SketchPlugin_Feature::simpleAISObject(boost::shared_ptr<ModelAPI_Result> theRes,
+AISObjectPtr SketchPlugin_Feature::simpleAISObject(std::shared_ptr<ModelAPI_Result> theRes,
AISObjectPtr thePrevious)
{
- boost::shared_ptr<ModelAPI_ResultConstruction> aConstr = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_ResultConstruction> aConstr = std::dynamic_pointer_cast<
ModelAPI_ResultConstruction>(theRes);
- boost::shared_ptr<GeomAPI_Shape> aPreview;
+ std::shared_ptr<GeomAPI_Shape> aPreview;
if (aConstr)
aPreview = aConstr->shape();
{
public:
/// Simple creation of interactive object by the result of the object
- static AISObjectPtr simpleAISObject(boost::shared_ptr<ModelAPI_Result> theRes,
+ static AISObjectPtr simpleAISObject(std::shared_ptr<ModelAPI_Result> theRes,
AISObjectPtr thePrevious);
/// Reference to the external edge or vertex as a AttributeSelection
/// Return the distance between the feature and the point
/// \param thePoint the point
- virtual double distanceToPoint(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint) = 0;
+ virtual double distanceToPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint) = 0;
/// Construction result is allways recomuted on the fly
SKETCHPLUGIN_EXPORT virtual bool isPersistentResult() {return false;}
friend class SketchPlugin_Sketch;
private:
- boost::shared_ptr<GeomAPI_Shape> myPreview; ///< the preview shape
+ std::shared_ptr<GeomAPI_Shape> myPreview; ///< the preview shape
SketchPlugin_Sketch* mySketch; /// sketch that contains this feature
};
SketchPlugin_Sketch* aSketch = sketch();
if (aSketch) {
// compute a start point in 3D view
- boost::shared_ptr<GeomDataAPI_Point2D> aStartAttr = boost::dynamic_pointer_cast<
+ std::shared_ptr<GeomDataAPI_Point2D> aStartAttr = std::dynamic_pointer_cast<
GeomDataAPI_Point2D>(data()->attribute(START_ID()));
// compute an end point in 3D view
- boost::shared_ptr<GeomDataAPI_Point2D> anEndAttr = boost::dynamic_pointer_cast<
+ std::shared_ptr<GeomDataAPI_Point2D> anEndAttr = std::dynamic_pointer_cast<
GeomDataAPI_Point2D>(data()->attribute(END_ID()));
if (aStartAttr->isInitialized() && anEndAttr->isInitialized()) {
- boost::shared_ptr<GeomAPI_Pnt> aStart(aSketch->to3D(aStartAttr->x(), aStartAttr->y()));
- boost::shared_ptr<GeomAPI_Pnt> anEnd(aSketch->to3D(anEndAttr->x(), anEndAttr->y()));
+ std::shared_ptr<GeomAPI_Pnt> aStart(aSketch->to3D(aStartAttr->x(), aStartAttr->y()));
+ std::shared_ptr<GeomAPI_Pnt> anEnd(aSketch->to3D(anEndAttr->x(), anEndAttr->y()));
//std::cout<<"Execute line "<<aStart->x()<<" "<<aStart->y()<<" "<<aStart->z()<<" - "
// <<anEnd->x()<<" "<<anEnd->y()<<" "<<anEnd->z()<<std::endl;
// make linear edge
- boost::shared_ptr<GeomAPI_Edge> anEdge = GeomAlgoAPI_EdgeBuilder::line(aStart, anEnd);
+ std::shared_ptr<GeomAPI_Edge> anEdge = GeomAlgoAPI_EdgeBuilder::line(aStart, anEnd);
// store the result
- boost::shared_ptr<ModelAPI_ResultConstruction> aConstr = document()->createConstruction(
+ std::shared_ptr<ModelAPI_ResultConstruction> aConstr = document()->createConstruction(
data());
aConstr->setShape(anEdge);
aConstr->setIsInHistory(false);
void SketchPlugin_Line::move(double theDeltaX, double theDeltaY)
{
- boost::shared_ptr<ModelAPI_Data> aData = data();
+ std::shared_ptr<ModelAPI_Data> aData = data();
if (!aData->isValid())
return;
- boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint1 = std::dynamic_pointer_cast<GeomDataAPI_Point2D>
(aData->attribute(START_ID()));
aPoint1->move(theDeltaX, theDeltaY);
- boost::shared_ptr<GeomDataAPI_Point2D> aPoint2 = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint2 = std::dynamic_pointer_cast<GeomDataAPI_Point2D>
(aData->attribute(END_ID()));
aPoint2->move(theDeltaX, theDeltaY);
}
-double SketchPlugin_Line::distanceToPoint(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint)
+double SketchPlugin_Line::distanceToPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint)
{
double aDelta = 0;
- boost::shared_ptr<ModelAPI_Data> aData = data();
- boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 =
- boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(START_ID()));
- boost::shared_ptr<GeomDataAPI_Point2D> aPoint2 =
- boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(END_ID()));
+ std::shared_ptr<ModelAPI_Data> aData = data();
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint1 =
+ std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(START_ID()));
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint2 =
+ std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(END_ID()));
GeomAPI_Lin2d aLin2d(aPoint1->x(), aPoint1->y(), aPoint2->x(), aPoint2->y());
if (false/*projection*/) { // TODO: if it has not been necessary, remove this block
- boost::shared_ptr<GeomAPI_Pnt2d> aResult = aLin2d.project(thePoint);
+ std::shared_ptr<GeomAPI_Pnt2d> aResult = aLin2d.project(thePoint);
aDelta = aResult->distance(thePoint);
} else { // distance
aDelta = aLin2d.distance(thePoint);
void SketchPlugin_Line::attributeChanged() {
static bool myIsUpdated = false; // to avoid infinitive cycle on attrubtes change
- boost::shared_ptr<GeomAPI_Shape> aSelection = data()->selection(EXTERNAL_ID())->value();
+ std::shared_ptr<GeomAPI_Shape> aSelection = data()->selection(EXTERNAL_ID())->value();
// update arguments due to the selection value
if (aSelection && !aSelection->isNull() && aSelection->isEdge() && !myIsUpdated) {
myIsUpdated = true;
- boost::shared_ptr<GeomAPI_Edge> anEdge( new GeomAPI_Edge(aSelection));
- boost::shared_ptr<GeomDataAPI_Point2D> aStartAttr =
- boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(attribute(START_ID()));
+ std::shared_ptr<GeomAPI_Edge> anEdge( new GeomAPI_Edge(aSelection));
+ std::shared_ptr<GeomDataAPI_Point2D> aStartAttr =
+ std::dynamic_pointer_cast<GeomDataAPI_Point2D>(attribute(START_ID()));
aStartAttr->setValue(sketch()->to2D(anEdge->firstPoint()));
- boost::shared_ptr<GeomDataAPI_Point2D> anEndAttr =
- boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(attribute(END_ID()));
+ std::shared_ptr<GeomDataAPI_Point2D> anEndAttr =
+ std::dynamic_pointer_cast<GeomDataAPI_Point2D>(attribute(END_ID()));
anEndAttr->setValue(sketch()->to2D(anEdge->lastPoint()));
myIsUpdated = false;
}
/// Return the distance between the feature and the point
/// \param thePoint the point
- virtual double distanceToPoint(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint);
+ virtual double distanceToPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
/// Called on change of any argument-attribute of this object
SKETCHPLUGIN_EXPORT virtual void attributeChanged();
SketchPlugin_Sketch* aSketch = sketch();
if (aSketch) {
// compute a point in 3D view
- boost::shared_ptr<GeomDataAPI_Point2D> aPoint =
- boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint =
+ std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
data()->attribute(SketchPlugin_Point::COORD_ID()));
- boost::shared_ptr<GeomAPI_Pnt> aPoint3D(aSketch->to3D(aPoint->x(), aPoint->y()));
+ std::shared_ptr<GeomAPI_Pnt> aPoint3D(aSketch->to3D(aPoint->x(), aPoint->y()));
// make a visible point
- boost::shared_ptr<GeomAPI_Shape> aPointShape = GeomAlgoAPI_PointBuilder::point(aPoint3D);
- boost::shared_ptr<ModelAPI_ResultConstruction> aConstr = document()->createConstruction(data());
+ std::shared_ptr<GeomAPI_Shape> aPointShape = GeomAlgoAPI_PointBuilder::point(aPoint3D);
+ std::shared_ptr<ModelAPI_ResultConstruction> aConstr = document()->createConstruction(data());
aConstr->setShape(aPointShape);
aConstr->setIsInHistory(false);
setResult(aConstr);
void SketchPlugin_Point::move(double theDeltaX, double theDeltaY)
{
- boost::shared_ptr<ModelAPI_Data> aData = data();
+ std::shared_ptr<ModelAPI_Data> aData = data();
if (!aData->isValid())
return;
- boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint1 = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aData->attribute(SketchPlugin_Point::COORD_ID()));
aPoint1->move(theDeltaX, theDeltaY);
}
-double SketchPlugin_Point::distanceToPoint(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint)
+double SketchPlugin_Point::distanceToPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint)
{
- boost::shared_ptr<ModelAPI_Data> aData = data();
- boost::shared_ptr<GeomDataAPI_Point2D> aPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ std::shared_ptr<ModelAPI_Data> aData = data();
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aData->attribute(SketchPlugin_Point::COORD_ID()));
return aPoint->pnt()->distance(thePoint);
/// Return the distance between the feature and the point
/// \param thePoint the point
- virtual double distanceToPoint(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint);
+ virtual double distanceToPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
/// Use plugin manager for features creation
SketchPlugin_Point();
ResultPtr result(const ObjectPtr theObject)
{
- return boost::dynamic_pointer_cast<ModelAPI_Result>(theObject);
+ return std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
}
bool SketchPlugin_ResultPointValidator::isValid(const ObjectPtr theObject) const
ResultPtr aResult = result(theObject);
if (!aResult)
return false;
- boost::shared_ptr<GeomAPI_Shape> aShape = ModelAPI_Tools::shape(aResult);
+ std::shared_ptr<GeomAPI_Shape> aShape = ModelAPI_Tools::shape(aResult);
return aShape && aShape->isVertex();
}
ResultPtr aResult = result(theObject);
if (!aResult)
return false;
- boost::shared_ptr<GeomAPI_Shape> aShape = ModelAPI_Tools::shape(aResult);
+ std::shared_ptr<GeomAPI_Shape> aShape = ModelAPI_Tools::shape(aResult);
return aShape && aShape->isEdge() && GeomAPI_Curve(aShape).isLine();
}
ResultPtr aResult = result(theObject);
if (!aResult)
return false;
- boost::shared_ptr<GeomAPI_Shape> aShape = ModelAPI_Tools::shape(aResult);
+ std::shared_ptr<GeomAPI_Shape> aShape = ModelAPI_Tools::shape(aResult);
return aShape && aShape->isEdge() && GeomAPI_Curve(aShape).isCircle();
}
#include <SketchPlugin_Sketch.h>
#include <SketchPlugin_Feature.h>
-#include <boost/smart_ptr/shared_ptr.hpp>
+#include <memory>
#include <math.h>
#include <vector>
{
if (!data()->isValid())
return;
- boost::shared_ptr<ModelAPI_AttributeRefList> aRefList = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_AttributeRefList> aRefList = std::dynamic_pointer_cast<
ModelAPI_AttributeRefList>(data()->attribute(SketchPlugin_Sketch::FEATURES_ID()));
- boost::shared_ptr<GeomDataAPI_Point> anOrigin = boost::dynamic_pointer_cast<GeomDataAPI_Point>(
+ std::shared_ptr<GeomDataAPI_Point> anOrigin = std::dynamic_pointer_cast<GeomDataAPI_Point>(
data()->attribute(SketchPlugin_Sketch::ORIGIN_ID()));
- boost::shared_ptr<GeomDataAPI_Dir> aDirX = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+ std::shared_ptr<GeomDataAPI_Dir> aDirX = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
data()->attribute(SketchPlugin_Sketch::DIRX_ID()));
- boost::shared_ptr<GeomDataAPI_Dir> aDirY = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+ std::shared_ptr<GeomDataAPI_Dir> aDirY = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
data()->attribute(SketchPlugin_Sketch::DIRY_ID()));
- boost::shared_ptr<GeomDataAPI_Dir> aNorm = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+ std::shared_ptr<GeomDataAPI_Dir> aNorm = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
data()->attribute(SketchPlugin_Sketch::NORM_ID()));
std::list<ObjectPtr> aFeatures = aRefList->list();
return;
std::list<ObjectPtr>::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end();
- boost::shared_ptr<SketchPlugin_Feature> aFeature;
- std::list<boost::shared_ptr<GeomAPI_Shape> > aFeaturesPreview;
+ std::shared_ptr<SketchPlugin_Feature> aFeature;
+ std::list<std::shared_ptr<GeomAPI_Shape> > aFeaturesPreview;
for (; anIt != aLast; anIt++) {
- aFeature = boost::dynamic_pointer_cast<SketchPlugin_Feature>(*anIt);
+ aFeature = std::dynamic_pointer_cast<SketchPlugin_Feature>(*anIt);
if (aFeature) {
if (!aFeature->sketch()) // on load document the back references are missed
aFeature->setSketch(this);
continue;
}
- const std::list<boost::shared_ptr<ModelAPI_Result> >& aRes = aFeature->results();
- std::list<boost::shared_ptr<ModelAPI_Result> >::const_iterator aResIter = aRes.cbegin();
+ const std::list<std::shared_ptr<ModelAPI_Result> >& aRes = aFeature->results();
+ std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aResIter = aRes.cbegin();
for (; aResIter != aRes.cend(); aResIter++) {
- boost::shared_ptr<ModelAPI_ResultConstruction> aConstr = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_ResultConstruction> aConstr = std::dynamic_pointer_cast<
ModelAPI_ResultConstruction>(*aResIter);
if (aConstr) {
- boost::shared_ptr<GeomAPI_Shape> aShape = aConstr->shape();
+ std::shared_ptr<GeomAPI_Shape> aShape = aConstr->shape();
if (aShape)
aFeaturesPreview.push_back(aShape);
}
return;
// Collect all edges as one big wire
- boost::shared_ptr<GeomAPI_PlanarEdges> aBigWire(new GeomAPI_PlanarEdges);
- std::list<boost::shared_ptr<GeomAPI_Shape> >::const_iterator aShapeIt = aFeaturesPreview.begin();
+ std::shared_ptr<GeomAPI_PlanarEdges> aBigWire(new GeomAPI_PlanarEdges);
+ std::list<std::shared_ptr<GeomAPI_Shape> >::const_iterator aShapeIt = aFeaturesPreview.begin();
for (; aShapeIt != aFeaturesPreview.end(); ++aShapeIt) {
aBigWire->addEdge(*aShapeIt);
}
// GeomAlgoAPI_SketchBuilder::createFaces(anOrigin->pnt(), aDirX->dir(), aDirY->dir(), aNorm->dir(),
// aFeaturesPreview, aLoops, aWires);
- boost::shared_ptr<ModelAPI_ResultConstruction> aConstr = document()->createConstruction(data());
+ std::shared_ptr<ModelAPI_ResultConstruction> aConstr = document()->createConstruction(data());
aConstr->setShape(aBigWire);
setResult(aConstr);
}
-boost::shared_ptr<ModelAPI_Feature> SketchPlugin_Sketch::addFeature(std::string theID)
+std::shared_ptr<ModelAPI_Feature> SketchPlugin_Sketch::addFeature(std::string theID)
{
- boost::shared_ptr<ModelAPI_Feature> aNew = document()->addFeature(theID);
+ std::shared_ptr<ModelAPI_Feature> aNew = document()->addFeature(theID);
if (aNew) {
- boost::dynamic_pointer_cast<SketchPlugin_Feature>(aNew)->setSketch(this);
+ std::dynamic_pointer_cast<SketchPlugin_Feature>(aNew)->setSketch(this);
data()->reflist(SketchPlugin_Sketch::FEATURES_ID())->append(aNew);
}
return aNew;
return data()->reflist(SketchPlugin_Sketch::FEATURES_ID())->size();
}
-boost::shared_ptr<ModelAPI_Feature> SketchPlugin_Sketch::subFeature(const int theIndex) const
+std::shared_ptr<ModelAPI_Feature> SketchPlugin_Sketch::subFeature(const int theIndex) const
{
ObjectPtr anObj = data()->reflist(SketchPlugin_Sketch::FEATURES_ID())->object(theIndex);
- return boost::dynamic_pointer_cast<ModelAPI_Feature>(anObj);
+ return std::dynamic_pointer_cast<ModelAPI_Feature>(anObj);
}
int SketchPlugin_Sketch::subFeatureId(const int theIndex) const
bool SketchPlugin_Sketch::isSub(ObjectPtr theObject) const
{
// check is this feature of result
- FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(theObject);
+ FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theObject);
if (!aFeature) {
- ResultPtr aRes = boost::dynamic_pointer_cast<ModelAPI_Result>(theObject);
+ ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
if (aRes)
aFeature = document()->feature(aRes);
}
return false;
}
-boost::shared_ptr<GeomAPI_Pnt> SketchPlugin_Sketch::to3D(const double theX, const double theY)
+std::shared_ptr<GeomAPI_Pnt> SketchPlugin_Sketch::to3D(const double theX, const double theY)
{
- boost::shared_ptr<GeomDataAPI_Point> aC = boost::dynamic_pointer_cast<GeomDataAPI_Point>(
+ std::shared_ptr<GeomDataAPI_Point> aC = std::dynamic_pointer_cast<GeomDataAPI_Point>(
data()->attribute(SketchPlugin_Sketch::ORIGIN_ID()));
- boost::shared_ptr<GeomDataAPI_Dir> aX = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+ std::shared_ptr<GeomDataAPI_Dir> aX = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
data()->attribute(SketchPlugin_Sketch::DIRX_ID()));
- boost::shared_ptr<GeomDataAPI_Dir> aY = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+ std::shared_ptr<GeomDataAPI_Dir> aY = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
data()->attribute(SketchPlugin_Sketch::DIRY_ID()));
- boost::shared_ptr<GeomAPI_XYZ> aSum = aC->pnt()->xyz()->added(aX->dir()->xyz()->multiplied(theX))
+ std::shared_ptr<GeomAPI_XYZ> aSum = aC->pnt()->xyz()->added(aX->dir()->xyz()->multiplied(theX))
->added(aY->dir()->xyz()->multiplied(theY));
- return boost::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aSum));
+ return std::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aSum));
}
-boost::shared_ptr<GeomAPI_Pnt2d> SketchPlugin_Sketch::to2D(
- const boost::shared_ptr<GeomAPI_Pnt>& thePnt)
+std::shared_ptr<GeomAPI_Pnt2d> SketchPlugin_Sketch::to2D(
+ const std::shared_ptr<GeomAPI_Pnt>& thePnt)
{
- boost::shared_ptr<GeomDataAPI_Point> aC = boost::dynamic_pointer_cast<GeomDataAPI_Point>(
+ std::shared_ptr<GeomDataAPI_Point> aC = std::dynamic_pointer_cast<GeomDataAPI_Point>(
data()->attribute(SketchPlugin_Sketch::ORIGIN_ID()));
- boost::shared_ptr<GeomDataAPI_Dir> aX = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+ std::shared_ptr<GeomDataAPI_Dir> aX = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
data()->attribute(SketchPlugin_Sketch::DIRX_ID()));
- boost::shared_ptr<GeomDataAPI_Dir> aY = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+ std::shared_ptr<GeomDataAPI_Dir> aY = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
data()->attribute(SketchPlugin_Sketch::DIRY_ID()));
return thePnt->to2D(aC->pnt(), aX->dir(), aY->dir());
}
bool SketchPlugin_Sketch::isPlaneSet()
{
- boost::shared_ptr<GeomDataAPI_Dir> aNormal = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+ std::shared_ptr<GeomDataAPI_Dir> aNormal = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
data()->attribute(SketchPlugin_Sketch::NORM_ID()));
return aNormal && !(aNormal->x() == 0 && aNormal->y() == 0 && aNormal->z() == 0);
}
-boost::shared_ptr<GeomAPI_Pln> SketchPlugin_Sketch::plane()
+std::shared_ptr<GeomAPI_Pln> SketchPlugin_Sketch::plane()
{
- boost::shared_ptr<GeomDataAPI_Point> anOrigin = boost::dynamic_pointer_cast<GeomDataAPI_Point>(
+ std::shared_ptr<GeomDataAPI_Point> anOrigin = std::dynamic_pointer_cast<GeomDataAPI_Point>(
data()->attribute(SketchPlugin_Sketch::ORIGIN_ID()));
- boost::shared_ptr<GeomDataAPI_Dir> aNorm = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+ std::shared_ptr<GeomDataAPI_Dir> aNorm = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
data()->attribute(SketchPlugin_Sketch::NORM_ID()));
if (!anOrigin || !aNorm)
- return boost::shared_ptr<GeomAPI_Pln>();
+ return std::shared_ptr<GeomAPI_Pln>();
- return boost::shared_ptr<GeomAPI_Pln>(new GeomAPI_Pln(anOrigin->pnt(), aNorm->dir()));
+ return std::shared_ptr<GeomAPI_Pln>(new GeomAPI_Pln(anOrigin->pnt(), aNorm->dir()));
}
void addPlane(double theX, double theY, double theZ,
- std::list<boost::shared_ptr<GeomAPI_Shape> >& theShapes)
+ std::list<std::shared_ptr<GeomAPI_Shape> >& theShapes)
{
- boost::shared_ptr<GeomAPI_Pnt> anOrigin(new GeomAPI_Pnt(0, 0, 0));
- boost::shared_ptr<GeomAPI_Dir> aNormal(new GeomAPI_Dir(theX, theY, theZ));
+ std::shared_ptr<GeomAPI_Pnt> anOrigin(new GeomAPI_Pnt(0, 0, 0));
+ std::shared_ptr<GeomAPI_Dir> aNormal(new GeomAPI_Dir(theX, theY, theZ));
double aSize = Config_PropManager::integer("Sketch planes", "Size of planes", PLANE_SIZE);
- boost::shared_ptr<GeomAPI_Shape> aFace = GeomAlgoAPI_FaceBuilder::square(anOrigin, aNormal,
+ std::shared_ptr<GeomAPI_Shape> aFace = GeomAlgoAPI_FaceBuilder::square(anOrigin, aNormal,
aSize);
theShapes.push_back(aFace);
}
AISObjectPtr SketchPlugin_Sketch::getAISObject(AISObjectPtr thePrevious)
{
- boost::shared_ptr<GeomDataAPI_Dir> aNorm = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+ std::shared_ptr<GeomDataAPI_Dir> aNorm = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
data()->attribute(SketchPlugin_Sketch::NORM_ID()));
if (!aNorm || (aNorm->x() == 0 && aNorm->y() == 0 && aNorm->z() == 0)) {
AISObjectPtr aAIS = thePrevious;
if (!aAIS) {
- std::list<boost::shared_ptr<GeomAPI_Shape> > aFaces;
+ std::list<std::shared_ptr<GeomAPI_Shape> > aFaces;
addPlane(1, 0, 0, aFaces); // YZ plane
addPlane(0, 1, 0, aFaces); // XZ plane
addPlane(0, 0, 1, aFaces); // XY plane
- boost::shared_ptr<GeomAPI_Shape> aCompound = GeomAlgoAPI_CompoundBuilder::compound(aFaces);
+ std::shared_ptr<GeomAPI_Shape> aCompound = GeomAlgoAPI_CompoundBuilder::compound(aFaces);
aAIS = AISObjectPtr(new GeomAPI_AISObject());
aAIS->createShape(aCompound);
void SketchPlugin_Sketch::erase()
{
- boost::shared_ptr<ModelAPI_AttributeRefList> aRefList = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_AttributeRefList> aRefList = std::dynamic_pointer_cast<
ModelAPI_AttributeRefList>(data()->attribute(SketchPlugin_Sketch::FEATURES_ID()));
std::list<ObjectPtr> aFeatures = aRefList->list();
std::list<ObjectPtr>::const_iterator anIt = aFeatures.begin();
for (; anIt != aFeatures.end(); anIt++) {
- FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(*anIt);
+ FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(*anIt);
if (aFeature) {
// subs are referenced from sketch, but must be removed for sure, so not checkings
document()->removeFeature(aFeature, false);
void SketchPlugin_Sketch::attributeChanged() {
static bool kIsUpdated = false; // to avoid infinitive cycle on attrubtes change
static bool kIsAttrChanged = false;
- boost::shared_ptr<GeomAPI_Shape> aSelection =
+ std::shared_ptr<GeomAPI_Shape> aSelection =
data()->selection(SketchPlugin_Feature::EXTERNAL_ID())->value();
if (aSelection && !kIsUpdated) { // update arguments due to the selection value
kIsUpdated = true;
// update the sketch plane
- boost::shared_ptr<GeomAPI_Pln> aPlane = GeomAlgoAPI_FaceBuilder::plane(aSelection);
+ std::shared_ptr<GeomAPI_Pln> aPlane = GeomAlgoAPI_FaceBuilder::plane(aSelection);
if (aPlane) {
double anA, aB, aC, aD;
aPlane->coefficients(anA, aB, aC, aD);
// calculate attributes of the sketch
- boost::shared_ptr<GeomAPI_Dir> aNormDir(new GeomAPI_Dir(anA, aB, aC));
- boost::shared_ptr<GeomAPI_XYZ> aCoords = aNormDir->xyz();
- boost::shared_ptr<GeomAPI_XYZ> aZero(new GeomAPI_XYZ(0, 0, 0));
+ std::shared_ptr<GeomAPI_Dir> aNormDir(new GeomAPI_Dir(anA, aB, aC));
+ std::shared_ptr<GeomAPI_XYZ> aCoords = aNormDir->xyz();
+ std::shared_ptr<GeomAPI_XYZ> aZero(new GeomAPI_XYZ(0, 0, 0));
aCoords = aCoords->multiplied(-aD * aCoords->distance(aZero));
- boost::shared_ptr<GeomAPI_Pnt> anOrigPnt(new GeomAPI_Pnt(aCoords));
+ std::shared_ptr<GeomAPI_Pnt> anOrigPnt(new GeomAPI_Pnt(aCoords));
// X axis is preferable to be dirX on the sketch
static const double tol = 1.e-7;
bool isX = fabs(anA - 1.0) < tol && fabs(aB) < tol && fabs(aC) < tol;
- boost::shared_ptr<GeomAPI_Dir> aTempDir(
+ std::shared_ptr<GeomAPI_Dir> aTempDir(
isX ? new GeomAPI_Dir(0, 1, 0) : new GeomAPI_Dir(1, 0, 0));
- boost::shared_ptr<GeomAPI_Dir> aYDir(new GeomAPI_Dir(aNormDir->cross(aTempDir)));
- boost::shared_ptr<GeomAPI_Dir> aXDir(new GeomAPI_Dir(aYDir->cross(aNormDir)));
+ std::shared_ptr<GeomAPI_Dir> aYDir(new GeomAPI_Dir(aNormDir->cross(aTempDir)));
+ std::shared_ptr<GeomAPI_Dir> aXDir(new GeomAPI_Dir(aYDir->cross(aNormDir)));
kIsAttrChanged = false; // track the attributes were really changed during the plane update
- boost::shared_ptr<GeomDataAPI_Point> anOrigin = boost::dynamic_pointer_cast
+ std::shared_ptr<GeomDataAPI_Point> anOrigin = std::dynamic_pointer_cast
<GeomDataAPI_Point>(data()->attribute(SketchPlugin_Sketch::ORIGIN_ID()));
anOrigin->setValue(anOrigPnt);
- boost::shared_ptr<GeomDataAPI_Dir> aNormal = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+ std::shared_ptr<GeomDataAPI_Dir> aNormal = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
data()->attribute(SketchPlugin_Sketch::NORM_ID()));
aNormal->setValue(aNormDir);
- boost::shared_ptr<GeomDataAPI_Dir> aDirX = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+ std::shared_ptr<GeomDataAPI_Dir> aDirX = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
data()->attribute(SketchPlugin_Sketch::DIRX_ID()));
aDirX->setValue(aXDir);
- boost::shared_ptr<GeomDataAPI_Dir> aDirY = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(
+ std::shared_ptr<GeomDataAPI_Dir> aDirY = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
data()->attribute(SketchPlugin_Sketch::DIRY_ID()));
aDirY->setValue(aYDir);
- boost::shared_ptr<GeomAPI_Dir> aDir = aPlane->direction();
+ std::shared_ptr<GeomAPI_Dir> aDir = aPlane->direction();
if (kIsAttrChanged) {
/* now it is in updater
ModelAPI_ValidatorsFactory* aFactory = ModelAPI_Session::get()->validators();
list<ObjectPtr> aSubs = data()->reflist(SketchPlugin_Sketch::FEATURES_ID())->list();
for(list<ObjectPtr>::iterator aSubIt = aSubs.begin(); aSubIt != aSubs.end(); aSubIt++) {
- boost::shared_ptr<SketchPlugin_Feature> aFeature =
- boost::dynamic_pointer_cast<SketchPlugin_Feature>(*aSubIt);
+ std::shared_ptr<SketchPlugin_Feature> aFeature =
+ std::dynamic_pointer_cast<SketchPlugin_Feature>(*aSubIt);
if (aFeature && aFactory->validate(aFeature)) {
aFeature->execute();
}
/// Return the distance between the feature and the point
/// \param thePoint the point
- virtual double distanceToPoint(const boost::shared_ptr<GeomAPI_Pnt2d>& thePoint)
+ virtual double distanceToPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint)
{
return 0;
}
;
/// Converts a 2D sketch space point into point in 3D space
- SKETCHPLUGIN_EXPORT boost::shared_ptr<GeomAPI_Pnt> to3D(const double theX, const double theY);
+ SKETCHPLUGIN_EXPORT std::shared_ptr<GeomAPI_Pnt> to3D(const double theX, const double theY);
/// Returns true if this feature must be displayed in the history (top level of Part tree)
SKETCHPLUGIN_EXPORT virtual bool isInHistory()
SketchPlugin_Sketch();
/// Returns the basis plane for the sketch
- boost::shared_ptr<GeomAPI_Pln> plane();
+ std::shared_ptr<GeomAPI_Pln> plane();
virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious);
/// removes also all sub-sketch elements
SKETCHPLUGIN_EXPORT virtual void erase();
- SKETCHPLUGIN_EXPORT virtual boost::shared_ptr<ModelAPI_Feature> addFeature(std::string theID);
+ SKETCHPLUGIN_EXPORT virtual std::shared_ptr<ModelAPI_Feature> addFeature(std::string theID);
/// Returns the number of sub-elements
SKETCHPLUGIN_EXPORT virtual int numberOfSubs() const;
/// Returns the sub-feature by zero-base index
- SKETCHPLUGIN_EXPORT virtual boost::shared_ptr<ModelAPI_Feature>
+ SKETCHPLUGIN_EXPORT virtual std::shared_ptr<ModelAPI_Feature>
subFeature(const int theIndex) const;
/// Returns the sub-feature unique identifier in this composite feature by zero-base index
SKETCHPLUGIN_EXPORT virtual bool isPersistentResult() {return false;}
/// Returns the point projected into the sketch plane
- boost::shared_ptr<GeomAPI_Pnt2d> to2D(const boost::shared_ptr<GeomAPI_Pnt>& thePnt);
+ std::shared_ptr<GeomAPI_Pnt2d> to2D(const std::shared_ptr<GeomAPI_Pnt>& thePnt);
SKETCHPLUGIN_EXPORT virtual void attributeChanged();
protected:
/// \param theZ the Z normal value
/// \param theShapes the list of result shapes
//void addPlane(double theX, double theY, double theZ,
- // std::list<boost::shared_ptr<GeomAPI_Shape> >& theShapes) const;
+ // std::list<std::shared_ptr<GeomAPI_Shape> >& theShapes) const;
/// Checks whether the plane is set in the sketch.
/// \returns the boolean state
return true;
// If it is a line then we have to check that first attribute id not a line
- boost::shared_ptr<GeomDataAPI_Point2D> aPoint = getFeaturePoint(theFeature->data(), aParamA);
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint = getFeaturePoint(theFeature->data(), aParamA);
if (aPoint)
return true;
return false;
bool SketchPlugin_DistanceAttrValidator::isValid(
const AttributePtr& theAttribute, const std::list<std::string>& theArguments ) const
{
- boost::shared_ptr<ModelAPI_AttributeRefAttr> anAttr =
- boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
+ std::shared_ptr<ModelAPI_AttributeRefAttr> anAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
if (anAttr) {
const ObjectPtr& anObj = theAttribute->owner();
- const FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(anObj);
+ const FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(anObj);
return isValid(aFeature, theArguments, anAttr->object());
}
return true; // it may be not reference attribute, in this case, it is OK
const std::list<std::string>& theArguments,
const ObjectPtr& theObject) const
{
- std::list<boost::shared_ptr<ModelAPI_Attribute> > anAttrs =
+ std::list<std::shared_ptr<ModelAPI_Attribute> > anAttrs =
theFeature->data()->attributes(ModelAPI_AttributeRefAttr::type());
- std::list<boost::shared_ptr<ModelAPI_Attribute> >::iterator anAttr = anAttrs.begin();
+ std::list<std::shared_ptr<ModelAPI_Attribute> >::iterator anAttr = anAttrs.begin();
for(; anAttr != anAttrs.end(); anAttr++) {
if (*anAttr) {
- boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef =
- boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(*anAttr);
+ std::shared_ptr<ModelAPI_AttributeRefAttr> aRef =
+ std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(*anAttr);
// check the object is already presented
if (aRef->isObject() && aRef->object() == theObject)
return false;
bool SketchPlugin_DifferentObjectsValidator::isValid(
const AttributePtr& theAttribute, const std::list<std::string>& theArguments ) const
{
- boost::shared_ptr<ModelAPI_AttributeRefAttr> anOrigAttr =
- boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
+ std::shared_ptr<ModelAPI_AttributeRefAttr> anOrigAttr =
+ std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
if (anOrigAttr && anOrigAttr->isObject()) {
const ObjectPtr& anObj = theAttribute->owner();
- const FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(anObj);
+ const FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(anObj);
- std::list<boost::shared_ptr<ModelAPI_Attribute> > anAttrs =
+ std::list<std::shared_ptr<ModelAPI_Attribute> > anAttrs =
aFeature->data()->attributes(ModelAPI_AttributeRefAttr::type());
- std::list<boost::shared_ptr<ModelAPI_Attribute> >::iterator anAttr = anAttrs.begin();
+ std::list<std::shared_ptr<ModelAPI_Attribute> >::iterator anAttr = anAttrs.begin();
for(; anAttr != anAttrs.end(); anAttr++) {
if (*anAttr && *anAttr != theAttribute) {
- boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef =
- boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(*anAttr);
+ std::shared_ptr<ModelAPI_AttributeRefAttr> aRef =
+ std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(*anAttr);
// check the object is already presented
if (aRef->isObject() && aRef->object() == anOrigAttr->object())
return false;
bool SketchPlugin_DifferentObjectsValidator::isValid(const FeaturePtr& theFeature,
const std::list<std::string>& theArguments, const AttributePtr& theAttribute) const
{
- std::list<boost::shared_ptr<ModelAPI_Attribute> > anAttrs =
+ std::list<std::shared_ptr<ModelAPI_Attribute> > anAttrs =
theFeature->data()->attributes(ModelAPI_AttributeRefAttr::type());
- std::list<boost::shared_ptr<ModelAPI_Attribute> >::iterator anAttr = anAttrs.begin();
+ std::list<std::shared_ptr<ModelAPI_Attribute> >::iterator anAttr = anAttrs.begin();
for(; anAttr != anAttrs.end(); anAttr++) {
if (*anAttr) {
- boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef =
- boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(*anAttr);
+ std::shared_ptr<ModelAPI_AttributeRefAttr> aRef =
+ std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(*anAttr);
// check the object is already presented
if (!aRef->isObject() && aRef->attr() == theAttribute)
return false;
};
/// Calculate type of the attribute
-static AttrType typeOfAttribute(boost::shared_ptr<ModelAPI_Attribute> theAttribute);
+static AttrType typeOfAttribute(std::shared_ptr<ModelAPI_Attribute> theAttribute);
SketchSolver_Constraint::SketchSolver_Constraint()
- : myConstraint(boost::shared_ptr<SketchPlugin_Constraint>()),
+ : myConstraint(std::shared_ptr<SketchPlugin_Constraint>()),
myType(SLVS_C_UNKNOWN),
myAttributesList()
{
}
SketchSolver_Constraint::SketchSolver_Constraint(
- boost::shared_ptr<SketchPlugin_Constraint> theConstraint)
+ std::shared_ptr<SketchPlugin_Constraint> theConstraint)
: myConstraint(theConstraint),
myAttributesList()
{
}
const int& SketchSolver_Constraint::getType(
- boost::shared_ptr<SketchPlugin_Constraint> theConstraint)
+ std::shared_ptr<SketchPlugin_Constraint> theConstraint)
{
myType = SLVS_C_UNKNOWN;
if (!theConstraint)
int aPt2d = 0; // bit-mapped field, each bit indicates whether the attribute is 2D point
int aPt3d = 0; // bit-mapped field, the same information for 3D points
for (unsigned int indAttr = 0; indAttr < CONSTRAINT_ATTR_SIZE; indAttr++) {
- boost::shared_ptr<ModelAPI_Attribute> anAttr =
+ std::shared_ptr<ModelAPI_Attribute> anAttr =
aConstrData->attribute(SketchPlugin_Constraint::ATTRIBUTE(indAttr));
if (!anAttr)
continue;
int aNbPoints = 0;
int aNbEntities = 0;
for (unsigned int indAttr = 0; indAttr < CONSTRAINT_ATTR_SIZE; indAttr++) {
- boost::shared_ptr<ModelAPI_Attribute> anAttr =
+ std::shared_ptr<ModelAPI_Attribute> anAttr =
aConstrData->attribute(SketchPlugin_Constraint::ATTRIBUTE(indAttr));
switch (typeOfAttribute(anAttr)) {
case POINT2D:
if (aConstraintKind.compare(SketchPlugin_ConstraintLength::ID()) == 0) {
int aNbLines = 0;
for (unsigned int indAttr = 0; indAttr < CONSTRAINT_ATTR_SIZE; indAttr++) {
- boost::shared_ptr<ModelAPI_Attribute> anAttr =
+ std::shared_ptr<ModelAPI_Attribute> anAttr =
aConstrData->attribute(SketchPlugin_Constraint::ATTRIBUTE(indAttr));
if (typeOfAttribute(anAttr) == LINE)
myAttributesList[aNbLines++] = SketchPlugin_Constraint::ATTRIBUTE(indAttr);
if (isParallel || isPerpendicular) {
int aNbEntities = 2; // lines in SolveSpace constraints should start from SketchPlugin_Constraint::ENTITY_C() attribute
for (unsigned int indAttr = 0; indAttr < CONSTRAINT_ATTR_SIZE; indAttr++) {
- boost::shared_ptr<ModelAPI_Attribute> anAttr =
+ std::shared_ptr<ModelAPI_Attribute> anAttr =
aConstrData->attribute(SketchPlugin_Constraint::ATTRIBUTE(indAttr));
if (typeOfAttribute(anAttr) == LINE)
myAttributesList[aNbEntities++] = SketchPlugin_Constraint::ATTRIBUTE(indAttr);
if (aConstraintKind.compare(SketchPlugin_ConstraintRadius::ID()) == 0) {
int aNbEntities = 2; // lines in SolveSpace constraints should started from SketchPlugin_Constraint::ENTITY_C() attribute
for (unsigned int indAttr = 0; indAttr < CONSTRAINT_ATTR_SIZE; indAttr++) {
- boost::shared_ptr<ModelAPI_Attribute> anAttr =
+ std::shared_ptr<ModelAPI_Attribute> anAttr =
aConstrData->attribute(SketchPlugin_Constraint::ATTRIBUTE(indAttr));
AttrType aType = typeOfAttribute(anAttr);
if (aType == CIRCLE || aType == ARC)
// Verify that only one entity is filled
int aNbAttrs = 0;
for (unsigned int indAttr = 0; indAttr < CONSTRAINT_ATTR_SIZE; indAttr++) {
- boost::shared_ptr<ModelAPI_Attribute> anAttr =
+ std::shared_ptr<ModelAPI_Attribute> anAttr =
aConstrData->attribute(SketchPlugin_Constraint::ATTRIBUTE(indAttr));
AttrType aType = typeOfAttribute(anAttr);
if (aType != UNKNOWN)
}
// ================= Auxiliary functions ==============================
-AttrType typeOfAttribute(boost::shared_ptr<ModelAPI_Attribute> theAttribute)
+AttrType typeOfAttribute(std::shared_ptr<ModelAPI_Attribute> theAttribute)
{
- boost::shared_ptr<ModelAPI_AttributeRefAttr> anAttrRef = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_AttributeRefAttr> anAttrRef = std::dynamic_pointer_cast<
ModelAPI_AttributeRefAttr>(theAttribute);
if (!anAttrRef)
return UNKNOWN;
if (anAttrRef->isObject()) {
- ResultConstructionPtr aRC = boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(
+ ResultConstructionPtr aRC = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(
anAttrRef->object());
if (!aRC || !aRC->shape())
return UNKNOWN;
if (aRC->shape()->isVertex())
return POINT3D;
else if (aRC->shape()->isEdge()) {
- boost::shared_ptr<GeomAPI_Edge> anEdge = boost::dynamic_pointer_cast<GeomAPI_Edge>(
+ std::shared_ptr<GeomAPI_Edge> anEdge = std::dynamic_pointer_cast<GeomAPI_Edge>(
aRC->shape());
if (anEdge->isLine())
return LINE;
{
public:
SketchSolver_Constraint();
- SketchSolver_Constraint(boost::shared_ptr<SketchPlugin_Constraint> theConstraint);
+ SketchSolver_Constraint(std::shared_ptr<SketchPlugin_Constraint> theConstraint);
/** \brief Compute constraint type according to SolveSpace identifiers
* and verify that constraint parameters are correct
* \param[in] theConstraint constraint which type should be determined
* \return identifier of constraint type or SLVS_C_UNKNOWN if the type is wrong
*/
- const int& getType(boost::shared_ptr<SketchPlugin_Constraint> theConstraint);
+ const int& getType(std::shared_ptr<SketchPlugin_Constraint> theConstraint);
/// \brief Returns the type of myConstraint member
inline const int& getType() const
{
}
private:
- boost::shared_ptr<SketchPlugin_Constraint> myConstraint;
+ std::shared_ptr<SketchPlugin_Constraint> myConstraint;
int myType;
std::vector<std::string> myAttributesList;
};
// ========================================================
SketchSolver_ConstraintGroup::SketchSolver_ConstraintGroup(
- boost::shared_ptr<ModelAPI_CompositeFeature> theWorkplane)
+ std::shared_ptr<ModelAPI_CompositeFeature> theWorkplane)
: myID(++myGroupIndexer),
myParamMaxID(0),
myEntityMaxID(0),
// Purpose: verify the group is based on the given workplane
// ============================================================================
bool SketchSolver_ConstraintGroup::isBaseWorkplane(
- boost::shared_ptr<ModelAPI_CompositeFeature> theWorkplane) const
+ std::shared_ptr<ModelAPI_CompositeFeature> theWorkplane) const
{
return theWorkplane == mySketch;
}
// Purpose: verify are there any entities in the group used by given constraint
// ============================================================================
bool SketchSolver_ConstraintGroup::isInteract(
- boost::shared_ptr<SketchPlugin_Feature> theFeature) const
+ std::shared_ptr<SketchPlugin_Feature> theFeature) const
{
// Check the group is empty
if (isEmpty())
// Check if the feature is already in the group
if (myEntityFeatMap.find(theFeature) != myEntityFeatMap.end())
return true;
- boost::shared_ptr<SketchPlugin_Constraint> aConstr =
- boost::dynamic_pointer_cast<SketchPlugin_Constraint>(theFeature);
+ std::shared_ptr<SketchPlugin_Constraint> aConstr =
+ std::dynamic_pointer_cast<SketchPlugin_Constraint>(theFeature);
if (aConstr && myConstraintMap.find(aConstr) != myConstraintMap.end())
return true;
// Go through the attributes and verify if some of them already in the group
- std::list<boost::shared_ptr<ModelAPI_Attribute>>
+ std::list<std::shared_ptr<ModelAPI_Attribute>>
anAttrList = theFeature->data()->attributes(std::string());
- std::list<boost::shared_ptr<ModelAPI_Attribute>>::const_iterator
+ std::list<std::shared_ptr<ModelAPI_Attribute>>::const_iterator
anAttrIter = anAttrList.begin();
for ( ; anAttrIter != anAttrList.end(); anAttrIter++) {
- boost::shared_ptr<ModelAPI_AttributeRefAttr> aCAttrRef =
- boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(*anAttrIter);
+ std::shared_ptr<ModelAPI_AttributeRefAttr> aCAttrRef =
+ std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(*anAttrIter);
if (!aCAttrRef || !aCAttrRef->isObject()) {
- boost::shared_ptr<ModelAPI_Attribute> anAttr =
+ std::shared_ptr<ModelAPI_Attribute> anAttr =
aCAttrRef ? aCAttrRef->attr() : *anAttrIter;
if (myEntityAttrMap.find(anAttr) != myEntityAttrMap.end())
return true;
} else {
- ResultConstructionPtr aRC = boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(
+ ResultConstructionPtr aRC = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(
aCAttrRef->object());
if (!aRC)
continue;
- boost::shared_ptr<ModelAPI_Document> aDoc = aRC->document();
+ std::shared_ptr<ModelAPI_Document> aDoc = aRC->document();
FeaturePtr aFeature = aDoc->feature(aRC);
if (myEntityFeatMap.find(aFeature) != myEntityFeatMap.end())
return true;
// search attributes of a feature to be parameters of constraint
- std::list<boost::shared_ptr<ModelAPI_Attribute> > aFeatAttrList =
+ std::list<std::shared_ptr<ModelAPI_Attribute> > aFeatAttrList =
aFeature->data()->attributes(std::string());
- std::list<boost::shared_ptr<ModelAPI_Attribute> >::const_iterator aFAIter = aFeatAttrList
+ std::list<std::shared_ptr<ModelAPI_Attribute> >::const_iterator aFAIter = aFeatAttrList
.begin();
for (; aFAIter != aFeatAttrList.end(); aFAIter++)
if (myEntityAttrMap.find(*aFAIter) != myEntityAttrMap.end())
// point coordinates
int aPtPos = Search(theConstraint.ptA, myEntities);
int aPtParamPos = Search(myEntities[aPtPos].param[0], myParams);
- boost::shared_ptr<GeomAPI_XY> aPoint(
+ std::shared_ptr<GeomAPI_XY> aPoint(
new GeomAPI_XY(myParams[aPtParamPos].val, myParams[aPtParamPos + 1].val));
// line coordinates
int aLnPos = Search(theConstraint.entityA, myEntities);
aPtPos = Search(myEntities[aLnPos].point[0], myEntities);
aPtParamPos = Search(myEntities[aPtPos].param[0], myParams);
- boost::shared_ptr<GeomAPI_XY> aStart(
+ std::shared_ptr<GeomAPI_XY> aStart(
new GeomAPI_XY(-myParams[aPtParamPos].val, -myParams[aPtParamPos + 1].val));
aPtPos = Search(myEntities[aLnPos].point[1], myEntities);
aPtParamPos = Search(myEntities[aPtPos].param[0], myParams);
- boost::shared_ptr<GeomAPI_XY> aEnd(
+ std::shared_ptr<GeomAPI_XY> aEnd(
new GeomAPI_XY(myParams[aPtParamPos].val, myParams[aPtParamPos + 1].val));
aEnd = aEnd->added(aStart);
// Purpose: create/update the constraint in the group
// ============================================================================
bool SketchSolver_ConstraintGroup::changeConstraint(
- boost::shared_ptr<SketchPlugin_Constraint> theConstraint)
+ std::shared_ptr<SketchPlugin_Constraint> theConstraint)
{
// There is no workplane yet, something wrong
if (myWorkplane.h == SLVS_E_UNKNOWN)
// Create constraint parameters
double aDistance = 0.0; // scalar value of the constraint
- AttributeDoublePtr aDistAttr = boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(
+ AttributeDoublePtr aDistAttr = std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(
theConstraint->data()->attribute(SketchPlugin_Constraint::VALUE()));
if (aDistAttr) {
aDistance = aDistAttr->value();
Slvs_hEntity aConstrEnt[CONSTRAINT_ATTR_SIZE]; // parameters of the constraint
for (unsigned int indAttr = 0; indAttr < CONSTRAINT_ATTR_SIZE; indAttr++) {
aConstrEnt[indAttr] = SLVS_E_UNKNOWN;
- boost::shared_ptr<ModelAPI_AttributeRefAttr> aConstrAttr = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_AttributeRefAttr> aConstrAttr = std::dynamic_pointer_cast<
ModelAPI_AttributeRefAttr>(
theConstraint->data()->attribute(aConstraintAttributes[indAttr]));
if (!aConstrAttr)
// Convert the object of the attribute to the feature
FeaturePtr aFeature;
if (aConstrAttr->isObject() && aConstrAttr->object()) {
- ResultConstructionPtr aRC = boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(
+ ResultConstructionPtr aRC = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(
aConstrAttr->object());
if (!aRC)
continue;
- boost::shared_ptr<ModelAPI_Document> aDoc = aRC->document();
+ std::shared_ptr<ModelAPI_Document> aDoc = aRC->document();
aFeature = aDoc->feature(aRC);
}
// Purpose: create/update the "Rigid" constraint in the group
// ============================================================================
bool SketchSolver_ConstraintGroup::changeRigidConstraint(
- boost::shared_ptr<SketchPlugin_Constraint> theConstraint)
+ std::shared_ptr<SketchPlugin_Constraint> theConstraint)
{
// Search this constraint in the current group to update it
ConstraintMap::const_iterator aConstrMapIter = myConstraintMap.find(theConstraint);
const std::vector<std::string>& aConstraintAttributes = aConstraint.getAttributes();
Slvs_hEntity aConstrEnt = SLVS_E_UNKNOWN;
- boost::shared_ptr<ModelAPI_AttributeRefAttr> aConstrAttr = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_AttributeRefAttr> aConstrAttr = std::dynamic_pointer_cast<
ModelAPI_AttributeRefAttr>(
theConstraint->data()->attribute(aConstraintAttributes[0]));
if (!aConstrAttr)
// Convert the object of the attribute to the feature
FeaturePtr aFeature;
if (aConstrAttr->isObject() && aConstrAttr->object()) {
- ResultConstructionPtr aRC = boost::dynamic_pointer_cast<ModelAPI_ResultConstruction>(
+ ResultConstructionPtr aRC = std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(
aConstrAttr->object());
if (!aRC)
return false;
- boost::shared_ptr<ModelAPI_Document> aDoc = aRC->document();
+ std::shared_ptr<ModelAPI_Document> aDoc = aRC->document();
aFeature = aDoc->feature(aRC);
}
if (aConstrMapIter == myConstraintMap.end()) { // Add new constraint
// Check the fixed entity is not a point.
- boost::shared_ptr<ModelAPI_AttributeRefAttr> aConstrAttr = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_AttributeRefAttr> aConstrAttr = std::dynamic_pointer_cast<
ModelAPI_AttributeRefAttr>(theConstraint->data()->attribute(aConstraintAttributes[0]));
- boost::shared_ptr<GeomDataAPI_Point> aPoint =
- boost::dynamic_pointer_cast<GeomDataAPI_Point>(aConstrAttr->attr());
- boost::shared_ptr<GeomDataAPI_Point2D> aPoint2D =
- boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aConstrAttr->attr());
+ std::shared_ptr<GeomDataAPI_Point> aPoint =
+ std::dynamic_pointer_cast<GeomDataAPI_Point>(aConstrAttr->attr());
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint2D =
+ std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aConstrAttr->attr());
if (aPoint || aPoint2D) {
// Create SolveSpace constraint structure
Slvs_Constraint aConstraint = Slvs_MakeConstraint(
bool isCircle = false;
if (aFeature) {
if (aFeature->getKind() == SketchPlugin_Arc::ID()) {
- boost::shared_ptr<GeomDataAPI_Point2D> aCenter =
- boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ std::shared_ptr<GeomDataAPI_Point2D> aCenter =
+ std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aFeature->data()->attribute(SketchPlugin_Arc::CENTER_ID()));
- boost::shared_ptr<GeomDataAPI_Point2D> aStart =
- boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+ std::shared_ptr<GeomDataAPI_Point2D> aStart =
+ std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
aFeature->data()->attribute(SketchPlugin_Arc::START_ID()));
aRadius = aStart->pnt()->distance(aCenter->pnt());
isArc = true;
} else if (aFeature->getKind() == SketchPlugin_Circle::ID()) {
- aRadius = boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(
+ aRadius = std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(
aFeature->data()->attribute(SketchPlugin_Circle::RADIUS_ID()))->value();
isCircle = true;
}
// Purpose: create/update the element affected by any constraint
// ============================================================================
Slvs_hEntity SketchSolver_ConstraintGroup::changeEntity(
- boost::shared_ptr<ModelAPI_Attribute> theEntity)
+ std::shared_ptr<ModelAPI_Attribute> theEntity)
{
// If the entity is already in the group, try to find it
- std::map<boost::shared_ptr<ModelAPI_Attribute>, Slvs_hEntity>::const_iterator aEntIter =
+ std::map<std::shared_ptr<ModelAPI_Attribute>, Slvs_hEntity>::const_iterator aEntIter =
myEntityAttrMap.find(theEntity);
int aEntPos;
std::vector<Slvs_Param>::const_iterator aParamIter; // looks at first parameter of already existent entity or at the end of vector otherwise
aNewEntity.h = SLVS_E_UNKNOWN;
// Point in 3D
- boost::shared_ptr<GeomDataAPI_Point> aPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point>(
+ std::shared_ptr<GeomDataAPI_Point> aPoint = std::dynamic_pointer_cast<GeomDataAPI_Point>(
theEntity);
if (aPoint) {
Slvs_hParam aX = changeParameter(aPoint->x(), aParamIter);
return SLVS_E_UNKNOWN;
// Point in 2D
- boost::shared_ptr<GeomDataAPI_Point2D> aPoint2D =
- boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(theEntity);
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint2D =
+ std::dynamic_pointer_cast<GeomDataAPI_Point2D>(theEntity);
if (aPoint2D) {
Slvs_hParam aU = changeParameter(aPoint2D->x(), aParamIter);
Slvs_hParam aV = changeParameter(aPoint2D->y(), aParamIter);
aNewEntity = Slvs_MakePoint2d(++myEntityMaxID, myID, myWorkplane.h, aU, aV);
} else {
// Scalar value (used for the distance entities)
- AttributeDoublePtr aScalar = boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(theEntity);
+ AttributeDoublePtr aScalar = std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(theEntity);
if (aScalar) {
Slvs_hParam aValue = changeParameter(aScalar->value(), aParamIter);
if (!isEntExists) // New entity
aNewEntity.h = SLVS_E_UNKNOWN;
// SketchPlugin features
- boost::shared_ptr<SketchPlugin_Feature> aFeature = boost::dynamic_pointer_cast<
+ std::shared_ptr<SketchPlugin_Feature> aFeature = std::dynamic_pointer_cast<
SketchPlugin_Feature>(theEntity);
if (aFeature) { // Verify the feature by its kind
const std::string& aFeatureKind = aFeature->getKind();
// Purpose: create/update the normal of workplane
// ============================================================================
Slvs_hEntity SketchSolver_ConstraintGroup::changeNormal(
- boost::shared_ptr<ModelAPI_Attribute> theDirX, boost::shared_ptr<ModelAPI_Attribute> theDirY,
- boost::shared_ptr<ModelAPI_Attribute> theNorm)
+ std::shared_ptr<ModelAPI_Attribute> theDirX, std::shared_ptr<ModelAPI_Attribute> theDirY,
+ std::shared_ptr<ModelAPI_Attribute> theNorm)
{
- boost::shared_ptr<GeomDataAPI_Dir> aDirX = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(theDirX);
- boost::shared_ptr<GeomDataAPI_Dir> aDirY = boost::dynamic_pointer_cast<GeomDataAPI_Dir>(theDirY);
+ std::shared_ptr<GeomDataAPI_Dir> aDirX = std::dynamic_pointer_cast<GeomDataAPI_Dir>(theDirX);
+ std::shared_ptr<GeomDataAPI_Dir> aDirY = std::dynamic_pointer_cast<GeomDataAPI_Dir>(theDirY);
if (!aDirX || !aDirY || (fabs(aDirX->x()) + fabs(aDirX->y()) + fabs(aDirX->z()) < tolerance)
|| (fabs(aDirY->x()) + fabs(aDirY->y()) + fabs(aDirY->z()) < tolerance))
return SLVS_E_UNKNOWN;
double aNormCoord[4] = { qw, qx, qy, qz };
// Try to find existent normal
- std::map<boost::shared_ptr<ModelAPI_Attribute>, Slvs_hEntity>::const_iterator aEntIter =
+ std::map<std::shared_ptr<ModelAPI_Attribute>, Slvs_hEntity>::const_iterator aEntIter =
myEntityAttrMap.find(theNorm);
std::vector<Slvs_Param>::const_iterator aParamIter; // looks to the first parameter of already existent entity or to the end of vector otherwise
if (aEntIter == myEntityAttrMap.end()) // no such entity => should be created
// Class: SketchSolver_ConstraintGroup
// Purpose: create workplane for the group
// ============================================================================
-bool SketchSolver_ConstraintGroup::addWorkplane(boost::shared_ptr<ModelAPI_CompositeFeature> theSketch)
+bool SketchSolver_ConstraintGroup::addWorkplane(std::shared_ptr<ModelAPI_CompositeFeature> theSketch)
{
if (myWorkplane.h || theSketch->getKind().compare(SketchPlugin_Sketch::ID()) != 0)
return false; // the workplane already exists or the function parameter is not Sketch
if (!mySketch->data())
return false; // case sketch is deleted
// Get parameters of workplane
- boost::shared_ptr<ModelAPI_Attribute> aDirX = mySketch->data()->attribute(
+ std::shared_ptr<ModelAPI_Attribute> aDirX = mySketch->data()->attribute(
SketchPlugin_Sketch::DIRX_ID());
- boost::shared_ptr<ModelAPI_Attribute> aDirY = mySketch->data()->attribute(
+ std::shared_ptr<ModelAPI_Attribute> aDirY = mySketch->data()->attribute(
SketchPlugin_Sketch::DIRY_ID());
- boost::shared_ptr<ModelAPI_Attribute> aNorm = mySketch->data()->attribute(
+ std::shared_ptr<ModelAPI_Attribute> aNorm = mySketch->data()->attribute(
SketchPlugin_Sketch::NORM_ID());
- boost::shared_ptr<ModelAPI_Attribute> anOrigin = mySketch->data()->attribute(
+ std::shared_ptr<ModelAPI_Attribute> anOrigin = mySketch->data()->attribute(
SketchPlugin_Sketch::ORIGIN_ID());
// Transform them into SolveSpace format
Slvs_hEntity aNormalWP = changeNormal(aDirX, aDirY, aNorm);
return true;
// We should go through the attributes map, because only attributes have valued parameters
- std::map<boost::shared_ptr<ModelAPI_Attribute>, Slvs_hEntity>::iterator anEntIter =
+ std::map<std::shared_ptr<ModelAPI_Attribute>, Slvs_hEntity>::iterator anEntIter =
myEntityAttrMap.begin();
for (; anEntIter != myEntityAttrMap.end(); anEntIter++)
if (updateAttribute(anEntIter->first, anEntIter->second))
if (myTempPointWhereDragged.empty())
myTempPointWhereDragged = theGroup.myTempPointWhereDragged;
else if (!theGroup.myTempPointWhereDragged.empty()) { // Need to create additional transient constraint
- std::map<boost::shared_ptr<ModelAPI_Attribute>, Slvs_hEntity>::const_iterator aFeatureIter =
+ std::map<std::shared_ptr<ModelAPI_Attribute>, Slvs_hEntity>::const_iterator aFeatureIter =
theGroup.myEntityAttrMap.begin();
for (; aFeatureIter != theGroup.myEntityAttrMap.end(); aFeatureIter++)
if (aFeatureIter->second == myTempPointWDrgdID) {
// Check if some entities are invalid too
std::set<Slvs_hEntity> anEntToRemove;
- std::map<boost::shared_ptr<ModelAPI_Attribute>, Slvs_hEntity>::iterator
+ std::map<std::shared_ptr<ModelAPI_Attribute>, Slvs_hEntity>::iterator
anAttrIter = myEntityAttrMap.begin();
while (anAttrIter != myEntityAttrMap.end()) {
if (!anAttrIter->first->owner() || !anAttrIter->first->owner()->data() ||
!anAttrIter->first->owner()->data()->isValid()) {
anEntToRemove.insert(anAttrIter->second);
- std::map<boost::shared_ptr<ModelAPI_Attribute>, Slvs_hEntity>::iterator
+ std::map<std::shared_ptr<ModelAPI_Attribute>, Slvs_hEntity>::iterator
aRemovedIter = anAttrIter;
anAttrIter++;
myEntityAttrMap.erase(aRemovedIter);
// Probably, need to update coincidence constraints
if (isCCRemoved && !myExtraCoincidence.empty()) {
// Make a copy, because the new list of unused constrtaints will be generated
- std::set<boost::shared_ptr<SketchPlugin_Constraint> > anExtraCopy = myExtraCoincidence;
+ std::set<std::shared_ptr<SketchPlugin_Constraint> > anExtraCopy = myExtraCoincidence;
myExtraCoincidence.clear();
- std::set<boost::shared_ptr<SketchPlugin_Constraint> >::iterator aCIter = anExtraCopy.begin();
+ std::set<std::shared_ptr<SketchPlugin_Constraint> >::iterator aCIter = anExtraCopy.begin();
for (; aCIter != anExtraCopy.end(); aCIter++)
if ((*aCIter)->data() && (*aCIter)->data()->isValid())
changeConstraint(*aCIter);
// Purpose: update features of sketch after resolving constraints
// ============================================================================
bool SketchSolver_ConstraintGroup::updateAttribute(
- boost::shared_ptr<ModelAPI_Attribute> theAttribute, const Slvs_hEntity& theEntityID)
+ std::shared_ptr<ModelAPI_Attribute> theAttribute, const Slvs_hEntity& theEntityID)
{
// Search the position of the first parameter of the entity
int anEntPos = Search(theEntityID, myEntities);
// Look over supported types of entities
// Point in 3D
- boost::shared_ptr<GeomDataAPI_Point> aPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point>(
+ std::shared_ptr<GeomDataAPI_Point> aPoint = std::dynamic_pointer_cast<GeomDataAPI_Point>(
theAttribute);
if (aPoint) {
if (fabs(aPoint->x() - myParams[aFirstParamPos].val) > tolerance
}
// Point in 2D
- boost::shared_ptr<GeomDataAPI_Point2D> aPoint2D =
- boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(theAttribute);
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint2D =
+ std::dynamic_pointer_cast<GeomDataAPI_Point2D>(theAttribute);
if (aPoint2D) {
if (fabs(aPoint2D->x() - myParams[aFirstParamPos].val) > tolerance
|| fabs(aPoint2D->y() - myParams[aFirstParamPos + 1].val) > tolerance) {
}
// Scalar value
- AttributeDoublePtr aScalar = boost::dynamic_pointer_cast<ModelAPI_AttributeDouble>(theAttribute);
+ AttributeDoublePtr aScalar = std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(theAttribute);
if (aScalar) {
if (fabs(aScalar->value() - myParams[aFirstParamPos].val) > tolerance) {
aScalar->setValue(myParams[aFirstParamPos].val);
// Purpose: search the entity in this group and update it
// ============================================================================
void SketchSolver_ConstraintGroup::updateEntityIfPossible(
- boost::shared_ptr<ModelAPI_Attribute> theEntity)
+ std::shared_ptr<ModelAPI_Attribute> theEntity)
{
if (myEntityAttrMap.find(theEntity) != myEntityAttrMap.end()) {
// If the attribute is a point and it is changed (the group needs to rebuild),
if (myNeedToSolve) // the entity is changed
{
// Verify the entity is a point and add temporary constraint of permanency
- boost::shared_ptr<GeomDataAPI_Point> aPoint = boost::dynamic_pointer_cast<GeomDataAPI_Point>(
+ std::shared_ptr<GeomDataAPI_Point> aPoint = std::dynamic_pointer_cast<GeomDataAPI_Point>(
theEntity);
- boost::shared_ptr<GeomDataAPI_Point2D> aPoint2D = boost::dynamic_pointer_cast<
+ std::shared_ptr<GeomDataAPI_Point2D> aPoint2D = std::dynamic_pointer_cast<
GeomDataAPI_Point2D>(theEntity);
if (aPoint || aPoint2D)
addTemporaryConstraintWhereDragged(theEntity);
// which was moved by user
// ============================================================================
void SketchSolver_ConstraintGroup::addTemporaryConstraintWhereDragged(
- boost::shared_ptr<ModelAPI_Attribute> theEntity,
+ std::shared_ptr<ModelAPI_Attribute> theEntity,
bool theAllowToFit)
{
// Find identifier of the entity
- std::map<boost::shared_ptr<ModelAPI_Attribute>, Slvs_hEntity>::const_iterator anEntIter =
+ std::map<std::shared_ptr<ModelAPI_Attribute>, Slvs_hEntity>::const_iterator anEntIter =
myEntityAttrMap.find(theEntity);
if (anEntIter == myEntityAttrMap.end())
return;
// Purpose: remove constraint and all unused entities
// ============================================================================
void SketchSolver_ConstraintGroup::removeConstraint(
- boost::shared_ptr<SketchPlugin_Constraint> theConstraint)
+ std::shared_ptr<SketchPlugin_Constraint> theConstraint)
{
ConstraintMap::iterator anIterToRemove = myConstraintMap.find(theConstraint);
if (anIterToRemove == myConstraintMap.end())
return;
// Remove unused entities
- std::map<boost::shared_ptr<ModelAPI_Attribute>, Slvs_hEntity>::iterator anEntAttrIter =
+ std::map<std::shared_ptr<ModelAPI_Attribute>, Slvs_hEntity>::iterator anEntAttrIter =
myEntityAttrMap.begin();
while (anEntAttrIter != myEntityAttrMap.end()) {
if (anEntToRemove.find(anEntAttrIter->second) != anEntToRemove.end()) {
- std::map<boost::shared_ptr<ModelAPI_Attribute>, Slvs_hEntity>::iterator aRemovedIter =
+ std::map<std::shared_ptr<ModelAPI_Attribute>, Slvs_hEntity>::iterator aRemovedIter =
anEntAttrIter;
anEntAttrIter++;
myEntityAttrMap.erase(aRemovedIter);
// Purpose: emit the signal to update constraints
// ============================================================================
void SketchSolver_ConstraintGroup::updateRelatedConstraints(
- boost::shared_ptr<ModelAPI_Attribute> theEntity) const
+ std::shared_ptr<ModelAPI_Attribute> theEntity) const
{
ConstraintMap::const_iterator aConstrIter = myConstraintMap.begin();
for (; aConstrIter != myConstraintMap.end(); aConstrIter++) {
- std::list<boost::shared_ptr<ModelAPI_Attribute> > anAttributes = aConstrIter->first->data()
+ std::list<std::shared_ptr<ModelAPI_Attribute> > anAttributes = aConstrIter->first->data()
->attributes(std::string());
- std::list<boost::shared_ptr<ModelAPI_Attribute> >::iterator anAttrIter = anAttributes.begin();
+ std::list<std::shared_ptr<ModelAPI_Attribute> >::iterator anAttrIter = anAttributes.begin();
for (; anAttrIter != anAttributes.end(); anAttrIter++) {
bool isUpd = (*anAttrIter == theEntity);
- boost::shared_ptr<ModelAPI_AttributeRefAttr> aRefAttr = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_AttributeRefAttr> aRefAttr = std::dynamic_pointer_cast<
ModelAPI_AttributeRefAttr>(*anAttrIter);
if (aRefAttr && !aRefAttr->isObject() && aRefAttr->attr() == theEntity)
isUpd = true;
}
void SketchSolver_ConstraintGroup::updateRelatedConstraints(
- boost::shared_ptr<ModelAPI_Feature> theFeature) const
+ std::shared_ptr<ModelAPI_Feature> theFeature) const
{
ConstraintMap::const_iterator aConstrIter = myConstraintMap.begin();
for (; aConstrIter != myConstraintMap.end(); aConstrIter++) {
- std::list<boost::shared_ptr<ModelAPI_Attribute> > anAttributes = aConstrIter->first->data()
+ std::list<std::shared_ptr<ModelAPI_Attribute> > anAttributes = aConstrIter->first->data()
->attributes(std::string());
- std::list<boost::shared_ptr<ModelAPI_Attribute> >::iterator anAttrIter = anAttributes.begin();
+ std::list<std::shared_ptr<ModelAPI_Attribute> >::iterator anAttrIter = anAttributes.begin();
for (; anAttrIter != anAttributes.end(); anAttrIter++) {
- boost::shared_ptr<ModelAPI_AttributeRefAttr> aRefAttr = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_AttributeRefAttr> aRefAttr = std::dynamic_pointer_cast<
ModelAPI_AttributeRefAttr>(*anAttrIter);
if (aRefAttr && aRefAttr->isObject() && aRefAttr->object() == theFeature) {
static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED);
#include <vector>
#include <set>
-typedef std::map< boost::shared_ptr<SketchPlugin_Constraint>, std::vector<Slvs_hConstraint> >
+typedef std::map< std::shared_ptr<SketchPlugin_Constraint>, std::vector<Slvs_hConstraint> >
ConstraintMap;
/** \class SketchSolver_ConstraintGroup
* Throws an exception if theWorkplane is not an object of SketchPlugin_Sketch type
* \remark Type of theSketch is not verified inside
*/
- SketchSolver_ConstraintGroup(boost::shared_ptr<ModelAPI_CompositeFeature> theWorkplane);
+ SketchSolver_ConstraintGroup(std::shared_ptr<ModelAPI_CompositeFeature> theWorkplane);
~SketchSolver_ConstraintGroup();
* \param[in] theConstraint constraint to be changed
* \return \c true if the constraint added or updated successfully
*/
- bool changeConstraint(boost::shared_ptr<SketchPlugin_Constraint> theConstraint);
- bool changeRigidConstraint(boost::shared_ptr<SketchPlugin_Constraint> theConstraint);
+ bool changeConstraint(std::shared_ptr<SketchPlugin_Constraint> theConstraint);
+ bool changeRigidConstraint(std::shared_ptr<SketchPlugin_Constraint> theConstraint);
/** \brief Verifies the feature attributes are used in this group
* \param[in] theFeature constraint or any other object for verification of interaction
* \return \c true if some of attributes are used in current group
*/
- bool isInteract(boost::shared_ptr<SketchPlugin_Feature> theFeature) const;
+ bool isInteract(std::shared_ptr<SketchPlugin_Feature> theFeature) const;
/** \brief Verifies the specified feature is equal to the base workplane for this group
* \param[in] theWorkplane the feature to be compared with base workplane
* \return \c true if workplanes are the same
*/
- bool isBaseWorkplane(boost::shared_ptr<ModelAPI_CompositeFeature> theWorkplane) const;
+ bool isBaseWorkplane(std::shared_ptr<ModelAPI_CompositeFeature> theWorkplane) const;
- boost::shared_ptr<ModelAPI_CompositeFeature> getWorkplane() const
+ std::shared_ptr<ModelAPI_CompositeFeature> getWorkplane() const
{
return mySketch;
}
/** \brief If the entity is in this group it will updated
* \param[in] theEntity attribute, which values should update SolveSpace entity
*/
- void updateEntityIfPossible(boost::shared_ptr<ModelAPI_Attribute> theEntity);
+ void updateEntityIfPossible(std::shared_ptr<ModelAPI_Attribute> theEntity);
/** \brief Searches invalid features and constraints in the group and avoids them
* \return \c true if the group several constraints were removed
/** \brief Searches the constraints built on the entity and emit the signal to update them
* \param[in] theEntity attribute of the constraint
*/
- void updateRelatedConstraints(boost::shared_ptr<ModelAPI_Attribute> theEntity) const;
- void updateRelatedConstraints(boost::shared_ptr<ModelAPI_Feature> theFeature) const;
+ void updateRelatedConstraints(std::shared_ptr<ModelAPI_Attribute> theEntity) const;
+ void updateRelatedConstraints(std::shared_ptr<ModelAPI_Feature> theFeature) const;
/** \brief Adds or updates an entity in the group
*
* \param[in] theEntity the object of constraint
* \return identifier of changed entity or 0 if entity could not be changed
*/
- Slvs_hEntity changeEntity(boost::shared_ptr<ModelAPI_Attribute> theEntity);
+ Slvs_hEntity changeEntity(std::shared_ptr<ModelAPI_Attribute> theEntity);
Slvs_hEntity changeEntity(FeaturePtr theEntity);
protected:
* \param[in] theNorm attribute for the normal (used to identify newly created entity)
* \return identifier of created or updated normal
*/
- Slvs_hEntity changeNormal(boost::shared_ptr<ModelAPI_Attribute> theDirX,
- boost::shared_ptr<ModelAPI_Attribute> theDirY,
- boost::shared_ptr<ModelAPI_Attribute> theNorm);
+ Slvs_hEntity changeNormal(std::shared_ptr<ModelAPI_Attribute> theDirX,
+ std::shared_ptr<ModelAPI_Attribute> theDirY,
+ std::shared_ptr<ModelAPI_Attribute> theNorm);
/** \brief Adds or updates a parameter in the group
* \param[in] theParam the value of parameter
/** \brief Removes constraints from the group
* \param[in] theConstraint constraint to be removed
*/
- void removeConstraint(boost::shared_ptr<SketchPlugin_Constraint> theConstraint);
+ void removeConstraint(std::shared_ptr<SketchPlugin_Constraint> theConstraint);
/** \brief Change values of attribute by parameters received from SolveSpace solver
* \param[in,out] theAttribute pointer to the attribute to be changed
* \param[in] theEntityID identifier of SolveSpace entity, which contains updated data
* \return \c true if the attribute's value has changed
*/
- bool updateAttribute(boost::shared_ptr<ModelAPI_Attribute> theAttribute,
+ bool updateAttribute(std::shared_ptr<ModelAPI_Attribute> theAttribute,
const Slvs_hEntity& theEntityID);
/** \brief Adds a constraint for a point which should not be changed during computations
* the 'dragged' field of SolveSpace solver, so this entity
* may be changed a little during solution
*/
- void addTemporaryConstraintWhereDragged(boost::shared_ptr<ModelAPI_Attribute> theEntity,
+ void addTemporaryConstraintWhereDragged(std::shared_ptr<ModelAPI_Attribute> theEntity,
bool theAllowToFit = true);
/** \brief Remove all temporary constraint after computation finished
* \param[in] theSketch parameters of workplane are the attributes of this sketch
* \return \c true if success, \c false if workplane parameters are not consistent
*/
- bool addWorkplane(boost::shared_ptr<ModelAPI_CompositeFeature> theSketch);
+ bool addWorkplane(std::shared_ptr<ModelAPI_CompositeFeature> theSketch);
/** \brief Add the entities of constraint for points coincidence into the appropriate list
* \param[in] thePoint1 identifier of the first point
std::list<Slvs_hConstraint> myTempConstraints; ///< The list of identifiers of temporary constraints (SLVS_C_WHERE_DRAGGED) applied for all other points moved by user
// SketchPlugin entities
- boost::shared_ptr<ModelAPI_CompositeFeature> mySketch; ///< Equivalent to workplane
+ std::shared_ptr<ModelAPI_CompositeFeature> mySketch; ///< Equivalent to workplane
ConstraintMap myConstraintMap; ///< The map between SketchPlugin and SolveSpace constraints
- std::map<boost::shared_ptr<ModelAPI_Attribute>, Slvs_hEntity> myEntityAttrMap; ///< The map between "attribute" parameters of constraints and their equivalent SolveSpace entities
+ std::map<std::shared_ptr<ModelAPI_Attribute>, Slvs_hEntity> myEntityAttrMap; ///< The map between "attribute" parameters of constraints and their equivalent SolveSpace entities
std::map<FeaturePtr, Slvs_hEntity> myEntityFeatMap; ///< The map between "feature" parameters of constraints and their equivalent SolveSpace entities
// Conincident items
std::vector<std::set<Slvs_hEntity> > myCoincidentPoints; ///< Stores the lists of identifiers of coincident points (to avoid unnecessary coincidence constraints)
- std::set<boost::shared_ptr<SketchPlugin_Constraint> > myExtraCoincidence; ///< Additional coincidence constraints which are not necessary (coincidence between points already done
+ std::set<std::shared_ptr<SketchPlugin_Constraint> > myExtraCoincidence; ///< Additional coincidence constraints which are not necessary (coincidence between points already done
///< by other constraints) but created by GUI tools. Useful when some coincidence constraints were removed
};
// Purpose: listen the event loop and process the message
// ============================================================================
void SketchSolver_ConstraintManager::processEvent(
- const boost::shared_ptr<Events_Message>& theMessage)
+ const std::shared_ptr<Events_Message>& theMessage)
{
if (myIsComputed)
return;
if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_CREATED)
|| theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_UPDATED)
|| theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_MOVED)) {
- boost::shared_ptr<ModelAPI_ObjectUpdatedMessage> anUpdateMsg =
- boost::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
+ std::shared_ptr<ModelAPI_ObjectUpdatedMessage> anUpdateMsg =
+ std::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
std::set<ObjectPtr> aFeatures = anUpdateMsg->objects();
bool isMovedEvt = theMessage->eventID()
if (isMovedEvt) {
std::set<ObjectPtr>::iterator aFeatIter;
for (aFeatIter = aFeatures.begin(); aFeatIter != aFeatures.end(); aFeatIter++) {
- boost::shared_ptr<SketchPlugin_Feature> aSFeature =
- boost::dynamic_pointer_cast<SketchPlugin_Feature>(*aFeatIter);
+ std::shared_ptr<SketchPlugin_Feature> aSFeature =
+ std::dynamic_pointer_cast<SketchPlugin_Feature>(*aFeatIter);
if (aSFeature)
updateEntity(aSFeature);
}
std::set<ObjectPtr>::iterator aFeatIter;
// iterate sketchers fisrt to create all sketches before (on load may exist several sketches)
for (aFeatIter = aFeatures.begin(); aFeatIter != aFeatures.end(); aFeatIter++) {
- FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(*aFeatIter);
+ FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(*aFeatIter);
if (!aFeature)
continue;
const std::string& aFeatureKind = aFeature->getKind();
if (aFeatureKind.compare(SketchPlugin_Sketch::ID()) == 0) {
- boost::shared_ptr<ModelAPI_CompositeFeature> aSketch = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_CompositeFeature> aSketch = std::dynamic_pointer_cast<
ModelAPI_CompositeFeature>(aFeature);
changeWorkplane(aSketch);
}
}
// then get anything but not the sketch
for (aFeatIter = aFeatures.begin(); aFeatIter != aFeatures.end(); aFeatIter++) {
- boost::shared_ptr<SketchPlugin_Feature> aFeature =
- boost::dynamic_pointer_cast<SketchPlugin_Feature>(*aFeatIter);
+ std::shared_ptr<SketchPlugin_Feature> aFeature =
+ std::dynamic_pointer_cast<SketchPlugin_Feature>(*aFeatIter);
if (!aFeature)
continue;
changeConstraintOrEntity(aFeature);
// Solve the set of constraints
resolveConstraints();
} else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_DELETED)) {
- boost::shared_ptr<ModelAPI_ObjectDeletedMessage> aDeleteMsg =
- boost::dynamic_pointer_cast<ModelAPI_ObjectDeletedMessage>(theMessage);
+ std::shared_ptr<ModelAPI_ObjectDeletedMessage> aDeleteMsg =
+ std::dynamic_pointer_cast<ModelAPI_ObjectDeletedMessage>(theMessage);
const std::set<std::string>& aFeatureGroups = aDeleteMsg->groups();
// Find SketchPlugin_Sketch::ID() in groups. The constraint groups should be updated when an object removed from Sketch
// Purpose: update workplane by given parameters of the sketch
// ============================================================================
bool SketchSolver_ConstraintManager::changeWorkplane(
- boost::shared_ptr<ModelAPI_CompositeFeature> theSketch)
+ std::shared_ptr<ModelAPI_CompositeFeature> theSketch)
{
bool aResult = true; // changed when a workplane wrongly updated
bool isUpdated = false;
// Purpose: create/update the constraint or the feature and place it into appropriate group
// ============================================================================
bool SketchSolver_ConstraintManager::changeConstraintOrEntity(
- boost::shared_ptr<SketchPlugin_Feature> theFeature)
+ std::shared_ptr<SketchPlugin_Feature> theFeature)
{
// Search the groups which this feature touches
std::set<Slvs_hGroup> aGroups;
findGroups(theFeature, aGroups);
- boost::shared_ptr<SketchPlugin_Constraint> aConstraint =
- boost::dynamic_pointer_cast<SketchPlugin_Constraint>(theFeature);
+ std::shared_ptr<SketchPlugin_Constraint> aConstraint =
+ std::dynamic_pointer_cast<SketchPlugin_Constraint>(theFeature);
// Process the groups list
if (aGroups.size() == 0) {
// There are no groups applicable for this constraint => create new one
// The group will be created only for constraints, not for features
if (!aConstraint) return false;
- boost::shared_ptr<ModelAPI_CompositeFeature> aWP = findWorkplane(aConstraint);
+ std::shared_ptr<ModelAPI_CompositeFeature> aWP = findWorkplane(aConstraint);
if (!aWP)
return false;
SketchSolver_ConstraintGroup* aGroup = new SketchSolver_ConstraintGroup(aWP);
// Purpose: update any element on the sketch, which is used by constraints
// ============================================================================
void SketchSolver_ConstraintManager::updateEntity(
- boost::shared_ptr<SketchPlugin_Feature> theFeature)
+ std::shared_ptr<SketchPlugin_Feature> theFeature)
{
// Create list of attributes depending on type of the feature
std::vector<std::string> anAttrList;
for (aGroupIter = myGroups.begin(); aGroupIter != myGroups.end(); aGroupIter++) {
if ((*aGroupIter)->isEmpty())
continue;
- boost::shared_ptr<ModelAPI_Attribute> anAttribute = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_Attribute> anAttribute = std::dynamic_pointer_cast<
ModelAPI_Attribute>(theFeature->data()->attribute(*anAttrIter));
(*aGroupIter)->updateEntityIfPossible(anAttribute);
}
// Purpose: search groups of entities interacting with given feature
// ============================================================================
void SketchSolver_ConstraintManager::findGroups(
- boost::shared_ptr<SketchPlugin_Feature> theFeature,
+ std::shared_ptr<SketchPlugin_Feature> theFeature,
std::set<Slvs_hGroup>& theGroupIDs) const
{
- boost::shared_ptr<ModelAPI_CompositeFeature> aWP = findWorkplane(theFeature);
+ std::shared_ptr<ModelAPI_CompositeFeature> aWP = findWorkplane(theFeature);
SketchSolver_ConstraintGroup* anEmptyGroup = 0; // appropriate empty group for specified constraint
std::vector<SketchSolver_ConstraintGroup*>::const_iterator aGroupIter;
// Class: SketchSolver_Session
// Purpose: search workplane containing given feature
// ============================================================================
-boost::shared_ptr<ModelAPI_CompositeFeature> SketchSolver_ConstraintManager::findWorkplane(
- boost::shared_ptr<SketchPlugin_Feature> theFeature) const
+std::shared_ptr<ModelAPI_CompositeFeature> SketchSolver_ConstraintManager::findWorkplane(
+ std::shared_ptr<SketchPlugin_Feature> theFeature) const
{
// Already verified workplanes
- std::set<boost::shared_ptr<ModelAPI_CompositeFeature> > aVerified;
+ std::set<std::shared_ptr<ModelAPI_CompositeFeature> > aVerified;
std::vector<SketchSolver_ConstraintGroup*>::const_iterator aGroupIter;
for (aGroupIter = myGroups.begin(); aGroupIter != myGroups.end(); aGroupIter++) {
- boost::shared_ptr<ModelAPI_CompositeFeature> aWP = (*aGroupIter)->getWorkplane();
+ std::shared_ptr<ModelAPI_CompositeFeature> aWP = (*aGroupIter)->getWorkplane();
if (aVerified.find(aWP) != aVerified.end())
continue;
- boost::shared_ptr<ModelAPI_AttributeRefList> aWPFeatures = boost::dynamic_pointer_cast<
+ std::shared_ptr<ModelAPI_AttributeRefList> aWPFeatures = std::dynamic_pointer_cast<
ModelAPI_AttributeRefList>(aWP->data()->attribute(SketchPlugin_Sketch::FEATURES_ID()));
std::list<ObjectPtr> aFeaturesList = aWPFeatures->list();
std::list<ObjectPtr>::const_iterator anIter;
aVerified.insert(aWP);
}
- return boost::shared_ptr<ModelAPI_CompositeFeature>();
+ return std::shared_ptr<ModelAPI_CompositeFeature>();
}
// ============================================================================
/** \brief Implementation of Event Listener method
* \param[in] theMessage the data of the event
*/
- virtual void processEvent(const boost::shared_ptr<Events_Message>& theMessage);
+ virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
protected:
SketchSolver_ConstraintManager();
* \param[in] theFeature sketch feature to be changed
* \return \c true if the feature changed successfully
*/
- bool changeConstraintOrEntity(boost::shared_ptr<SketchPlugin_Feature> theFeature);
+ bool changeConstraintOrEntity(std::shared_ptr<SketchPlugin_Feature> theFeature);
/** \brief Removes a constraint from the manager
* \param[in] theConstraint constraint to be removed
* \return \c true if the constraint removed successfully
*/
- bool removeConstraint(boost::shared_ptr<SketchPlugin_Constraint> theConstraint);
+ bool removeConstraint(std::shared_ptr<SketchPlugin_Constraint> theConstraint);
/** \brief Adds or updates a workplane in the manager
* \param[in] theSketch the feature to create or update workplane
* \return \c true if the workplane changed successfully
* \remark Type of theSketch is not verified inside
*/
- bool changeWorkplane(boost::shared_ptr<ModelAPI_CompositeFeature> theSketch);
+ bool changeWorkplane(std::shared_ptr<ModelAPI_CompositeFeature> theSketch);
/** \brief Removes a workplane from the manager.
* All groups based on such workplane will be removed too.
* \param[in] theSketch the feature to be removed
* \return \c true if the workplane removed successfully
*/
- bool removeWorkplane(boost::shared_ptr<SketchPlugin_Sketch> theSketch);
+ bool removeWorkplane(std::shared_ptr<SketchPlugin_Sketch> theSketch);
/** \brief Updates entity which is neither workplane nor constraint
* \param[in] theFeature entity to be updated
*/
- void updateEntity(boost::shared_ptr<SketchPlugin_Feature> theFeature);
+ void updateEntity(std::shared_ptr<SketchPlugin_Feature> theFeature);
/** \brief Goes through the list of groups and solve the constraints
*/
* \param[in] theFeature object to be found
* \param[out] theGroups list of group indexes interacted with the feature
*/
- void findGroups(boost::shared_ptr<SketchPlugin_Feature> theFeature,
+ void findGroups(std::shared_ptr<SketchPlugin_Feature> theFeature,
std::set<Slvs_hGroup>& theGroupIDs) const;
/** \brief Searches in the list of groups the workplane which constains specified feature
* \param[in] theFeature object to be found
* \return workplane containing the feature
*/
- boost::shared_ptr<ModelAPI_CompositeFeature> findWorkplane(
- boost::shared_ptr<SketchPlugin_Feature> theFeature) const;
+ std::shared_ptr<ModelAPI_CompositeFeature> findWorkplane(
+ std::shared_ptr<SketchPlugin_Feature> theFeature) const;
private:
static SketchSolver_ConstraintManager* _self; ///< Self pointer to implement singleton functionality
bool hasFeature = false;
foreach(ObjectPtr aObj, aObjects)
{
- FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
- ResultPtr aResult = boost::dynamic_pointer_cast<ModelAPI_Result>(aObj);
+ FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
+ ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(aObj);
if (aResult)
hasResult = true;
if (aFeature)
if (aSelected == 1) {
ObjectPtr aObject = aObjects.first();
if (aObject) {
- ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(aObject);
+ ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObject);
if (aPart) {
if (aMgr->activeDocument() == aPart->partDoc())
aMenu->addAction(action("DEACTIVATE_PART_CMD"));
bool isShading = false;
foreach(ObjectPtr aObject, aObjects)
{
- ResultPtr aRes = boost::dynamic_pointer_cast<ModelAPI_Result>(aObject);
+ ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(aObject);
if (aRes && myWorkshop->displayer()->isVisible(aRes)) {
isVisible = true;
isShading = (myWorkshop->displayer()->displayMode(aObject) == XGUI_Displayer::Shading);
} else {
AISObjectPtr anAIS;
- GeomPresentablePtr aPrs = boost::dynamic_pointer_cast<GeomAPI_IPresentable>(theObject);
+ GeomPresentablePtr aPrs = std::dynamic_pointer_cast<GeomAPI_IPresentable>(theObject);
bool isShading = false;
if (aPrs) {
anAIS = aPrs->getAISObject(AISObjectPtr());
} else {
- ResultPtr aResult = boost::dynamic_pointer_cast<ModelAPI_Result>(theObject);
+ ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
if (aResult) {
- boost::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(aResult);
+ std::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(aResult);
if (aShapePtr) {
anAIS = AISObjectPtr(new GeomAPI_AISObject());
anAIS->setImpl(new Handle(AIS_InteractiveObject)(new ModuleBase_ResultPrs(aResult)));
AISObjectPtr aAISObj = getAISObject(theObject);
Handle(AIS_InteractiveObject) aAISIO = aAISObj->impl<Handle(AIS_InteractiveObject)>();
- GeomPresentablePtr aPrs = boost::dynamic_pointer_cast<GeomAPI_IPresentable>(theObject);
+ GeomPresentablePtr aPrs = std::dynamic_pointer_cast<GeomAPI_IPresentable>(theObject);
if (aPrs) {
AISObjectPtr aAIS_Obj = aPrs->getAISObject(aAISObj);
if (!aAIS_Obj) {
#include "XGUI.h"
#include <QString>
-#include <boost/shared_ptr.hpp>
+#include <memory>
#include <GeomAPI_AISObject.h>
clearSubModels();
}
-void XGUI_DocumentDataModel::processEvent(const boost::shared_ptr<Events_Message>& theMessage)
+void XGUI_DocumentDataModel::processEvent(const std::shared_ptr<Events_Message>& theMessage)
{
DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
// Created object event *******************
if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_CREATED)) {
- boost::shared_ptr<ModelAPI_ObjectUpdatedMessage> aUpdMsg =
- boost::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
+ std::shared_ptr<ModelAPI_ObjectUpdatedMessage> aUpdMsg =
+ std::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
std::set<ObjectPtr> aObjects = aUpdMsg->objects();
std::set<ObjectPtr>::const_iterator aIt;
for (aIt = aObjects.begin(); aIt != aObjects.end(); ++aIt) {
ObjectPtr aObject = (*aIt);
- FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(aObject);
+ FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObject);
if (aFeature && (!aFeature->isInHistory()))
continue;
}
// Deleted object event ***********************
} else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_DELETED)) {
- boost::shared_ptr<ModelAPI_ObjectDeletedMessage> aUpdMsg =
- boost::dynamic_pointer_cast<ModelAPI_ObjectDeletedMessage>(theMessage);
+ std::shared_ptr<ModelAPI_ObjectDeletedMessage> aUpdMsg =
+ std::dynamic_pointer_cast<ModelAPI_ObjectDeletedMessage>(theMessage);
DocumentPtr aDoc = aUpdMsg->document();
std::set<std::string> aGroups = aUpdMsg->groups();
}
// Deleted object event ***********************
} else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_UPDATED)) {
- //boost::shared_ptr<ModelAPI_ObjectUpdatedMessage> aUpdMsg = boost::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
+ //std::shared_ptr<ModelAPI_ObjectUpdatedMessage> aUpdMsg = std::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
//ObjectPtr aFeature = aUpdMsg->feature();
//DocumentPtr aDoc = aFeature->document();
int aOffset = historyOffset();
DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
ObjectPtr aObj = aRootDoc->object(ModelAPI_Feature::group(), theIndex.row() - aOffset);
- FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
+ FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
if (!aFeature)
return QVariant();
switch (theRole) {
DocumentPtr aDoc = theObject->document();
if (aDoc == aRootDoc) {
// This feature belongs to histrory or top model
- FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(theObject);
+ FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theObject);
if (aFeature) {
int aId;
int aNb = aRootDoc->size(ModelAPI_Feature::group());
virtual ~XGUI_DocumentDataModel();
// Event Listener method
- virtual void processEvent(const boost::shared_ptr<Events_Message>& theMessage);
+ virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
virtual QVariant data(const QModelIndex& theIndex, int theRole) const;
virtual QVariant headerData(int theSection, Qt::Orientation theOrient, int theRole =
QModelIndex aIndex = currentIndex();
XGUI_DocumentDataModel* aModel = dataModel();
ObjectPtr aObject = aModel->object(aIndex);
- ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(aObject);
+ ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObject);
if (aPart) {
aPart->activate();
}
}
//***************************************************
-void XGUI_ObjectsBrowser::processEvent(const boost::shared_ptr<Events_Message>& theMessage)
+void XGUI_ObjectsBrowser::processEvent(const std::shared_ptr<Events_Message>& theMessage)
{
myDocModel->processEvent(theMessage);
}
void rebuildDataTree();
- void processEvent(const boost::shared_ptr<Events_Message>& theMessage);
+ void processEvent(const std::shared_ptr<Events_Message>& theMessage);
// Resets the object browser into initial state
void clearContent();
//ObjectPtr featureObj(const ObjectPtr& theFeature)
//{
-// ObjectPtr aObject = boost::dynamic_pointer_cast<ModelAPI_Object>(theFeature);
+// ObjectPtr aObject = std::dynamic_pointer_cast<ModelAPI_Object>(theFeature);
// if (aObject)
// return aObject->featureRef();
// return theFeature;
DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
ObjectPtr aObject = aRootDoc->object(ModelAPI_ResultPart::group(), myId);
if (aObject)
- return boost::dynamic_pointer_cast<ModelAPI_Object>(aObject)->data()->name().c_str();
+ return std::dynamic_pointer_cast<ModelAPI_Object>(aObject)->data()->name().c_str();
}
case ParamsFolder:
return tr("Parameters") + QString(" (%1)").arg(rowCount(theIndex));
ObjectPtr aObject = partDocument()->object(ModelAPI_ResultParameters::group(),
theIndex.row());
if (aObject)
- return boost::dynamic_pointer_cast<ModelAPI_Object>(aObject)->data()->name().c_str();
+ return std::dynamic_pointer_cast<ModelAPI_Object>(aObject)->data()->name().c_str();
}
break;
case ConstructObject: {
ObjectPtr aObject = partDocument()->object(ModelAPI_ResultConstruction::group(),
theIndex.row());
if (aObject)
- return boost::dynamic_pointer_cast<ModelAPI_Object>(aObject)->data()->name().c_str();
+ return std::dynamic_pointer_cast<ModelAPI_Object>(aObject)->data()->name().c_str();
}
break;
case BodiesObject: {
}
case HistoryObject: {
ObjectPtr aObject = partDocument()->object(ModelAPI_Feature::group(), theIndex.row() - 4);
- FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(aObject);
+ FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObject);
if (aFeature)
return QIcon(XGUI_Workshop::featureIcon(aFeature->getKind()));
}
{
DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
ObjectPtr aObject = aRootDoc->object(ModelAPI_ResultPart::group(), myId);
- ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(aObject);
+ ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObject);
if (aPart)
return aPart->partDoc();
return DocumentPtr(); // null if not found
{
DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
ObjectPtr aObj = aRootDoc->object(ModelAPI_ResultPart::group(), myId);
- return boost::dynamic_pointer_cast<ModelAPI_ResultPart>(aObj);
+ return std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObj);
}
QModelIndex XGUI_PartDataModel::objectIndex(const ObjectPtr& theObject) const
QEvent::Type PostponeMessageQtEvent::PostponeMessageQtEventType = QEvent::Type(QEvent::registerEventType());
-boost::shared_ptr<Events_Message> PostponeMessageQtEvent::postponedMessage()
+std::shared_ptr<Events_Message> PostponeMessageQtEvent::postponedMessage()
{
return myMessage;
}
public:
static QEvent::Type PostponeMessageQtEventType;
- PostponeMessageQtEvent(const boost::shared_ptr<Events_Message>& theMessage)
+ PostponeMessageQtEvent(const std::shared_ptr<Events_Message>& theMessage)
: QEvent(PostponeMessageQtEventType),
myMessage(theMessage)
{
return PostponeMessageQtEventType;
}
- boost::shared_ptr<Events_Message> postponedMessage();
+ std::shared_ptr<Events_Message> postponedMessage();
private:
- boost::shared_ptr<Events_Message> myMessage;
+ std::shared_ptr<Events_Message> myMessage;
};
#endif /* XGUI_QEVENTS_H_ */
if (theFeature->data()) {
return theFeature;
} else {
- ObjectPtr aObject = boost::dynamic_pointer_cast<ModelAPI_Object>(theFeature);
+ ObjectPtr aObject = std::dynamic_pointer_cast<ModelAPI_Object>(theFeature);
return aObject->featureRef();
}
}*/
#include <ModelAPI_Feature.h>
-#include <boost/shared_ptr.hpp>
+#include <memory>
/*!
\brief Return directory part of the file path.
}
//******************************************************
-void XGUI_Workshop::processEvent(const boost::shared_ptr<Events_Message>& theMessage)
+void XGUI_Workshop::processEvent(const std::shared_ptr<Events_Message>& theMessage)
{
if (QApplication::instance()->thread() != QThread::currentThread()) {
#ifdef _DEBUG
//A message to start feature creation received.
if (theMessage->eventID() == Events_Loop::loop()->eventByName(Config_FeatureMessage::GUI_EVENT())) {
- boost::shared_ptr<Config_FeatureMessage> aFeatureMsg =
- boost::dynamic_pointer_cast<Config_FeatureMessage>(theMessage);
+ std::shared_ptr<Config_FeatureMessage> aFeatureMsg =
+ std::dynamic_pointer_cast<Config_FeatureMessage>(theMessage);
if (!aFeatureMsg->isInternal()) {
addFeature(aFeatureMsg);
}
// Process creation of Part
else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_CREATED)) {
- boost::shared_ptr<ModelAPI_ObjectUpdatedMessage> aUpdMsg =
- boost::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
+ std::shared_ptr<ModelAPI_ObjectUpdatedMessage> aUpdMsg =
+ std::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
onFeatureCreatedMsg(aUpdMsg);
if (myUpdatePrefs) {
if (mySalomeConnector)
// Redisplay feature
else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_TO_REDISPLAY)) {
- boost::shared_ptr<ModelAPI_ObjectUpdatedMessage> aUpdMsg =
- boost::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
+ std::shared_ptr<ModelAPI_ObjectUpdatedMessage> aUpdMsg =
+ std::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
onFeatureRedisplayMsg(aUpdMsg);
}
//Update property panel on corresponding message. If there is no current operation (no
//property panel), or received message has different feature to the current - do nothing.
else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_UPDATED)) {
- boost::shared_ptr<ModelAPI_ObjectUpdatedMessage> anUpdateMsg =
- boost::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
+ std::shared_ptr<ModelAPI_ObjectUpdatedMessage> anUpdateMsg =
+ std::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
onFeatureUpdatedMsg(anUpdateMsg);
}
else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_DELETED)) {
- boost::shared_ptr<ModelAPI_ObjectDeletedMessage> aDelMsg =
- boost::dynamic_pointer_cast<ModelAPI_ObjectDeletedMessage>(theMessage);
+ std::shared_ptr<ModelAPI_ObjectDeletedMessage> aDelMsg =
+ std::dynamic_pointer_cast<ModelAPI_ObjectDeletedMessage>(theMessage);
onObjectDeletedMsg(aDelMsg);
}
}
else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_TOSHOW)) {
- boost::shared_ptr<ModelAPI_ObjectUpdatedMessage> anUpdateMsg =
- boost::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
+ std::shared_ptr<ModelAPI_ObjectUpdatedMessage> anUpdateMsg =
+ std::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
const std::set<ObjectPtr>& aObjList = anUpdateMsg->objects();
QList<ObjectPtr> aList;
std::set<ObjectPtr>::const_iterator aIt;
}
else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_TOHIDE)) {
- boost::shared_ptr<ModelAPI_ObjectUpdatedMessage> anUpdateMsg =
- boost::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
+ std::shared_ptr<ModelAPI_ObjectUpdatedMessage> anUpdateMsg =
+ std::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
const std::set<ObjectPtr>& aObjList = anUpdateMsg->objects();
QList<ObjectPtr> aList;
std::set<ObjectPtr>::const_iterator aIt;
//An operation passed by message. Start it, process and commit.
else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OPERATION_LAUNCHED)) {
- boost::shared_ptr<Config_PointerMessage> aPartSetMsg =
- boost::dynamic_pointer_cast<Config_PointerMessage>(theMessage);
+ std::shared_ptr<Config_PointerMessage> aPartSetMsg =
+ std::dynamic_pointer_cast<Config_PointerMessage>(theMessage);
//myPropertyPanel->cleanContent();
ModuleBase_Operation* anOperation = (ModuleBase_Operation*) aPartSetMsg->pointer();
}
std::string aGrpName = ModelAPI_ResultPart::group();
for (int i = 0; i < aDoc->size(aGrpName); i++) {
- ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(aDoc->object(aGrpName, i));
+ ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aDoc->object(aGrpName, i));
if (aPart->partDoc() == aActiveDoc) {
activatePart(aPart); // Activate a part which corresponds to active Doc
return;
} else {
//Show error dialog if error message received.
- boost::shared_ptr<Events_Error> anAppError = boost::dynamic_pointer_cast<Events_Error>(theMessage);
+ std::shared_ptr<Events_Error> anAppError = std::dynamic_pointer_cast<Events_Error>(theMessage);
if (anAppError) {
emit errorOccurred(QString::fromLatin1(anAppError->description()));
}
}
//******************************************************
-void XGUI_Workshop::onFeatureUpdatedMsg(const boost::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg)
+void XGUI_Workshop::onFeatureUpdatedMsg(const std::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg)
{
std::set<ObjectPtr> aFeatures = theMsg->objects();
if (myOperationMgr->hasOperation()) {
}
//******************************************************
-void XGUI_Workshop::onFeatureRedisplayMsg(const boost::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg)
+void XGUI_Workshop::onFeatureRedisplayMsg(const std::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg)
{
std::set<ObjectPtr> aObjects = theMsg->objects();
std::set<ObjectPtr>::const_iterator aIt;
ObjectPtr aObj = (*aIt);
bool aHide = !aObj->data() || !aObj->data()->isValid();
if (!aHide) { // check that this is not hidden result
- ResultPtr aRes = boost::dynamic_pointer_cast<ModelAPI_Result>(aObj);
+ ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(aObj);
aHide = aRes && aRes->isConcealed();
}
if (aHide)
}
//******************************************************
-void XGUI_Workshop::onFeatureCreatedMsg(const boost::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg)
+void XGUI_Workshop::onFeatureCreatedMsg(const std::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg)
{
std::set<ObjectPtr> aObjects = theMsg->objects();
bool aHasPart = false;
bool isDisplayed = false;
for (aIt = aObjects.begin(); aIt != aObjects.end(); ++aIt) {
- ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(*aIt);
+ ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(*aIt);
if (aPart) {
aHasPart = true;
// If a feature is created from the aplication's python console
}
//******************************************************
-void XGUI_Workshop::onObjectDeletedMsg(const boost::shared_ptr<ModelAPI_ObjectDeletedMessage>& theMsg)
+void XGUI_Workshop::onObjectDeletedMsg(const std::shared_ptr<ModelAPI_ObjectDeletedMessage>& theMsg)
{
if (myObjectBrowser)
myObjectBrowser->processEvent(theMsg);
{
PostponeMessageQtEvent* aPostponedEv = dynamic_cast<PostponeMessageQtEvent*>(theEvent);
if (aPostponedEv) {
- boost::shared_ptr<Events_Message> aEventPtr = aPostponedEv->postponedMessage();
+ std::shared_ptr<Events_Message> aEventPtr = aPostponedEv->postponedMessage();
processEvent(aEventPtr);
return true;
}
/*
*
*/
-void XGUI_Workshop::addFeature(const boost::shared_ptr<Config_FeatureMessage>& theMessage)
+void XGUI_Workshop::addFeature(const std::shared_ptr<Config_FeatureMessage>& theMessage)
{
if (!theMessage) {
#ifdef _DEBUG
aMgr->startOperation();
}
static const Events_ID aRebuildEvent = Events_Loop::loop()->eventByName("Rebuild");
- Events_Loop::loop()->send(boost::shared_ptr<Events_Message>(
+ Events_Loop::loop()->send(std::shared_ptr<Events_Message>(
new Events_Message(aRebuildEvent, this)));
if (!aWasOperation) {
aMgr->finishOperation();
{
SessionPtr aMgr = ModelAPI_Session::get();
if (theObj) {
- ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(theObj);
+ ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(theObj);
if (aPart) {
DocumentPtr aPartDoc = aPart->partDoc();
if (aPartDoc) {
{
QList<ObjectPtr> aObjects = mySelector->selection()->selectedObjects();
if ((theId == "ACTIVATE_PART_CMD") && (aObjects.size() > 0)) {
- ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(aObjects.first());
+ ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObjects.first());
activatePart(aPart);
} else if (theId == "DEACTIVATE_PART_CMD")
activatePart(ResultPartPtr());
DocumentPtr aDoc = aMgr->moduleDocument();
std::string aGrpName = ModelAPI_ResultPart::group();
ObjectPtr aLastPart = aDoc->object(aGrpName, aDoc->size(aGrpName) - 1);
- ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(aLastPart);
+ ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aLastPart);
if (aPart) {
activatePart(aPart);
}
aMgr->startOperation();
foreach (ObjectPtr aObj, theList)
{
- ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(aObj);
+ ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObj);
if (aPart) {
DocumentPtr aDoc = aPart->document();
if (aDoc == aMgr->activeDocument()) {
}
//aMgr->moduleDocument()->removeFeature(aPart->owner());
} else {
- FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
+ FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
if (aFeature)
aObj->document()->removeFeature(aFeature);
}
{
foreach (ObjectPtr aObj, theList)
{
- ResultPtr aRes = boost::dynamic_pointer_cast<ModelAPI_Result>(aObj);
+ ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(aObj);
if (aRes) {
if (isVisible) {
myDisplayer->display(aRes, false);
displayDocumentResults(aRootDoc);
for (int i = 0; i < aRootDoc->size(ModelAPI_ResultPart::group()); i++) {
ObjectPtr aObject = aRootDoc->object(ModelAPI_ResultPart::group(), i);
- ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(aObject);
+ ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObject);
displayDocumentResults(aPart->partDoc());
}
myDisplayer->updateViewer();
XGUI_Workbench* addWorkbench(const QString& theName);
//! Redefinition of Events_Listener method
- virtual void processEvent(const boost::shared_ptr<Events_Message>& theMessage);
+ virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
//! Returns an object which provides interface to Salome Module (LightApp_Module)
XGUI_SalomeConnector* salomeConnector() const
protected:
bool event(QEvent * theEvent);
//Event-loop processing methods:
- void addFeature(const boost::shared_ptr<Config_FeatureMessage>&);
+ void addFeature(const std::shared_ptr<Config_FeatureMessage>&);
void connectWithOperation(ModuleBase_Operation* theOperation);
- void onFeatureUpdatedMsg(const boost::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg);
- void onFeatureCreatedMsg(const boost::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg);
- void onFeatureRedisplayMsg(const boost::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg);
- void onObjectDeletedMsg(const boost::shared_ptr<ModelAPI_ObjectDeletedMessage>& theMsg);
+ void onFeatureUpdatedMsg(const std::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg);
+ void onFeatureCreatedMsg(const std::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg);
+ void onFeatureRedisplayMsg(const std::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg);
+ void onObjectDeletedMsg(const std::shared_ptr<ModelAPI_ObjectDeletedMessage>& theMsg);
void validateOperation(const QString& theOperationId);