Isis 3 Programmer Reference
Isis::ShapeDisplayProperties Class Reference

This is the GUI communication mechanism for shape objects. More...

#include <ShapeDisplayProperties.h>

Inheritance diagram for Isis::ShapeDisplayProperties:
Inheritance graph
Collaboration diagram for Isis::ShapeDisplayProperties:
Collaboration graph

Classes

class  XmlHandler
 This class is used for processing an XML file containing information about a WorkOrder. More...
 

Public Types

enum  Property { None = 0, Color = 1, Selected = 2, ShowLabel = 16 }
 This is a list of properties and actions that are possible. More...
 

Public Slots

void setColor (QColor newColor)
 Change the color associated with this shape. More...
 
void setShowLabel (bool)
 Change the visibility of the display name associated with this shape. More...
 
void setSelected (bool)
 Change the selected state associated with this shape. More...
 

Signals

void propertyChanged (ShapeDisplayProperties *)
 
void supportAdded (Property)
 
void propertyChanged (DisplayProperties *)
 
void supportAdded (int)
 

Public Member Functions

 ShapeDisplayProperties (QString displayName, QObject *parent=NULL)
 ShapeDisplayProperties constructor. More...
 
 ShapeDisplayProperties (XmlStackedHandlerReader *xmlReader, QObject *parent=NULL)
 ShapeDisplayProperties constructor. More...
 
virtual ~ShapeDisplayProperties ()
 The destructor. More...
 
void addSupport (Property prop)
 Call this with every property you support, otherwise they will not communicate properly between widgets. More...
 
bool supports (Property prop)
 Support for this may come later. More...
 
QVariant getValue (Property prop) const
 Get a property's associated data. More...
 
