diff --git a/models/tests/sedml/noble_1962_V_iK.sedml b/models/tests/sedml/noble_1962_V_iK.sedml
index 6fe00cf0b0..6b4140622f 100644
--- a/models/tests/sedml/noble_1962_V_iK.sedml
+++ b/models/tests/sedml/noble_1962_V_iK.sedml
@@ -143,7 +143,7 @@
-
+
true
@@ -205,7 +205,7 @@
-
+
true
@@ -267,7 +267,7 @@
-
+
true
@@ -329,7 +329,7 @@
-
+
true
@@ -351,4 +351,18 @@
+
+
+
+
+
+
diff --git a/models/tests/sedml/noble_1962_V_time.sedml b/models/tests/sedml/noble_1962_V_time.sedml
index 781fc3bf23..89fef04499 100644
--- a/models/tests/sedml/noble_1962_V_time.sedml
+++ b/models/tests/sedml/noble_1962_V_time.sedml
@@ -143,7 +143,7 @@
-
+
true
@@ -205,7 +205,7 @@
-
+
true
@@ -267,7 +267,7 @@
-
+
true
@@ -329,7 +329,7 @@
-
+
true
@@ -351,4 +351,18 @@
+
+
+
+
+
+
diff --git a/models/tests/sedml/noble_1962_gL_time.sedml b/models/tests/sedml/noble_1962_gL_time.sedml
index 8bbe7fa680..ef58f90eaf 100644
--- a/models/tests/sedml/noble_1962_gL_time.sedml
+++ b/models/tests/sedml/noble_1962_gL_time.sedml
@@ -143,7 +143,7 @@
-
+
true
@@ -205,7 +205,7 @@
-
+
true
@@ -267,7 +267,7 @@
-
+
true
@@ -329,7 +329,7 @@
-
+
true
@@ -351,4 +351,18 @@
+
+
+
+
+
+
diff --git a/models/tests/sedml/noble_1962_iK_V.sedml b/models/tests/sedml/noble_1962_iK_V.sedml
index 7d7bcc05ff..b4fd421caa 100644
--- a/models/tests/sedml/noble_1962_iK_V.sedml
+++ b/models/tests/sedml/noble_1962_iK_V.sedml
@@ -143,7 +143,7 @@
-
+
true
@@ -205,7 +205,7 @@
-
+
true
@@ -267,7 +267,7 @@
-
+
true
@@ -329,7 +329,7 @@
-
+
true
@@ -351,4 +351,18 @@
+
+
+
+
+
+
diff --git a/models/tests/sedml/noble_1962_iK_time.sedml b/models/tests/sedml/noble_1962_iK_time.sedml
index 69ff43ba70..f556fc9064 100644
--- a/models/tests/sedml/noble_1962_iK_time.sedml
+++ b/models/tests/sedml/noble_1962_iK_time.sedml
@@ -143,7 +143,7 @@
-
+
true
@@ -205,7 +205,7 @@
-
+
true
@@ -267,7 +267,7 @@
-
+
true
@@ -329,7 +329,7 @@
-
+
true
@@ -351,4 +351,18 @@
+
+
+
+
+
+
diff --git a/models/tests/sedml/noble_1962_local.sedml b/models/tests/sedml/noble_1962_local.sedml
index 476b3618b1..9e3b10dc07 100644
--- a/models/tests/sedml/noble_1962_local.sedml
+++ b/models/tests/sedml/noble_1962_local.sedml
@@ -191,7 +191,7 @@
-
+
true
@@ -253,7 +253,7 @@
-
+
true
@@ -272,7 +272,7 @@
-
+
true
@@ -291,7 +291,7 @@
-
+
true
@@ -353,7 +353,7 @@
-
+
true
@@ -372,7 +372,7 @@
-
+
true
@@ -391,7 +391,7 @@
-
+
true
@@ -413,4 +413,27 @@
+
+
+
+
+
+
+
+
+
diff --git a/models/tests/sedml/noble_1962_remote.sedml b/models/tests/sedml/noble_1962_remote.sedml
index 309aaba09d..500db5de42 100644
--- a/models/tests/sedml/noble_1962_remote.sedml
+++ b/models/tests/sedml/noble_1962_remote.sedml
@@ -191,7 +191,7 @@
-
+
true
@@ -253,7 +253,7 @@
-
+
true
@@ -272,7 +272,7 @@
-
+
true
@@ -291,7 +291,7 @@
-
+
true
@@ -353,7 +353,7 @@
-
+
true
@@ -372,7 +372,7 @@
-
+
true
@@ -391,7 +391,7 @@
-
+
true
@@ -413,4 +413,27 @@
+
+
+
+
+
+
+
+
+
diff --git a/models/tests/sedml/noble_1962_time_V.sedml b/models/tests/sedml/noble_1962_time_V.sedml
index d43733f296..01ffef8b94 100644
--- a/models/tests/sedml/noble_1962_time_V.sedml
+++ b/models/tests/sedml/noble_1962_time_V.sedml
@@ -143,7 +143,7 @@
-
+
true
@@ -205,7 +205,7 @@
-
+
true
@@ -267,7 +267,7 @@
-
+
true
@@ -329,7 +329,7 @@
-
+
true
@@ -351,4 +351,18 @@
+
+
+
+
+
+
diff --git a/models/tests/sedml/noble_1962_time_gL.sedml b/models/tests/sedml/noble_1962_time_gL.sedml
index 4edd81baf1..2b734058b1 100644
--- a/models/tests/sedml/noble_1962_time_gL.sedml
+++ b/models/tests/sedml/noble_1962_time_gL.sedml
@@ -143,7 +143,7 @@
-
+
true
@@ -205,7 +205,7 @@
-
+
true
@@ -267,7 +267,7 @@
-
+
true
@@ -329,7 +329,7 @@
-
+
true
@@ -351,4 +351,18 @@
+
+
+
+
+
+
diff --git a/models/tests/sedml/noble_1962_time_iK.sedml b/models/tests/sedml/noble_1962_time_iK.sedml
index cc946eee88..a219d61cd1 100644
--- a/models/tests/sedml/noble_1962_time_iK.sedml
+++ b/models/tests/sedml/noble_1962_time_iK.sedml
@@ -143,7 +143,7 @@
-
+
true
@@ -205,7 +205,7 @@
-
+
true
@@ -267,7 +267,7 @@
-
+
true
@@ -329,7 +329,7 @@
-
+
true
@@ -351,4 +351,18 @@
+
+
+
+
+
+
diff --git a/models/tests/sedml/noble_1962_time_time.sedml b/models/tests/sedml/noble_1962_time_time.sedml
index 078b18d4f7..294ba31c89 100644
--- a/models/tests/sedml/noble_1962_time_time.sedml
+++ b/models/tests/sedml/noble_1962_time_time.sedml
@@ -143,7 +143,7 @@
-
+
true
@@ -205,7 +205,7 @@
-
+
true
@@ -267,7 +267,7 @@
-
+
true
@@ -329,7 +329,7 @@
-
+
true
@@ -351,4 +351,18 @@
+
+
+
+
+
+
diff --git a/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewsimulationwidget.cpp b/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewsimulationwidget.cpp
index b0518c3a31..c56d82ca1f 100644
--- a/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewsimulationwidget.cpp
+++ b/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewsimulationwidget.cpp
@@ -2064,9 +2064,24 @@ bool SimulationExperimentViewSimulationWidget::createSedmlFile(SEDMLSupport::Sed
sedmlCurve->setYDataReference(sedmlDataGeneratorIdY);
sedmlCurve->setType(libsedml::SEDML_CURVETYPE_POINTS);
- // Customise our curve using an annotation
+ // Customise our curve using a style
+
+ libsedml::SedStyle *sedmlStyle = sedmlDocument->createStyle();
+ sedmlStyle->setId(QString("style%1_%2").arg(data.graphPlotCounter)
+ .arg(graphCounter).toStdString());
+
+ libsedml::SedLine *sedmlLine = sedmlStyle->createLine();
Core::Properties lineProperties = properties[4]->properties();
+
+ sedmlLine->setStyle(SEDMLSupport::sedmlLineStyle(lineProperties[0]->listValueIndex()));
+ sedmlLine->setThickness(lineProperties[1]->doubleValue());
+ sedmlLine->setColor(SEDMLSupport::sedmlColor(lineProperties[2]->colorValue()).toStdString());
+
+ sedmlCurve->setStyle(sedmlStyle->getId());
+
+ // Customise our curve using an annotation
+
Core::Properties symbolProperties = properties[5]->properties();
sedmlCurve->appendAnnotation(QString(R"(<%1 xmlns="%2">)"
diff --git a/src/plugins/support/SEDMLSupport/src/sedmlsupport.cpp b/src/plugins/support/SEDMLSupport/src/sedmlsupport.cpp
index 8a6e6e96a5..7ed6d0f2e1 100644
--- a/src/plugins/support/SEDMLSupport/src/sedmlsupport.cpp
+++ b/src/plugins/support/SEDMLSupport/src/sedmlsupport.cpp
@@ -25,6 +25,7 @@ along with this program. If not, see .
//==============================================================================
+#include
#include
#include
@@ -267,6 +268,64 @@ QwtSymbol::Style symbolStyle(const QString &pStringSymbolStyle)
//==============================================================================
+libsedml::LineType_t sedmlLineStyle(int pIndexLineStyle)
+{
+ // Return the given index line style as a SED-ML line style
+ // Note: if the given index line style is invalid then we return the SED-ML
+ // line style for a solid line...
+
+ if (pIndexLineStyle == 0) {
+ return libsedml::SEDML_LINETYPE_NONE;
+ }
+
+ if (pIndexLineStyle == 1) {
+ return libsedml::SEDML_LINETYPE_SOLID;
+ }
+
+ if (pIndexLineStyle == 2) {
+ return libsedml::SEDML_LINETYPE_DASH;
+ }
+
+ if (pIndexLineStyle == 3) {
+ return libsedml::SEDML_LINETYPE_DOT;
+ }
+
+ if (pIndexLineStyle == 4) {
+ return libsedml::SEDML_LINETYPE_DASHDOT;
+ }
+
+//---ISSUE2053--- WAITING FOR libsedml::SEDML_LINETYPE_DASHDOTDOT TO BE ADDED
+// (SEE https://github.com/fbergmann/libSEDML/issues/64)
+// if (pIndexLineStyle == 5) {
+// return libsedml::SEDML_LINETYPE_DASHDOTDOT;
+// }
+
+ return libsedml::SEDML_LINETYPE_SOLID;
+}
+
+//==============================================================================
+
+QString sedmlColor(const QColor &pColor)
+{
+ // Return the given colour as a SED-ML string colour
+
+ QString res = pColor.name(QColor::HexArgb);
+
+ res.remove(0, 1);
+
+ QString alpha = res.left(2);
+
+ res.remove(0, 2);
+
+ if (alpha != "ff") {
+ res += alpha;
+ }
+
+ return res.toUpper();
+}
+
+//==============================================================================
+
} // namespace SEDMLSupport
} // namespace OpenCOR
diff --git a/src/plugins/support/SEDMLSupport/src/sedmlsupport.h b/src/plugins/support/SEDMLSupport/src/sedmlsupport.h
index af8e92bbee..2664dc5f27 100644
--- a/src/plugins/support/SEDMLSupport/src/sedmlsupport.h
+++ b/src/plugins/support/SEDMLSupport/src/sedmlsupport.h
@@ -39,6 +39,12 @@ along with this program. If not, see .
//==============================================================================
+#include "libsedmlbegin.h"
+ #include "sedml/SedLine.h"
+#include "libsedmlend.h"
+
+//==============================================================================
+
namespace OpenCOR {
namespace SEDMLSupport {
@@ -68,6 +74,10 @@ QString SEDMLSUPPORT_EXPORT stringSymbolStyle(QwtSymbol::Style pSymbolStyle,
QwtSymbol::Style SEDMLSUPPORT_EXPORT symbolStyle(int pIndexSymbolStyle);
QwtSymbol::Style SEDMLSUPPORT_EXPORT symbolStyle(const QString &pStringSymbolStyle);
+libsedml::LineType_t SEDMLSUPPORT_EXPORT sedmlLineStyle(int pIndexLineStyle);
+
+QString SEDMLSUPPORT_EXPORT sedmlColor(const QColor &pColor);
+
//==============================================================================
} // namespace SEDMLSupport
diff --git a/src/plugins/support/SEDMLSupport/tests/tests.cpp b/src/plugins/support/SEDMLSupport/tests/tests.cpp
index 561830158c..a0b792f291 100644
--- a/src/plugins/support/SEDMLSupport/tests/tests.cpp
+++ b/src/plugins/support/SEDMLSupport/tests/tests.cpp
@@ -262,6 +262,30 @@ void Tests::symbolStyleTests()
//==============================================================================
+void Tests::sedmlTests()
+{
+ // Convert an index line style to a SED-ML line style
+
+ QCOMPARE(OpenCOR::SEDMLSupport::sedmlLineStyle(-1), libsedml::SEDML_LINETYPE_SOLID);
+ QCOMPARE(OpenCOR::SEDMLSupport::sedmlLineStyle(0), libsedml::SEDML_LINETYPE_NONE);
+ QCOMPARE(OpenCOR::SEDMLSupport::sedmlLineStyle(1), libsedml::SEDML_LINETYPE_SOLID);
+ QCOMPARE(OpenCOR::SEDMLSupport::sedmlLineStyle(2), libsedml::SEDML_LINETYPE_DASH);
+ QCOMPARE(OpenCOR::SEDMLSupport::sedmlLineStyle(3), libsedml::SEDML_LINETYPE_DOT);
+ QCOMPARE(OpenCOR::SEDMLSupport::sedmlLineStyle(4), libsedml::SEDML_LINETYPE_DASHDOT);
+//---ISSUE2053--- WAITING FOR libsedml::SEDML_LINETYPE_DASHDOTDOT TO BE ADDED
+// (SEE https://github.com/fbergmann/libSEDML/issues/64)
+// QCOMPARE(OpenCOR::SEDMLSupport::sedmlLineStyle(5), libsedml::SEDML_LINETYPE_DASHDOTDOT);
+ QCOMPARE(OpenCOR::SEDMLSupport::sedmlLineStyle(6), libsedml::SEDML_LINETYPE_SOLID);
+
+ // Convert a Qt colour to a SED-ML colour
+
+ QCOMPARE(OpenCOR::SEDMLSupport::sedmlColor(QColor("#1a2b3c")), "1A2B3C");
+ QCOMPARE(OpenCOR::SEDMLSupport::sedmlColor(QColor("#ff1a2b3c")), "1A2B3C");
+ QCOMPARE(OpenCOR::SEDMLSupport::sedmlColor(QColor("#7e1a2b3c")), "1A2B3C7E");
+}
+
+//==============================================================================
+
QTEST_GUILESS_MAIN(Tests)
//==============================================================================
diff --git a/src/plugins/support/SEDMLSupport/tests/tests.h b/src/plugins/support/SEDMLSupport/tests/tests.h
index 8a5325a57f..799d1b64f4 100644
--- a/src/plugins/support/SEDMLSupport/tests/tests.h
+++ b/src/plugins/support/SEDMLSupport/tests/tests.h
@@ -36,6 +36,7 @@ class Tests : public QObject
private slots:
void lineStyleTests();
void symbolStyleTests();
+ void sedmlTests();
};
//==============================================================================