From 9f363a5839e964d3a0c31a955561a2e8b774c268 Mon Sep 17 00:00:00 2001 From: vsv Date: Thu, 26 Jun 2014 12:48:51 +0400 Subject: [PATCH] Divide method init on initFeature and initSelection --- src/PartSet/PartSet_OperationFeatureCreate.cpp | 4 ++-- src/PartSet/PartSet_OperationFeatureEdit.cpp | 5 ++--- src/PartSet/PartSet_OperationFeatureEdit.h | 9 ++------- src/PartSet/PartSet_OperationFeatureEditMulti.cpp | 12 +++++++----- src/PartSet/PartSet_OperationFeatureEditMulti.h | 11 ++++++----- src/PartSet/PartSet_OperationSketch.cpp | 6 +++--- src/PartSet/PartSet_OperationSketch.h | 8 ++------ 7 files changed, 24 insertions(+), 31 deletions(-) diff --git a/src/PartSet/PartSet_OperationFeatureCreate.cpp b/src/PartSet/PartSet_OperationFeatureCreate.cpp index 6aabe1e67..a72593906 100644 --- a/src/PartSet/PartSet_OperationFeatureCreate.cpp +++ b/src/PartSet/PartSet_OperationFeatureCreate.cpp @@ -91,8 +91,8 @@ void PartSet_OperationFeatureCreate::initSelection(const std::listgetKind() != SKETCH_LINE_KIND) -// return; + //if (!theFeature || theFeature->getKind() != SKETCH_LINE_KIND) + // return; myInitFeature = theFeature; } diff --git a/src/PartSet/PartSet_OperationFeatureEdit.cpp b/src/PartSet/PartSet_OperationFeatureEdit.cpp index dc7f99ddf..6ab6edf95 100644 --- a/src/PartSet/PartSet_OperationFeatureEdit.cpp +++ b/src/PartSet/PartSet_OperationFeatureEdit.cpp @@ -58,13 +58,12 @@ std::list PartSet_OperationFeatureEdit::getSelectionModes(FeaturePtr theFea return PartSet_OperationSketchBase::getSelectionModes(theFeature); } -void PartSet_OperationFeatureEdit::init(FeaturePtr theFeature, - const std::list& theSelected, - const std::list& theHighlighted) +void PartSet_OperationFeatureEdit::initFeature(FeaturePtr theFeature) { setEditingFeature(theFeature); } + FeaturePtr PartSet_OperationFeatureEdit::sketch() const { return mySketch; diff --git a/src/PartSet/PartSet_OperationFeatureEdit.h b/src/PartSet/PartSet_OperationFeatureEdit.h index 0071c967a..a750cf9f7 100644 --- a/src/PartSet/PartSet_OperationFeatureEdit.h +++ b/src/PartSet/PartSet_OperationFeatureEdit.h @@ -70,13 +70,8 @@ public: /// \return the selection mode virtual std::list getSelectionModes(FeaturePtr theFeature) const; - /// Initializes some fields accorging to the feature - /// \param theFeature the feature - /// \param theSelected the list of selected presentations - /// \param theHighlighted the list of highlighted presentations - virtual void init(FeaturePtr theFeature, - const std::list& theSelected, - const std::list& theHighlighted); + /// Initializes the operation with previously created feature. It is used in sequental operations + virtual void initFeature(FeaturePtr theFeature); /// Returns the operation sketch feature /// \returns the sketch instance diff --git a/src/PartSet/PartSet_OperationFeatureEditMulti.cpp b/src/PartSet/PartSet_OperationFeatureEditMulti.cpp index d719df8c9..89928ccde 100644 --- a/src/PartSet/PartSet_OperationFeatureEditMulti.cpp +++ b/src/PartSet/PartSet_OperationFeatureEditMulti.cpp @@ -48,12 +48,9 @@ bool PartSet_OperationFeatureEditMulti::isGranted(ModuleBase_IOperation* theOper return theOperation->getDescription()->operationId().toStdString() == PartSet_OperationSketch::Type(); } -void PartSet_OperationFeatureEditMulti::init(FeaturePtr theFeature, - const std::list& theSelected, - const std::list& theHighlighted) +void PartSet_OperationFeatureEditMulti::initSelection(const std::list& theSelected, + const std::list& theHighlighted) { - setEditingFeature(theFeature); - if (!theHighlighted.empty()) { // if there is highlighted object, we check whether it is in the list of selected objects // in that case this object is a handle of the moved lines. If there no such object in the selection, @@ -73,6 +70,11 @@ void PartSet_OperationFeatureEditMulti::init(FeaturePtr theFeature, myFeatures = theSelected; } +void PartSet_OperationFeatureEditMulti::initFeature(FeaturePtr theFeature) +{ + setEditingFeature(theFeature); +} + FeaturePtr PartSet_OperationFeatureEditMulti::sketch() const { return mySketch; diff --git a/src/PartSet/PartSet_OperationFeatureEditMulti.h b/src/PartSet/PartSet_OperationFeatureEditMulti.h index f21a78ad6..a431a1d85 100644 --- a/src/PartSet/PartSet_OperationFeatureEditMulti.h +++ b/src/PartSet/PartSet_OperationFeatureEditMulti.h @@ -65,13 +65,14 @@ public: /// \param theOperation the previous running operation virtual bool isGranted(ModuleBase_IOperation* theOperation) const; - /// Initializes some fields accorging to the feature - /// \param theFeature the feature + /// Initializes the operation with previously created feature. It is used in sequental operations + virtual void initFeature(FeaturePtr theFeature); + + /// Initialisation of operation with preliminary selection /// \param theSelected the list of selected presentations /// \param theHighlighted the list of highlighted presentations - virtual void init(FeaturePtr theFeature, - const std::list& theSelected, - const std::list& theHighlighted); + virtual void initSelection(const std::list& theSelected, + const std::list& theHighlighted); /// Returns the operation sketch feature /// \returns the sketch instance diff --git a/src/PartSet/PartSet_OperationSketch.cpp b/src/PartSet/PartSet_OperationSketch.cpp index dfe2fe85c..b035dca5c 100644 --- a/src/PartSet/PartSet_OperationSketch.cpp +++ b/src/PartSet/PartSet_OperationSketch.cpp @@ -58,9 +58,9 @@ std::list PartSet_OperationSketch::getSelectionModes(FeaturePtr theFeature) return aModes; } -void PartSet_OperationSketch::init(FeaturePtr theFeature, - const std::list& /*theSelected*/, - const std::list& /*theHighlighted*/) + +/// Initializes the operation with previously created feature. It is used in sequental operations +void PartSet_OperationSketch::initFeature(FeaturePtr theFeature) { if (theFeature) setEditingFeature(theFeature); diff --git a/src/PartSet/PartSet_OperationSketch.h b/src/PartSet/PartSet_OperationSketch.h index 27c0d8641..37c0482ca 100644 --- a/src/PartSet/PartSet_OperationSketch.h +++ b/src/PartSet/PartSet_OperationSketch.h @@ -39,12 +39,8 @@ public: /// \return the selection mode virtual std::list getSelectionModes(FeaturePtr theFeature) const; - /// Initializes some fields accorging to the feature - /// \param theSelected the list of selected presentations - /// \param theHighlighted the list of highlighted presentations - virtual void init(FeaturePtr theFeature, - const std::list& theSelected, - const std::list& theHighlighted); + /// Initializes the operation with previously created feature. It is used in sequental operations + virtual void initFeature(FeaturePtr theFeature); /// Returns the operation sketch feature /// \returns the sketch instance -- 2.39.2