comparison layer/Layer.h @ 269:7b58c5e91f20

* save/reload measurements in session
author Chris Cannam
date Tue, 26 Jun 2007 12:27:47 +0000
parents 70537b0434c4
children 61a704654497
comparison
equal deleted inserted replaced
268:70537b0434c4 269:7b58c5e91f20
265 * inverse of the toXmlString method. 265 * inverse of the toXmlString method.
266 */ 266 */
267 virtual void setProperties(const QXmlAttributes &) = 0; 267 virtual void setProperties(const QXmlAttributes &) = 0;
268 268
269 /** 269 /**
270 * Produce an XML string containing the layer's ID and type. This
271 * is used to refer to the layer in the display section of the SV
272 * session file, for a layer that has already been described in
273 * the data section.
274 */
275 virtual QString toBriefXmlString(QString indent = "",
276 QString extraAttributes = "") const;
277
278 /**
279 * Add a measurement rectangle from the given XML attributes
280 * (presumably taken from a measurement element).
281 * Does not use a command.
282 */
283 virtual void addMeasurementRect(const QXmlAttributes &);
284
285 /**
270 * Indicate that a layer is not currently visible in the given 286 * Indicate that a layer is not currently visible in the given
271 * view and is not expected to become visible in the near future 287 * view and is not expected to become visible in the near future
272 * (for example because the user has explicitly removed or hidden 288 * (for example because the user has explicitly removed or hidden
273 * it). The layer may respond by (for example) freeing any cache 289 * it). The layer may respond by (for example) freeing any cache
274 * memory it is using, until next time its paint method is called, 290 * memory it is using, until next time its paint method is called,
409 bool haveFrames; 425 bool haveFrames;
410 long startFrame; // only valid if haveFrames 426 long startFrame; // only valid if haveFrames
411 long endFrame; // ditto 427 long endFrame; // ditto
412 428
413 bool operator<(const MeasureRect &mr) const; 429 bool operator<(const MeasureRect &mr) const;
430 QString toXmlString(QString indent) const;
414 }; 431 };
415 432
416 class AddMeasurementRectCommand : public Command 433 class AddMeasurementRectCommand : public Command
417 { 434 {
418 public: 435 public:
426 private: 443 private:
427 Layer *m_layer; 444 Layer *m_layer;
428 MeasureRect m_rect; 445 MeasureRect m_rect;
429 }; 446 };
430 447
431 void addMeasureRect(const MeasureRect &r) { 448 void addMeasureRectToSet(const MeasureRect &r) {
432 m_measureRects.insert(r); 449 m_measureRects.insert(r);
433 emit layerMeasurementRectsChanged(); 450 emit layerMeasurementRectsChanged();
434 } 451 }
435 452
436 void deleteMeasureRect(const MeasureRect &r) { 453 void deleteMeasureRectFromSet(const MeasureRect &r) {
437 m_measureRects.erase(r); 454 m_measureRects.erase(r);
438 emit layerMeasurementRectsChanged(); 455 emit layerMeasurementRectsChanged();
439 } 456 }
440 457
441 typedef std::set<MeasureRect> MeasureRectSet; 458 typedef std::set<MeasureRect> MeasureRectSet;
442 MeasureRectSet m_measureRects; 459 MeasureRectSet m_measureRects;
443 MeasureRect m_draggingRect; 460 MeasureRect m_draggingRect;
444 bool m_haveDraggingRect; 461 bool m_haveDraggingRect;
445 462
446 void paintMeasurementRect(View *v, QPainter &paint, MeasureRect &r); 463 void paintMeasurementRect(View *v, QPainter &paint,
464 const MeasureRect &r) const;
447 465
448 private: 466 private:
449 mutable QMutex m_dormancyMutex; 467 mutable QMutex m_dormancyMutex;
450 mutable std::map<const void *, bool> m_dormancy; 468 mutable std::map<const void *, bool> m_dormancy;
451 }; 469 };