X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPartSet%2FPartSet_WidgetSketchCreator.h;h=57ba50ecaf5507ac377d891ce416b1c353bf854c;hb=d753b4c529b94fb5be840ea857b45bb6f78bbb0a;hp=7349d16159cefd3b2b3c1fdc1cc3a32be7a06043;hpb=58aebaaaea5ce694e6c718920c8e2dfe1bf00b55;p=modules%2Fshaper.git diff --git a/src/PartSet/PartSet_WidgetSketchCreator.h b/src/PartSet/PartSet_WidgetSketchCreator.h index 7349d1615..57ba50eca 100644 --- a/src/PartSet/PartSet_WidgetSketchCreator.h +++ b/src/PartSet/PartSet_WidgetSketchCreator.h @@ -12,10 +12,11 @@ #include class QLabel; -class QLineEdit; class PartSet_Module; +class ModelAPI_Tools; class ModuleBase_Operation; - +class ModuleBase_IWorkshop; +class PartSet_PreviewPlanes; /** * \ingroup Modules @@ -50,15 +51,48 @@ public: /// The methiod called when widget is deactivated virtual void deactivate(); + /// Set the given wrapped value to the current widget + /// This value should be processed in the widget according to the needs + /// \param theValues the wrapped selection values + /// \param theToValidate a validation of the values flag + virtual bool setSelection(QList>& theValues, + const bool theToValidate); + + /// Editing mode depends on mode of current operation. This value is defined by it. + virtual void setEditingMode(bool isEditing); + + /// Checks all widget validator if the owner is valid. Firstly it checks custom widget validating, + /// next, the attribute's validating. It trying on the give selection to current attribute by + /// setting the value inside and calling validators. After this, the previous attribute value is + /// restored.The valid/invalid value is cashed. + /// \param theValue a selected presentation in the view + /// \return a boolean value + virtual bool isValidSelection(const std::shared_ptr& theValue); + protected: + /// If there is no operation in current session, start operation for modify parameters + /// \return true if the operation was not opened + void openExtrusionTransaction(); + + /// Checks whether the selection presentation contains preview planes + /// \param theValue a selection information + /// \return a boolean value + virtual bool isValidSelectionCustom(const std::shared_ptr& theValue); + /// Saves the internal parameters to the given feature /// \return True in success - virtual bool storeValueCustom() const; + virtual bool storeValueCustom(); virtual bool restoreValueCustom(); - /// The methiod called when widget is activated - virtual void activateCustom(); + /// Retunrs attribute, which should be validated. In default implementation, + /// this is an attribute of ID + /// \return an attribute + virtual AttributePtr attribute() const; + + /// Sets the selection control visible and set the current widget as active in property panel + /// It leads to connect to onSelectionChanged slot + void activateSelectionControl(); /// Visualization of the current control or others in PP /// \param theSelectionControl state whether the control should be shown/hidden @@ -68,12 +102,13 @@ protected: /// \return a list of shapes virtual QIntList getShapeTypes() const; - /// Store the values to the model attribute of the widget. It casts this attribute to - /// the specific type and set the given values - /// \param theSelectedObject an object - /// \param theShape a selected shape, which is used in the selection attribute - /// \return true if it is succeed - virtual void setObject(ObjectPtr theSelectedObject, GeomShapePtr theShape); + /// Emits model changed info, updates the current control by selection change + /// \param theDone a state whether the selection is set + void updateOnSelectionChanged(const bool theDone); + +protected slots: + /// Slot which is called on selection event + virtual void onSelectionChanged(); private: /// Returns true if the selection mode is active. This is when composition feature has no @@ -81,37 +116,50 @@ private: /// \return boolean value bool isSelectionMode() const; -protected slots: - /// Slot which is called on selection event - // NDS: virtual is temporary - virtual void onSelectionChanged(); + /// Returns true if the current composite feature contains at least one sub-object + /// \return boolean value + bool hasSubObjects() const; private slots: - void onStarted(); - void onResumed(ModuleBase_Operation* theOp); private: /// Append new Sketch, set the selected plane for the sketch and start Edit operation. - void startSketchOperation(); + /// \param theValues a selection list + /// \return true if the sketch is started + bool startSketchOperation(const QList>& theValues); + + /// Sets the sub-object to list of base. + static void setSketchObjectToList(const CompositeFeaturePtr& theFeature, + const AttributePtr& theAttribute); + + /// Calls validator for attribute list and warn if it is not valid + /// \return true if validation succeed + bool validateSelectionList() const; + + /// Change enable state of controls in the model widget by the attribute identifier + /// \param theModelWidget a model widget + /// \param theEnabled a state if the controls should be enabled/disabled + void setEnabledModelWidget(ModuleBase_ModelWidget* theModelWidget, + const bool theEnabled); private: std::string myAttributeListID; PartSet_Module* myModule; + /// Flag if the attribute() should return the attribute list ID or XML attribute + /// to store selection and check validation + bool myIsCustomAttribute; + /// Label of the widget QLabel* myLabel; - /// Input control of the widget - QLineEdit* myTextLine; - /// List of accepting shapes types QStringList myShapeTypes; - /// To check if we need to use body for composite feature or not - bool myUseBody; - + /// class to show/hide preview planes + PartSet_PreviewPlanes* myPreviewPlanes; }; #endif \ No newline at end of file