#include <ModelAPI_Validator.h>
#include <ModelAPI_AttributeIntArray.h>
#include <ModelAPI_ResultConstruction.h>
+#include <ModelAPI_AttributeBoolean.h>
#include <list>
#include <map>
#include <iostream>
}
//******************************************************
-void getIsoLines(const std::shared_ptr<ModelAPI_Result>& theResult, std::vector<int>& theNbLines)
+void getIsoLines(const std::shared_ptr<ModelAPI_Result>& theResult,
+ bool& isVisible, std::vector<int>& theNbLines)
{
theNbLines.clear();
+ isVisible = false;
+ if (!theResult.get())
+ return;
if (theResult->groupName() == ModelAPI_ResultConstruction::group()) {
theNbLines.push_back(0);
theNbLines.push_back(0);
}
else {
// get color from the attribute of the result
- if (theResult.get() != NULL &&
- theResult->data()->attribute(ModelAPI_Result::ISO_LINES_ID()).get() != NULL) {
- AttributeIntArrayPtr aAttr = theResult->data()->intArray(ModelAPI_Result::ISO_LINES_ID());
- if (aAttr.get() && aAttr->size()) {
+ AttributeIntArrayPtr aAttr = theResult->data()->intArray(ModelAPI_Result::ISO_LINES_ID());
+ if (aAttr.get()) {
+ if (aAttr->size()) {
theNbLines.push_back(aAttr->value(0));
theNbLines.push_back(aAttr->value(1));
}
}
+ AttributeBooleanPtr aBoolAttr =
+ theResult->data()->boolean(ModelAPI_Result::SHOW_ISO_LINES_ID());
+ if (aBoolAttr.get()) {
+ isVisible = aBoolAttr->value();
+ }
}
}
}
}
+//******************************************************
+void showIsoLines(std::shared_ptr<ModelAPI_Result> theResult, bool theShow)
+{
+ if (!theResult.get())
+ return;
+
+ AttributeBooleanPtr aAttr = theResult->data()->boolean(ModelAPI_Result::SHOW_ISO_LINES_ID());
+ if (aAttr.get() != NULL) {
+ aAttr->setValue(theShow);
+ }
+}
+
+//******************************************************
+bool isShownIsoLines(std::shared_ptr<ModelAPI_Result> theResult)
+{
+ if (!theResult.get())
+ return false;
+
+ AttributeBooleanPtr aAttr = theResult->data()->boolean(ModelAPI_Result::SHOW_ISO_LINES_ID());
+ if (aAttr.get() != NULL) {
+ return aAttr->value();
+ }
+ return false;
+}
+
//**************************************************************
void setTransparency(ResultPtr theResult, double theTransparency)
{