Browse Source

Support relative measurements in serialization/deserialization

Neal Wilson 11 years ago
parent
commit
f6ffb1ee34
1 changed files with 11 additions and 0 deletions
  1. 11
    0
      src/typica.w

+ 11
- 0
src/typica.w View File

@@ -11154,6 +11154,13 @@ foreach(int c, temperatureColumns.keys())@/
11154 11154
 	{
11155 11155
 		xmlout.writeStartElement("temperature");
11156 11156
 		xmlout.writeAttribute("series", temperatureColumns.value(c));
11157
+		if(data->data(data->index(i, c), Qt::UserRole).toMap().contains("relative"))
11158
+		{
11159
+			if(data->data(data->index(i, c), Qt::UserRole).toMap().value("relative").toBool() == true)
11160
+			{
11161
+				xmlout.writeAttribute("relative", "true");
11162
+			}
11163
+		}
11157 11164
 		xmlout.writeCharacters(data->data(data->index(i, c), Qt::DisplayRole).
11158 11165
 		                                  toString());
11159 11166
 		xmlout.writeEndElement();
@@ -11413,6 +11420,10 @@ else if(xmlin.name() == "temperature")
11413 11420
 			                                   value("series").toString());
11414 11421
 	tempval = xmlin.readElementText().toDouble();
11415 11422
 	Measurement measurement(tempval, timeval);
11423
+	if(xmlin.attributes().value("relative").toString() == "true")
11424
+	{
11425
+		measurement.insert("relative", true);
11426
+	}
11416 11427
 	emit measure(measurement, column);
11417 11428
 }
11418 11429
 else if(xmlin.name() == "control")

Loading…
Cancel
Save