71b43d
#pragma once
71b43d
71b43d
#ifndef TASSISTANTSIMAGE_INCLUDED
71b43d
#define TASSISTANTSIMAGE_INCLUDED
71b43d
71b43d
#include "timage.h"
71b43d
#include "tthreadmessage.h"
71b43d
71b43d
#include <qreadlocker></qreadlocker>
71b43d
#include <qwritelocker></qwritelocker>
71b43d
#include <qreadwritelock></qreadwritelock>
71b43d
71b43d
#include <string></string>
71b43d
71b43d
#undef DVAPI
71b43d
#undef DVVAR
71b43d
#ifdef TASSISTANTSIMAGE_EXPORTS
71b43d
#define DVAPI DV_EXPORT_API
71b43d
#define DVVAR DV_EXPORT_VAR
71b43d
#else
71b43d
#define DVAPI DV_IMPORT_API
71b43d
#define DVVAR DV_IMPORT_VAR
71b43d
#endif
71b43d
71b43d
//-------------------------------------------------------------------
71b43d
71b43d
class TAssistantDesc;
71b43d
typedef std::vector<tassistantdesc> TAssistantDescList;</tassistantdesc>
71b43d
71b43d
//-------------------------------------------------------------------
71b43d
71b43d
class TAssistantDesc {
71b43d
public:
71b43d
  std::string type;
71b43d
  std::vector<tpointd> points;</tpointd>
71b43d
  TSmartObjectP handler;
71b43d
};
71b43d
71b43d
//-------------------------------------------------------------------
71b43d
71b43d
//! An image containing an assistants for painting.
71b43d
71b43d
class DVAPI TAssistantsImage final : public TImage {
71b43d
public:
71b43d
  class Reader: public QReadLocker {
71b43d
  private:
71b43d
    const TAssistantsImage &m_image;
71b43d
  public:
71b43d
    Reader(const TAssistantsImage &image):
71b43d
      QReadLocker(&image.m_rwLock), m_image(image) { }
71b43d
    const TAssistantsImage& image() const
71b43d
      { return m_image; }
71b43d
    const TAssistantDescList& get() const
71b43d
      { return m_image.m_assistants; }
71b43d
    const TAssistantDescList& operator*() const
71b43d
      { return get(); }
71b43d
    const TAssistantDescList* operator->() const
71b43d
      { return &get(); }
71b43d
  };
71b43d
71b43d
  class Writer: public QWriteLocker {
71b43d
  private:
71b43d
    TAssistantsImage &m_image;
71b43d
  public:
71b43d
    Writer(TAssistantsImage &image):
71b43d
      QWriteLocker(&image.m_rwLock), m_image(image) { }
71b43d
    TAssistantsImage& image() const
71b43d
      { return m_image; }
71b43d
    TAssistantDescList& get() const
71b43d
      { return m_image.m_assistants; }
71b43d
    TAssistantDescList& operator*() const
71b43d
      { return get(); }
71b43d
    TAssistantDescList* operator->() const
71b43d
      { return &get(); }
71b43d
  };
71b43d
71b43d
private:
71b43d
  mutable QReadWriteLock m_rwLock;
71b43d
  TAssistantDescList m_assistants;
71b43d
71b43d
public:
71b43d
  TAssistantsImage();
71b43d
  ~TAssistantsImage();
71b43d
71b43d
private:
71b43d
  //! not implemented
71b43d
  TAssistantsImage(const TAssistantsImage &other);
71b43d
  TAssistantsImage &operator=(const TAssistantsImage &) { return *this; }
71b43d
71b43d
public:
71b43d
  //! Return the image type
71b43d
  TImage::Type getType() const override { return TImage::ASSISTANTS; }
71b43d
71b43d
  //! Return a clone of image
71b43d
  TImage* cloneImage() const override;
71b43d
71b43d
  //! Return the bbox of the image
71b43d
  TRectD getBBox() const override;
71b43d
};
71b43d
71b43d
#endif