comparison layer/SpectrumLayer.cpp @ 220:8dc50f57d480

* Make the vertical scale a bit less thtoopid for many linear scale spectra * Don't forget to reload slice layer properties when loading a session, as well as spectrum layer (i.e. subclass) properties
author Chris Cannam
date Mon, 05 Mar 2007 13:04:52 +0000
parents 34bbbcb3c01f
children 28c8e8e3c537
comparison
equal deleted inserted replaced
219:1fff998ae4a9 220:8dc50f57d480
239 setWindowType(Preferences::getInstance()->getWindowType()); 239 setWindowType(Preferences::getInstance()->getWindowType());
240 return; 240 return;
241 } 241 }
242 } 242 }
243 243
244 QString
245 SpectrumLayer::toXmlString(QString indent, QString extraAttributes) const
246 {
247 QString s;
248
249 s += QString("windowSize=\"%1\" "
250 "windowHopLevel=\"%2\"")
251 .arg(m_windowSize)
252 .arg(m_windowHopLevel);
253
254 return SliceLayer::toXmlString(indent, extraAttributes + " " + s);
255 }
256
257 void
258 SpectrumLayer::setProperties(const QXmlAttributes &attributes)
259 {
260 bool ok = false;
261
262 size_t windowSize = attributes.value("windowSize").toUInt(&ok);
263 if (ok) setWindowSize(windowSize);
264
265 size_t windowHopLevel = attributes.value("windowHopLevel").toUInt(&ok);
266 if (ok) setWindowHopLevel(windowHopLevel);
267 }
268
269 bool 244 bool
270 SpectrumLayer::getValueExtents(float &min, float &max, bool &logarithmic, 245 SpectrumLayer::getValueExtents(float &min, float &max, bool &logarithmic,
271 QString &units) const 246 QString &units) const
272 { 247 {
273 return false; 248 return false;
361 336
362 return description; 337 return description;
363 } 338 }
364 339
365 340
366 341 QString
342 SpectrumLayer::toXmlString(QString indent, QString extraAttributes) const
343 {
344 QString s;
345
346 s += QString("windowSize=\"%1\" "
347 "windowHopLevel=\"%2\"")
348 .arg(m_windowSize)
349 .arg(m_windowHopLevel);
350
351 return SliceLayer::toXmlString(indent, extraAttributes + " " + s);
352 }
353
354 void
355 SpectrumLayer::setProperties(const QXmlAttributes &attributes)
356 {
357 SliceLayer::setProperties(attributes);
358
359 bool ok = false;
360
361 size_t windowSize = attributes.value("windowSize").toUInt(&ok);
362 if (ok) setWindowSize(windowSize);
363
364 size_t windowHopLevel = attributes.value("windowHopLevel").toUInt(&ok);
365 if (ok) setWindowHopLevel(windowHopLevel);
366 }
367
368