void save (QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
 Saves this object to an XML file. More...
 
void fromPvl (const PvlObject &pvl)
 
PvlObject toPvl () const
 Convert to Pvl for project files. More...
 
void addSupport (int property)
 Call this with every property you support, otherwise they will not communicate properly between widgets. More...
 
bool supports (int property)
 Support may come later, please make sure you are connected to the supportAdded signal. More...
 
QVariant getValue (int property) const
 Get a property's associated data. More...
 
void setDisplayName (QString displayName)
 Sets display name. More...
 
QString displayName () const
 Returns the display name. More...
 

Static Public Member Functions

static QColor randomColor ()
 Creates and returns a random color for the initial color of the footprint polygon. More...
 

Protected Member Functions

void setValue (int prop, QVariant value)
 This is the generic mutator for properties. More...
 

Private Slots

void toggleShowLabel ()
 Change the visibility of the display name. More...
 

Private Member Functions

 ShapeDisplayProperties (const ShapeDisplayProperties &)
 
ShapeDisplayPropertiesoperator= (const ShapeDisplayProperties &)
 
void setValue (Property prop, QVariant value)
 This is the generic mutator for properties. More...
 

Static Private Member Functions

static QList< ShapeDisplayProperties * > senderToData (QObject *sender)
 Get the display properties from a slot. More...
 

Private Attributes

Property m_propertiesUsed
 This indicated whether any widgets with this DisplayProperties is using a particular property. More...
 
QMap< int, QVariant > * m_propertyValues
 This is a map from Property to value – the reason I use an int is so Qt knows how to serialize this QMap into binary data. More...
 

Detailed Description

This is the GUI communication mechanism for shape objects.

This class is the connector between various GUI interfaces for shape objects. We use this to communicate shared properties that various widgets need to know/should react to in a generic way.

This is how this class is supposed to "connect" widgets:

widgetA widgetB widgetC | | | ---—DisplayProperties ----—

When a user selects a shape in widgetA, widgetB and widgetC now have a chance to also select the same shape. This applies to all shared properties. Some of the properties are actions - such as ?????. This also allows a widget with no ??? (such as a list) to have an option to ???? (if any of the widgets support it*) and have that option work. There is no state associated with ????? - it's an action connected to a signal.

The proper way to detect a shape going away is to connect to the destroyed signal (from the parent QObject). Once that is emitted you cannot call any methods on this object.

Author
2016-07-25 Tracie Sucharski
History:
2016-07-25 Tracie Sucharski - Original Version

Definition at line 74 of file ShapeDisplayProperties.h.

Member Enumeration Documentation

◆ Property

This is a list of properties and actions that are possible.

Enumerator
None 

Null display property for bit-flag purposes.

Color 

The color of the control net, default randomized (QColor)

Selected 

The selection state of this control net (bool)

ShowLabel 

True if the control net should show its display name (bool)

Definition at line 80 of file ShapeDisplayProperties.h.

Constructor & Destructor Documentation

◆ ShapeDisplayProperties() [1/2]

Isis::ShapeDisplayProperties::ShapeDisplayProperties ( QString  displayName,
QObject parent = NULL 
)

ShapeDisplayProperties constructor.

This sets default values and constructs the object *.

Parameters
displayNameThe filename (fully expanded) of the object.
parentQt parent object (this is destroyed when parent is destroyed)

Definition at line 25 of file ShapeDisplayProperties.cpp.

References m_propertiesUsed, m_propertyValues, None, randomColor(), setSelected(), setShowLabel(), and setValue().

◆ ShapeDisplayProperties() [2/2]

Isis::ShapeDisplayProperties::ShapeDisplayProperties ( XmlStackedHandlerReader xmlReader,
QObject parent = NULL 
)

ShapeDisplayProperties constructor.

Parameters
xmlReaderThe XML reader parsing the XML file containing the display properties.
parentThe Qt parent object (this is destroyed when the parent is destroyed).

Definition at line 44 of file ShapeDisplayProperties.cpp.

References m_propertiesUsed, m_propertyValues, None, and Isis::XmlStackedHandlerReader::pushContentHandler().

◆ ~ShapeDisplayProperties()

Isis::ShapeDisplayProperties::~ShapeDisplayProperties ( )
virtual

The destructor.

Definition at line 56 of file ShapeDisplayProperties.cpp.

Member Function Documentation

◆ addSupport() [1/2]

void Isis::DisplayProperties::addSupport ( int  property)
inherited

Call this with every property you support, otherwise they will not communicate properly between widgets.

Parameters
propThe property you are adding support for

Definition at line 100 of file DisplayProperties.cpp.

References Isis::DisplayProperties::m_propertiesUsed, and Isis::DisplayProperties::supports().

Referenced by Isis::ImageTreeWidgetItem::ImageTreeWidgetItem(), and Isis::MosaicSceneItem::MosaicSceneItem().

◆ addSupport() [2/2]

void Isis::ShapeDisplayProperties::addSupport ( Property  prop)

Call this with every property you support, otherwise they will not communicate properly between widgets.

Parameters
propThe property you are adding support for

Definition at line 68 of file ShapeDisplayProperties.cpp.

References m_propertiesUsed, and supports().

◆ displayName()

◆ getValue() [1/2]

◆ getValue() [2/2]

QVariant Isis::ShapeDisplayProperties::getValue ( Property  prop) const

Get a property's associated data.

Parameters
propThe property
Returns
QVariant The data associated with the property.

Definition at line 92 of file ShapeDisplayProperties.cpp.

References m_propertyValues.

Referenced by toggleShowLabel().

◆ randomColor()

QColor Isis::ShapeDisplayProperties::randomColor ( )
static

Creates and returns a random color for the initial color of the footprint polygon.

Returns
QColor The color for the initial footprint polygon.

Definition at line 102 of file ShapeDisplayProperties.cpp.

Referenced by ShapeDisplayProperties().

◆ save()

void Isis::ShapeDisplayProperties::save ( QXmlStreamWriter &  stream,
const Project project,
FileName  newProjectRoot 
) const

Saves this object to an XML file.

Parameters
streamThe XML stream writer write to.
projectThe project this object is attached to (not used).
newProjectRootFileName of the project? (not used).

Definition at line 124 of file ShapeDisplayProperties.cpp.

References Isis::DisplayProperties::displayName().

Referenced by Isis::Shape::save().

◆ senderToData()

QList< ShapeDisplayProperties * > Isis::ShapeDisplayProperties::senderToData ( QObject senderObj)
staticprivate

Get the display properties from a slot.

This is for the slots that have a list of display properties as associated data. This gets that list out of the data.

Parameters
Theobject requesting the data.
Returns
QList<ShapeDisplayProperties *> A list of pointers to ShapeDisplayProperties objects.

Definition at line 300 of file ShapeDisplayProperties.cpp.

Referenced by toggleShowLabel().

◆ setColor

void Isis::ShapeDisplayProperties::setColor ( QColor  newColor)
slot

Change the color associated with this shape.

Parameters
newColorThe new color associated with this shape.

Definition at line 147 of file ShapeDisplayProperties.cpp.

References setValue().

◆ setDisplayName()

void Isis::DisplayProperties::setDisplayName ( QString  displayName)
inherited

Sets display name.

Parameters
displayNameDisplay name of the object.

Definition at line 89 of file DisplayProperties.cpp.

References Isis::DisplayProperties::displayName(), and Isis::DisplayProperties::m_displayName.

◆ setSelected

void Isis::ShapeDisplayProperties::setSelected ( bool  newValue)
slot

Change the selected state associated with this shape.

Parameters
Thenew state associated with this shape.

Definition at line 156 of file ShapeDisplayProperties.cpp.

References Selected, and setValue().

Referenced by ShapeDisplayProperties().

◆ setShowLabel

void Isis::ShapeDisplayProperties::setShowLabel ( bool  newValue)
slot

Change the visibility of the display name associated with this shape.

Parameters
newValueThe visibiliy of the display name for this shape.

Definition at line 165 of file ShapeDisplayProperties.cpp.

References setValue(), and ShowLabel.

Referenced by ShapeDisplayProperties(), and toggleShowLabel().

◆ setValue() [1/2]

void Isis::DisplayProperties::setValue ( int  property,
QVariant  value 
)
protectedinherited

◆ setValue() [2/2]

void Isis::ShapeDisplayProperties::setValue ( Property  prop,
QVariant  value 
)
private

This is the generic mutator for properties.

Given a value, this will change it and emit propertyChanged if its different and supported.

Parameters
propThe key into the m_propertyValues QMap <int, QVariant>
valueThe value we want to change to.

Definition at line 280 of file ShapeDisplayProperties.cpp.

References m_propertyValues, and supports().

Referenced by setColor(), setSelected(), setShowLabel(), and ShapeDisplayProperties().

◆ supports() [1/2]

bool Isis::DisplayProperties::supports ( int  property)
inherited

Support may come later, please make sure you are connected to the supportAdded signal.

Returns
True if the property has support, false otherwise

Definition at line 114 of file DisplayProperties.cpp.

References Isis::DisplayProperties::m_propertiesUsed.

Referenced by Isis::DisplayProperties::addSupport(), Isis::ImageList::allSupport(), and Isis::DisplayProperties::setValue().

◆ supports() [2/2]

bool Isis::ShapeDisplayProperties::supports ( Property  prop)

Support for this may come later.

Please make sure you are connected to the supportAdded signal.

Returns
bool True if the property has support, false otherwise.

Definition at line 81 of file ShapeDisplayProperties.cpp.

References m_propertiesUsed.

Referenced by addSupport(), and setValue().

◆ toggleShowLabel

void Isis::ShapeDisplayProperties::toggleShowLabel ( )
privateslot

Change the visibility of the display name.

This should only be connected to by an action with a list of displays as its data. This synchronizes all of the values where at least one is guaranteed to be toggled.

Definition at line 177 of file ShapeDisplayProperties.cpp.

References getValue(), senderToData(), setShowLabel(), and ShowLabel.

◆ toPvl()

PvlObject Isis::DisplayProperties::toPvl ( ) const
inherited

Convert to Pvl for project files.

This stores all of the data associated with all of the properties (but not what is supported). This also stores the cube filename.

Definition at line 60 of file DisplayProperties.cpp.

References Isis::DisplayProperties::displayName().

Member Data Documentation

◆ m_propertiesUsed

Property Isis::ShapeDisplayProperties::m_propertiesUsed
private

This indicated whether any widgets with this DisplayProperties is using a particular property.

This helps others who can set but not display know whether they should give the option to set.

Definition at line 160 of file ShapeDisplayProperties.h.

Referenced by addSupport(), ShapeDisplayProperties(), and supports().

◆ m_propertyValues

QMap<int, QVariant>* Isis::ShapeDisplayProperties::m_propertyValues
private

This is a map from Property to value – the reason I use an int is so Qt knows how to serialize this QMap into binary data.

Definition at line 166 of file ShapeDisplayProperties.h.

Referenced by getValue(), setValue(), and ShapeDisplayProperties().


The documentation for this class was generated from the following files: