# HG changeset patch # User lbajardsilogic # Date 1213277797 0 # Node ID 82d17c4d4b397d5a1f94887de813bf51567a3179 # Parent 3e35ed5332cb19b32592c38b4fa6fb01fb23bf2e set a color and a value different when a new interval layer is loaded diff -r 3e35ed5332cb -r 82d17c4d4b39 data/fileio/ModelReader.cpp --- a/data/fileio/ModelReader.cpp Thu Jun 12 12:29:49 2008 +0000 +++ b/data/fileio/ModelReader.cpp Thu Jun 12 13:36:37 2008 +0000 @@ -223,6 +223,15 @@ m_model = model; m_model->setObjectName(eventLabel); + //set color and value for interval + IntervalModel *im = dynamic_cast (m_model); + if ((m_pane) && (im)) + { + int modulo = m_pane->getIntervalModulo(); + im->setMeanValue(modulo*0.2+0.2); + m_layer->setProperty("Colour", modulo + 1); + } + //link model, layer document and view if (m_model && m_layer) { @@ -261,7 +270,7 @@ label += iter->second + " - "; } //value - float value = 0.5; + float value = im->getMeanValue(); im->addInterval(start, end, label, value); } } diff -r 3e35ed5332cb -r 82d17c4d4b39 data/model/IntervalModel.h --- a/data/model/IntervalModel.h Thu Jun 12 12:29:49 2008 +0000 +++ b/data/model/IntervalModel.h Thu Jun 12 13:36:37 2008 +0000 @@ -99,6 +99,8 @@ void changeInterval(TimeIntervalPtr ti, long start, long end, float value, const QString& label); + inline float getMeanValue() {return m_meanValue;}; + inline void setMeanValue(float value) {m_meanValue = value;}; /** * Command to change an interval. */ @@ -214,6 +216,8 @@ IntervalList m_intervals; mutable QMutex m_mutex; + float m_meanValue; + }; #endif // _INTERVAL_MODEL_H_ diff -r 3e35ed5332cb -r 82d17c4d4b39 view/Pane.cpp --- a/view/Pane.cpp Thu Jun 12 12:29:49 2008 +0000 +++ b/view/Pane.cpp Thu Jun 12 13:36:37 2008 +0000 @@ -54,7 +54,8 @@ m_vpan(0), m_hthumb(0), m_vthumb(0), - m_reset(0) + m_reset(0), + m_intervalModulo(3) { setObjectName("Pane"); setMouseTracking(true); diff -r 3e35ed5332cb -r 82d17c4d4b39 view/Pane.h --- a/view/Pane.h Thu Jun 12 12:29:49 2008 +0000 +++ b/view/Pane.h Thu Jun 12 13:36:37 2008 +0000 @@ -61,6 +61,7 @@ virtual QString toEasaierXmlString(QString indent = "", QString extraAttributes = "") const; + virtual int getIntervalModulo() {m_intervalModulo = (m_intervalModulo+1)%4; return m_intervalModulo;} signals: void paneInteractedWith(); void rightButtonMenuRequested(QPoint position); @@ -144,6 +145,8 @@ Thumbwheel *m_hthumb; Thumbwheel *m_vthumb; NotifyingPushButton *m_reset; + + int m_intervalModulo; }; #endif