} else if (aGroup->Get() == ModelAPI_ResultGroup::group().c_str()) {
aNewBody = createGroup(theFeature->data(), aResIndex);
} else if (aGroup->Get() == ModelAPI_ResultField::group().c_str()) {
- aNewBody = createField(theFeature->data(), aResIndex);
+ ResultFieldPtr aField = createField(theFeature->data(), aResIndex);
+ aField->updateSteps(); // to refresh the internal data
+ aNewBody = aField;
} else if (aGroup->Get() == ModelAPI_ResultParameter::group().c_str()) {
theFeature->attributeChanged("expression"); // just produce a value
} else {
}
return NULL;
}
+
+std::string Model_ResultField::Model_FieldStep::name() {
+ std::ostringstream aStream;
+ aStream<<myParent->data()->name()<<std::endl;
+ aStream<<"Step "<<(myId + 1)<<" "<<myParent->textLine(myId);
+ return aStream.str();
+}
// LCOV_EXCL_STOP
{
public:
Model_FieldStep(ModelAPI_ResultField* theParent, int theId)
- : ModelAPI_ResultField::ModelAPI_FieldStep(), myParent(theParent), myId(theId) {};
+ : ModelAPI_ResultField::ModelAPI_FieldStep(), myParent(theParent), myId(theId)
+ {
+ setData(myParent->data()); // it is not needed to have special data for the temporary
+ // step object, but data must be "valid" for GUI checks
+ };
virtual ModelAPI_ResultField* field() const { return myParent; }
virtual std::shared_ptr<ModelAPI_Document> document() const { return myParent->document(); }
+ /// Returns a GUI name of this step
+ virtual std::string name();
+
private:
ModelAPI_ResultField* myParent;
int myId;
};
- /// Retuns the parameters of color definition in the resources config manager
+ /// Returns the parameters of color definition in the resources configuration manager
MODEL_EXPORT virtual void colorConfigInfo(std::string& theSection, std::string& theName,
std::string& theDefault);
/// Removes the stored builders
MODEL_EXPORT virtual ~Model_ResultField();
+ /// To refresh the steps of a field
+ MODEL_EXPORT virtual void updateSteps();
+
protected:
/// Makes a body on the given feature data
Model_ResultField(std::shared_ptr<ModelAPI_Data> theOwnerData);
friend class Model_Objects;
private:
- void updateSteps();
std::vector<FieldStepPtr> mySteps;
};
/// signal.
MODELAPI_EXPORT virtual void setDisplayed(const bool theDisplay);
+ /// Returns a GUI name of this step
+ MODELAPI_EXPORT virtual std::string name() = 0;
+
protected:
/// This method is called just after creation of the object: it must initialize
/// all fields, normally initialized in the constructor
/// Returns step object
/// \param theId an id of the object
virtual std::shared_ptr<ModelAPI_ResultField::ModelAPI_FieldStep> step(int theId) const = 0;
+
+ /// To refresh the steps of a field
+ MODELAPI_EXPORT virtual void updateSteps() = 0;
};
//! Pointer on feature object
aPrs->dataRange(aMin, aMax);
aViewer->setColorScaleRange(aMin, aMax);
}
- aViewer->setColorScaleTitle("Step");
+ aViewer->setColorScaleTitle(aStep->name().c_str());
aViewer->setColorScaleShown(true);
}
}
ObjectPtr aObj = (*aIt);
// Hide the object if it is invalid or concealed one
- //bool aHide = !aObj->data() || !aObj->data()->isValid() ||
- // aObj->isDisabled() || (!aObj->isDisplayed());
- // TODO: Remove the Hide code as soon as a fields step will become as object
- bool aHide = false;
- if (aObj->groupName() == ModelAPI_ResultField::ModelAPI_FieldStep::group())
- aHide = !aObj->isDisplayed();
- else
- aHide = !aObj->data() || !aObj->data()->isValid() ||
- aObj->isDisabled() || (!aObj->isDisplayed());
+ bool aHide = !aObj->data() || !aObj->data()->isValid() ||
+ aObj->isDisabled() || (!aObj->isDisplayed());
if (!aHide) { // check that this is not hidden result
ResultPtr aRes = std::dynamic_pointer_cast<ModelAPI_Result>(aObj);