#include <ModelAPI_AttributeDocRef.h>
#include <ModelAPI_Validator.h>
#include <ModelAPI_AttributeIntArray.h>
+#include <ModelAPI_ResultConstruction.h>
+#include <ModelAPI_AttributeBoolean.h>
#include <list>
#include <map>
#include <iostream>
}
}
+
+//**************************************************************
+void setDeflection(ResultPtr theResult, const double theDeflection)
+{
+ if (!theResult.get())
+ return;
+
+ AttributeDoublePtr aDeflectionAttr = theResult->data()->real(ModelAPI_Result::DEFLECTION_ID());
+ if (aDeflectionAttr.get() != NULL) {
+ aDeflectionAttr->setValue(theDeflection);
+ }
+}
+
// used by GUI only
// LCOV_EXCL_START
double getDeflection(const std::shared_ptr<ModelAPI_Result>& theResult)
return aDeflection;
}
+//******************************************************
+void setColor(ResultPtr theResult, const std::vector<int>& theColor)
+{
+ if (!theResult.get())
+ return;
+
+ AttributeIntArrayPtr aColorAttr = theResult->data()->intArray(ModelAPI_Result::COLOR_ID());
+ if (aColorAttr.get() != NULL) {
+ if (!aColorAttr->size()) {
+ aColorAttr->setSize(3);
+ }
+ aColorAttr->setValue(0, theColor[0]);
+ aColorAttr->setValue(1, theColor[1]);
+ aColorAttr->setValue(2, theColor[2]);
+ }
+}
void getColor(const std::shared_ptr<ModelAPI_Result>& theResult, std::vector<int>& theColor)
{
}
}
+//******************************************************
+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
+ 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 setIsoLines(ResultPtr theResult, const std::vector<int>& theIso)
+{
+ if (!theResult.get())
+ return;
+
+ AttributeIntArrayPtr aAttr = theResult->data()->intArray(ModelAPI_Result::ISO_LINES_ID());
+ if (aAttr.get() != NULL) {
+ if (!aAttr->size()) {
+ aAttr->setSize(2);
+ }
+ aAttr->setValue(0, theIso[0]);
+ aAttr->setValue(1, theIso[1]);
+ }
+}
+
+//******************************************************
+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)
+{
+ if (!theResult.get())
+ return;
+
+ AttributeDoublePtr anAttribute = theResult->data()->real(ModelAPI_Result::TRANSPARENCY_ID());
+ if (anAttribute.get() != NULL) {
+ anAttribute->setValue(theTransparency);
+ }
+}
+
double getTransparency(const std::shared_ptr<ModelAPI_Result>& theResult)
{
double aTransparency = -1;
aDestColor->setValue(a, aSourceColor->value(a));
}
}
+ // Iso-lines
+ AttributeIntArrayPtr aSource = theSource->data()->intArray(ModelAPI_Result::ISO_LINES_ID());
+ if (aSource.get() && aSource->isInitialized() && aSource->size()) {
+ AttributeIntArrayPtr aDest = theDest->data()->intArray(ModelAPI_Result::ISO_LINES_ID());
+ if (aDest.get()) {
+ aDest->setSize(aSource->size());
+ for(int a = 0; a < aSource->size(); a++)
+ aDest->setValue(a, aSource->value(a));
+ }
+ }
// deflection
AttributeDoublePtr aSourceDefl = theSource->data()->real(ModelAPI_Result::DEFLECTION_ID());
if (aSourceDefl.get() && aSourceDefl->isInitialized()) {