X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPartSet%2FPartSet_WidgetSketchCreator.h;h=58f8922dc391d4d3513af94f950b55c32929c76d;hb=485284976089df895e261395518201ccd85dae4d;hp=a53166444448a22d198a1c5ac495bab356046d09;hpb=d44671b5418920fef3264b53af7e62a8f8cb2bb7;p=modules%2Fshaper.git diff --git a/src/PartSet/PartSet_WidgetSketchCreator.h b/src/PartSet/PartSet_WidgetSketchCreator.h index a53166444..58f8922dc 100644 --- a/src/PartSet/PartSet_WidgetSketchCreator.h +++ b/src/PartSet/PartSet_WidgetSketchCreator.h @@ -1,8 +1,22 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D - -// File: PartSet_WidgetSketchCreator.h -// Created: 08 June 2015 -// Author: Vitaly SMETANNIKOV +// Copyright (C) 2014-2017 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or +// email : webmaster.salome@opencascade.com +// #ifndef PartSet_WidgetSketchCreator_H #define PartSet_WidgetSketchCreator_H @@ -14,7 +28,6 @@ class QLabel; class QLineEdit; class PartSet_Module; -class ModelAPI_Tools; class ModuleBase_Operation; class ModuleBase_IWorkshop; class PartSet_PreviewPlanes; @@ -44,7 +57,8 @@ public: /// \return a control list virtual QList getControls() const; - /// Set focus to the first control of the current widget. The focus policy of the control is checked. + /// Set focus to the first control of the current widget. + /// The focus policy of the control is checked. /// If the widget has the NonFocus focus policy, it is skipped. /// \return the state whether the widget can accept the focus virtual bool focusTo(); @@ -56,7 +70,7 @@ public: /// 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, + virtual bool setSelection(QList>& theValues, const bool theToValidate); /// Editing mode depends on mode of current operation. This value is defined by it. @@ -68,23 +82,21 @@ public: /// restored.The valid/invalid value is cashed. /// \param theValue a selected presentation in the view /// \return a boolean value - virtual bool isValidSelection(const ModuleBase_ViewerPrs& theValue); - - /// Check if the current and the parent operations are a composite. If the parent operation contains - /// attribute selection list, the method returns false if it is invalid in this attibute validator - /// \param theWorkshop a current workshop - /// \return boolean value - static bool canCommitCurrentSketch(ModuleBase_IWorkshop* theWorkshop); + 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 ModuleBase_ViewerPrs& theValue); + 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(); @@ -103,7 +115,7 @@ protected: /// Retunrs a list of possible shape types /// \return a list of shapes - virtual QIntList getShapeTypes() const; + virtual QIntList shapeTypes() const; /// Emits model changed info, updates the current control by selection change /// \param theDone a state whether the selection is set @@ -119,6 +131,10 @@ private: /// \return boolean value bool isSelectionMode() const; + /// Returns true if the current composite feature contains at least one sub-object + /// \return boolean value + bool hasSubObjects() const; + private slots: void onResumed(ModuleBase_Operation* theOp); @@ -126,7 +142,21 @@ private: /// Append new Sketch, set the selected plane for the sketch and start Edit operation. /// \param theValues a selection list /// \return true if the sketch is started - bool startSketchOperation(const QList& theValues); + 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; @@ -137,12 +167,11 @@ private: /// to store selection and check validation bool myIsCustomAttribute; + QWidget* mySizeOfViewWidget;///< Size of view widget, visualized if preview planes are shown + QLineEdit* mySizeOfView; ///< Value of square of size of View /// Label of the widget QLabel* myLabel; - /// Input control of the widget - QLineEdit* myTextLine; - /// List of accepting shapes types QStringList myShapeTypes;