One signal about the features has been moved.
static Events_ID MY_ID = Events_Loop::eventByName(EVENT_FEATURE_DELETED);
return MY_ID;
}
+
+Model_FeaturesMovedMessage::Model_FeaturesMovedMessage()
+: Events_Message(messageId(), 0)
+{
+}
+
+const Events_ID Model_FeaturesMovedMessage::messageId()
+{
+ static Events_ID MY_ID = Events_Loop::eventByName(EVENT_FEATURES_MOVED);
+ return MY_ID;
+}
+
+void Model_FeaturesMovedMessage::setFeatures(
+ const std::list<boost::shared_ptr<ModelAPI_Feature> >& theFeatures)
+{
+ myFeatures = theFeatures;
+}
+
+const std::list<boost::shared_ptr<ModelAPI_Feature> >& Model_FeaturesMovedMessage::features() const
+{
+ return myFeatures;
+}
+
#include <Model.h>
#include <Events_Message.h>
+#include <Events_Loop.h>
#include <boost/shared_ptr.hpp>
#include <string>
+#include <list>
class ModelAPI_Feature;
class ModelAPI_Document;
static const char * EVENT_FEATURE_UPDATED = "FeatureUpdated";
/// Event ID that data of feature is deleted (comes with Model_FeatureDeletedMessage)
static const char * EVENT_FEATURE_DELETED = "FeatureDeleted";
+/// Event ID that data of feature is updated (comes with Model_FeaturesMovedMessage)
+static const char * EVENT_FEATURES_MOVED = "FeaturesMoved";
/// Message that feature was changed (used for Object Browser update)
class Model_FeatureUpdatedMessage : public Events_Message {
const std::string& group() const {return myGroup;}
};
+/// Message that features were moved (used for the feature preview update)
+class Model_FeaturesMovedMessage : public Events_Message {
+ std::list<boost::shared_ptr<ModelAPI_Feature> > myFeatures; ///< which features are moved
+public:
+ /// creates a message by initialization of fields
+ MODEL_EXPORT Model_FeaturesMovedMessage();
+
+ /// Returns the ID of this message (EVENT_FEATURES_MOVED)
+ static const Events_ID messageId();
+
+ /// Sets a list of features
+ MODEL_EXPORT void setFeatures(const std::list<boost::shared_ptr<ModelAPI_Feature> >& theFeatures);
+
+ /// Returns a list of features
+ MODEL_EXPORT const std::list<boost::shared_ptr<ModelAPI_Feature> >& features() const;
+};
+
#endif
)
# The Qt5Widgets_LIBRARIES variable also includes QtGui and QtCore
-TARGET_LINK_LIBRARIES(PartSet ${PROJECT_LIBRARIES} XGUI ModelAPI GeomAlgoAPI)
+TARGET_LINK_LIBRARIES(PartSet ${PROJECT_LIBRARIES} XGUI ModelAPI Model GeomAlgoAPI)
ADD_DEPENDENCIES(PartSet ModuleBase)
#include <ModelAPI_Data.h>
#include <ModelAPI_Document.h>
+#include <Model_Events.h>
+
+#include <Events_Loop.h>
+
#include <SketchPlugin_Line.h>
#include <V3d_View.hxx>
moveLinePoint(aFeature, aDeltaX, aDeltaY, LINE_ATTR_END);
}
}
+ sendFeatures();
+
myCurPoint.setPoint(aPoint);
}
return boost::shared_ptr<ModelAPI_Feature>();
}
-void PartSet_OperationEditLine::moveLinePoint(boost::shared_ptr<ModelAPI_Feature> theFeature,
+void PartSet_OperationEditLine::moveLinePoint(boost::shared_ptr<ModelAPI_Feature> theFeature,
double theDeltaX, double theDeltaY,
const std::string& theAttribute)
{
aPoint->setValue(aPoint->x() + theDeltaX, aPoint->y() + theDeltaY);
}
+
+void PartSet_OperationEditLine::sendFeatures()
+{
+ std::list<boost::shared_ptr<ModelAPI_Feature> > aFeatures;
+ std::list<XGUI_ViewerPrs>::const_iterator anIt = myFeatures.begin(), aLast = myFeatures.end();
+ for (; anIt != aLast; anIt++) {
+ boost::shared_ptr<ModelAPI_Feature> aFeature = (*anIt).feature();
+ if (!aFeature || aFeature == feature())
+ continue;
+ }
+
+ static Events_ID aModuleEvent = Events_Loop::eventByName("PartSetEditEvent");
+ Model_FeaturesMovedMessage aMessage;
+ aMessage.setFeatures(aFeatures);
+ Events_Loop::loop()->send(aMessage);
+}
+
\class PartSet_OperationEditLine
* \brief The operation for the sketch feature creation
*/
-class PARTSET_EXPORT PartSet_OperationEditLine : public PartSet_OperationSketchBase
+class PARTSET_EXPORT PartSet_OperationEditLine : public PartSet_OperationSketchBase
{
Q_OBJECT
/// Struct to define gp point, with the state is the point is initialized
void moveLinePoint(boost::shared_ptr<ModelAPI_Feature> theFeature,
double theDeltaX, double theDeltaY,
const std::string& theAttribute);
+ /// Sends the features
+ void sendFeatures();
private:
boost::shared_ptr<ModelAPI_Feature> mySketch; ///< the sketch feature