Isis 3 Programmer 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:
109  void propertyChanged(ShapeDisplayProperties *);
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);
154 
161 
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.
bool supports(Property prop)
Support for this may come later.
Property m_propertiesUsed
This indicated whether any widgets with this DisplayProperties is using a particular property...
virtual ~ShapeDisplayProperties()
The destructor.
This class is used for processing an XML file containing information about a WorkOrder.
QString displayName() const
Returns the display name.
Q_DECLARE_METATYPE(Isis::Cube *)
This allows Cube *&#39;s to be stored in a QVariant.
This is the GUI communication mechanism for shape objects.
static QColor randomColor()
Creates and returns a random color for the initial color of the footprint polygon.
void setShowLabel(bool)
Change the visibility of the display name associated with this shape.
void toggleShowLabel()
Change the visibility of the display name.
True if the control net should show its display name (bool)
void setSelected(bool)
Change the selected state associated with this shape.
XML Handler that parses XMLs in a stack-oriented way.
virtual bool characters(const QString &ch)
This is called when the XML processor has parsed a chunk of character data.
void setColor(QColor newColor)
Change the color associated with this shape.
void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
Saves this object to an XML file.
void addSupport(Property prop)
Call this with every property you support, otherwise they will not communicate properly between widge...
void setValue(Property prop, QVariant value)
This is the generic mutator for properties.
virtual bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts)
This overrides the parent startElement function in XmlStackedHandler so the parser can handle an XML ...
Null display property for bit-flag purposes.
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
ShapeDisplayProperties(QString displayName, QObject *parent=NULL)
ShapeDisplayProperties constructor.
The selection state of this control net (bool)
Property
This is a list of properties and actions that are possible.
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 ...
Manage a stack of content handlers for reading XML files.
static QList< ShapeDisplayProperties * > senderToData(QObject *sender)
Get the display properties from a slot.
XmlHandler(ShapeDisplayProperties *displayProperties)
Constructor for the XmlHandler class.
virtual bool endElement(const QString &namespaceURI, const QString &localName, const QString &qName)
The XML reader invokes this method at the end of every element in the XML document.