Workspace 6.21.5
Public Member Functions | List of all members
ImageToOverlayAdaptor Class Reference

A TypeAdaptor class for converting an image to an image overlay.

#include <DataAnalysis/Image/imagetooverlayadaptor.h>

Inheritance diagram for ImageToOverlayAdaptor:
[legend]

Public Member Functions

 ImageToOverlayAdaptor (QObject *parent=nullptr)
 
 ~ImageToOverlayAdaptor () override
 
bool adapt (DataExecution::DataObject &src, DataExecution::DataObject &dest, bool copy) override
 
bool connectConversionAction (QAction &action) override
 
int getAnchor () const
 
const DataExecution::TypeAdaptorFactorygetFactory () const override
 
int getOffsetX () const
 
int getOffsetY () const
 
double getOpacity () const
 
bool load (const DataExecution::SerializedItem &item) override
 
bool save (DataExecution::SerializedItem &item) const override
 
void setAnchor (int anchor)
 
void setOffsetX (int x)
 
void setOffsetY (int y)
 
void setOpacity (double opacity)
 
- Public Member Functions inherited from TypeAdaptor
 ~TypeAdaptor () override=default
 
virtual bool adapt (DataObject &src, DataObject &dest, bool copy)=0
 
bool canSerialize () const override
 
virtual bool connectConversionAction (QAction &action)
 
virtual const TypeAdaptorFactorygetFactory () const =0
 
bool load (const SerializedItem &item) override
 
bool save (SerializedItem &item) const override
 
- Public Member Functions inherited from Serialize
virtual ~Serialize ()=default
 
virtual bool canSerialize () const =0
 
virtual bool load (const SerializedItem &item)=0
 
virtual bool save (SerializedItem &item) const =0
 

Constructor & Destructor Documentation

◆ ImageToOverlayAdaptor()

ImageToOverlayAdaptor ( QObject *  parent = nullptr)
Parameters
parent

◆ ~ImageToOverlayAdaptor()

~ImageToOverlayAdaptor ( )
override

Member Function Documentation

◆ adapt()

bool adapt ( DataExecution::DataObject src,
DataExecution::DataObject dest,
bool  copy 
)
overridevirtual

Performs the conversion between DataObjects.

Parameters
srcThe DataObject that will be converted and stored in dest.
destThe destination of the converted DataObject
copyWhether a copy should occur regardless of whether or not a copy can be avoided.

Some adapt() calls will always effectively make a copy, since they create a different data type from the source. Some, however, are able to make the destination data object re-use the source, such as when the destination is a base class of the source' data type.

Returns
true if the conversion was successful, false if the conversion was unsuccessful.

All TypeAdaptor subclasses are required to override this function and must respect the copy flag.

Implements TypeAdaptor.

◆ connectConversionAction()

bool connectConversionAction ( QAction &  action)
overridevirtual
Parameters
actionA QAction that will be used in things like a context menu.

Subclasses should only reimplement this function if they need to provide some degree of configurability for their type adaptor. If the subclass does reimplement the function, it must do at least two things:

  • Connect the action to a slot so that the type adaptor will handle the action being triggered.
  • Return true to indicate that the action will be handled.

In addition, the subclass would not normally change the text, icon or shortcut of the action. In fact, the only thing a subclass should do is make a signal/slot connection to it. When the user triggers this action, they would expect to be presented with a dialog box through which they could configure any relevant settings specific to this type adaptor. For example, an adaptor that converts from double to QString would add a signal/slot connection to action, with that slot opening a dialog box with settings for things like the precision, field width, floating point format, etc.

Returns
True if the action will be handled, or false if the action is not needed. If the return value is false, the caller will typically end up deleting the action again.

Reimplemented from TypeAdaptor.

◆ getAnchor()

int getAnchor ( ) const

◆ getFactory()

const TypeAdaptorFactory & getFactory ( ) const
overridevirtual
Returns
The TypeAdaptorFactory this TypeAdaptor belongs to.

Implements TypeAdaptor.

◆ getOffsetX()

int getOffsetX ( ) const

◆ getOffsetY()

int getOffsetY ( ) const

◆ getOpacity()

double getOpacity ( ) const

◆ load()

bool load ( const DataExecution::SerializedItem item)
overridevirtual
Parameters
itemSupplies the state to be loaded into this object.

This function will load the state of this object from item. For many object types, this is most easily implemented in terms of the object's input operator (>>).

It would be reasonable for subclass implementations to assume that the data provided in item is in the same form as would have been saved from a call to save.

Returns
If the state of the object could not be loaded, the function returns false. A return value of true implies that the object state was successfully loaded. If canSerialize() returns false, this function must do nothing except return false as well.

Implements Serialize.

◆ save()

bool save ( DataExecution::SerializedItem item) const
overridevirtual
Parameters
itemWhere to save the state of this object.

This function will serialise the object by saving it to item. For most object types, this is most easily implemented in terms of the object's output operator (<<).

It is allowable for an object to only serialize part of itself. This would be useful if the data it represents has a set of defaults and only those values different to the defaults need to be serialized. Such an implementation then needs to be careful how it handles the complimentary load member function.

Returns
If an object could not be serialised or if the underlying object type does not support serialisation, this function should return false. A return value of true implies that the object was successfully saved to item. If canSerialize() returns false, this function must do nothing except return false as well.

Implements Serialize.

◆ setAnchor()

void setAnchor ( int  anchor)

◆ setOffsetX()

void setOffsetX ( int  x)

◆ setOffsetY()

void setOffsetY ( int  y)

◆ setOpacity()

void setOpacity ( double  opacity)