comparison layer/LayerFactory.cpp @ 6:02aaea1ffaf7

* Beginnings of session save code * Add spline curve mode to time value layer
author Chris Cannam
date Thu, 12 Jan 2006 17:19:08 +0000
parents 37b110168acf
children 06bba0b79b1c
comparison
equal deleted inserted replaced
5:37b110168acf 6:02aaea1ffaf7
87 87
88 return types; 88 return types;
89 } 89 }
90 90
91 LayerFactory::LayerType 91 LayerFactory::LayerType
92 LayerFactory::getLayerType(Layer *layer) 92 LayerFactory::getLayerType(const Layer *layer)
93 { 93 {
94 if (dynamic_cast<WaveformLayer *>(layer)) return Waveform; 94 if (dynamic_cast<const WaveformLayer *>(layer)) return Waveform;
95 if (dynamic_cast<SpectrogramLayer *>(layer)) return Spectrogram; 95 if (dynamic_cast<const SpectrogramLayer *>(layer)) return Spectrogram;
96 if (dynamic_cast<TimeRulerLayer *>(layer)) return TimeRuler; 96 if (dynamic_cast<const TimeRulerLayer *>(layer)) return TimeRuler;
97 if (dynamic_cast<TimeInstantLayer *>(layer)) return TimeInstants; 97 if (dynamic_cast<const TimeInstantLayer *>(layer)) return TimeInstants;
98 if (dynamic_cast<TimeValueLayer *>(layer)) return TimeValues; 98 if (dynamic_cast<const TimeValueLayer *>(layer)) return TimeValues;
99 if (dynamic_cast<Colour3DPlotLayer *>(layer)) return Colour3DPlot; 99 if (dynamic_cast<const Colour3DPlotLayer *>(layer)) return Colour3DPlot;
100 return UnknownLayer;
101 }
102
103 QString
104 LayerFactory::getLayerTypeName(LayerType type)
105 {
106 switch (type) {
107 case Waveform: return "waveform";
108 case Spectrogram: return "spectrogram";
109 case TimeRuler: return "timeruler";
110 case TimeInstants: return "timeinstants";
111 case TimeValues: return "timevalues";
112 case Colour3DPlot: return "colour3dplot";
113 default: return "unknown";
114 }
115 }
116
117 LayerFactory::LayerType
118 LayerFactory::getLayerTypeForName(QString name)
119 {
120 if (name == "waveform") return Waveform;
121 if (name == "spectrogram") return Spectrogram;
122 if (name == "timeruler") return TimeRuler;
123 if (name == "timeinstants") return TimeInstants;
124 if (name == "timevalues") return TimeValues;
125 if (name == "colour3dplot") return Colour3DPlot;
100 return UnknownLayer; 126 return UnknownLayer;
101 } 127 }
102 128
103 void 129 void
104 LayerFactory::setModel(Layer *layer, Model *model) 130 LayerFactory::setModel(Layer *layer, Model *model)