Isis 3 Developer Reference
ShapeDisplayProperties.h
Go to the documentation of this file.
1 #ifndef ShapeDisplayProperties_H
2 #define ShapeDisplayProperties_H
3 
26 #include <QColor> // This is required since QColor is in a slot
27 #include <QMetaType> // required since we're adding to QVariant
28 #include <QObject>
29 
30 #include "DisplayProperties.h"
31 #include "XmlStackedHandler.h"
32 
33 class QAction;
34 class QXmlStreamWriter;
35 
36 namespace Isis {
37  class FileName;
38  class Project;
39  class Pvl;
40  class PvlObject;
41  class XmlStackedHandlerReader;
42 
75  Q_OBJECT
76  public:
80  enum Property {
82  None = 0,
84  Color = 1,
86  Selected = 2,
88  ShowLabel = 16,
89  };
90 
91 
92  ShapeDisplayProperties(QString displayName, QObject *parent = NULL);
93  ShapeDisplayProperties(XmlStackedHandlerReader *xmlReader, QObject *parent = NULL);
94  virtual ~ShapeDisplayProperties();
95 
96 // void fromPvl(const PvlObject &pvl);
97 // PvlObject toPvl() const;
98 
99  void addSupport(Property prop);
100  bool supports(Property prop);
101 
102  QVariant getValue(Property prop) const;
103 
104  static QColor randomColor();
105 
106  void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const;
107 
108  signals:
110  void supportAdded(Property);
111 
112  public slots:
113  void setColor(QColor newColor);
114  void setShowLabel(bool);
115  void setSelected(bool);
116 
117  private slots:
118  void toggleShowLabel();
119 
120  private:
129  class XmlHandler : public XmlStackedHandler {
130  public:
131  XmlHandler(ShapeDisplayProperties *displayProperties);
132 
133  virtual bool startElement(const QString &namespaceURI, const QString &localName,
134  const QString &qName, const QXmlAttributes &atts);
135 
136  virtual bool characters(const QString &ch);
137 
138  virtual bool endElement(const QString &namespaceURI, const QString &localName,
139  const QString &qName);
140 
141  private:
142  Q_DISABLE_COPY(XmlHandler);
143 
144  ShapeDisplayProperties *m_displayProperties;
145  QString m_hexData;
146  };
147 
148  private:
151 
152  void setValue(Property prop, QVariant value);
153  static QList<ShapeDisplayProperties *> senderToData(QObject *sender);
154 
160  Property m_propertiesUsed;
161 
166  QMap<int, QVariant> *m_propertyValues;
167  };
168 }
169 
171 
172 #endif
173 
This class is designed to serialize QColor in a human-readable form.
Definition: Color.h:20
The main project for ipce.
Definition: Project.h:289
File name manipulation and expansion.
Definition: FileName.h:116
QVariant getValue(Property prop) const
Get a property&#39;s associated data.
Definition: ShapeDisplayProperties.cpp:92
bool supports(Property prop)
Support for this may come later.
Definition: ShapeDisplayProperties.cpp:81
virtual ~ShapeDisplayProperties()
The destructor.
Definition: ShapeDisplayProperties.cpp:56
QString displayName() const
Returns the display name.
Definition: DisplayProperties.cpp:80
This is the GUI communication mechanism for shape objects.
Definition: ShapeDisplayProperties.h:74
static QColor randomColor()
Creates and returns a random color for the initial color of the footprint polygon.
Definition: ShapeDisplayProperties.cpp:102
void setShowLabel(bool)
Change the visibility of the display name associated with this shape.
Definition: ShapeDisplayProperties.cpp:165
True if the control net should show its display name (bool)
Definition: ShapeDisplayProperties.h:88
void setSelected(bool)
Change the selected state associated with this shape.
Definition: ShapeDisplayProperties.cpp:156
Definition: DisplayProperties.h:26
XML Handler that parses XMLs in a stack-oriented way.
Definition: XmlStackedHandler.h:112
void setColor(QColor newColor)
Change the color associated with this shape.
Definition: ShapeDisplayProperties.cpp:147
void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
Saves this object to an XML file.
Definition: ShapeDisplayProperties.cpp:124
void addSupport(Property prop)
Call this with every property you support, otherwise they will not communicate properly between widge...
Definition: ShapeDisplayProperties.cpp:68
void propertyChanged(ShapeDisplayProperties *)
Null display property for bit-flag purposes.
Definition: ShapeDisplayProperties.h:82
Definition: BoxcarCachingAlgorithm.h:29
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
ShapeDisplayProperties(QString displayName, QObject *parent=NULL)
ShapeDisplayProperties constructor.
Definition: ShapeDisplayProperties.cpp:25
The selection state of this control net (bool)
Definition: ShapeDisplayProperties.h:86
Property
This is a list of properties and actions that are possible.
Definition: ShapeDisplayProperties.h:80
Manage a stack of content handlers for reading XML files.
Definition: XmlStackedHandlerReader.h:25
Q_DECLARE_METATYPE(QList< Isis::ShapeDisplayProperties *>)