Isis 3 Programmer Reference
ShapeDisplayProperties.h
1#ifndef ShapeDisplayProperties_H
2#define ShapeDisplayProperties_H
3
10/* SPDX-License-Identifier: CC0-1.0 */
11
12#include <QColor> // This is required since QColor is in a slot
13#include <QMetaType> // required since we're adding to QVariant
14#include <QObject>
15
16#include "DisplayProperties.h"
17#include "XmlStackedHandler.h"
18
19class QAction;
20class QXmlStreamWriter;
21
22namespace Isis {
23 class FileName;
24 class Project;
25 class Pvl;
26 class PvlObject;
27 class XmlStackedHandlerReader;
28
61 Q_OBJECT
62 public:
66 enum Property {
68 None = 0,
70 Color = 1,
75 };
76
77
78 ShapeDisplayProperties(QString displayName, QObject *parent = NULL);
79 ShapeDisplayProperties(XmlStackedHandlerReader *xmlReader, QObject *parent = NULL);
81
82// void fromPvl(const PvlObject &pvl);
83// PvlObject toPvl() const;
84
85 void addSupport(Property prop);
86 bool supports(Property prop);
87
88 QVariant getValue(Property prop) const;
89
90 static QColor randomColor();
91
92 void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const;
93
94 signals:
95 void propertyChanged(ShapeDisplayProperties *);
96 void supportAdded(Property);
97
98 public slots:
99 void setColor(QColor newColor);
100 void setShowLabel(bool);
101 void setSelected(bool);
102
103 private slots:
104 void toggleShowLabel();
105
106 private:
116 public:
117 XmlHandler(ShapeDisplayProperties *displayProperties);
118
119 virtual bool startElement(const QString &namespaceURI, const QString &localName,
120 const QString &qName, const QXmlAttributes &atts);
121
122 virtual bool characters(const QString &ch);
123
124 virtual bool endElement(const QString &namespaceURI, const QString &localName,
125 const QString &qName);
126
127 private:
128 Q_DISABLE_COPY(XmlHandler);
129
130 ShapeDisplayProperties *m_displayProperties;
131 QString m_hexData;
132 };
133
134 private:
137
138 void setValue(Property prop, QVariant value);
139 static QList<ShapeDisplayProperties *> senderToData(QObject *sender);
140
147
152 QMap<int, QVariant> *m_propertyValues;
153 };
154}
155
156Q_DECLARE_METATYPE(QList<Isis::ShapeDisplayProperties *>);
157
158#endif
This class is designed to serialize QColor in a human-readable form.
Definition Color.h:26
QString displayName() const
Returns the display name.
File name manipulation and expansion.
Definition FileName.h:100
The main project for ipce.
Definition Project.h:289
This class is used for processing an XML file containing information about a WorkOrder.
XmlHandler(ShapeDisplayProperties *displayProperties)
Constructor for the XmlHandler class.
virtual bool characters(const QString &ch)
This is called when the XML processor has parsed a chunk of character data.
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.
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 ...
This is the GUI communication mechanism for shape objects.
bool supports(Property prop)
Support for this may come later.
static QColor randomColor()
Creates and returns a random color for the initial color of the footprint polygon.
virtual ~ShapeDisplayProperties()
The destructor.
void setValue(Property prop, QVariant value)
This is the generic mutator for properties.
Property
This is a list of properties and actions that are possible.
@ None
Null display property for bit-flag purposes.
@ Selected
The selection state of this control net (bool)
@ ShowLabel
True if the control net should show its display name (bool)
void setColor(QColor newColor)
Change the color associated with this shape.
Property m_propertiesUsed
This indicated whether any widgets with this DisplayProperties is using a particular property.
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 Q...
QVariant getValue(Property prop) const
Get a property's associated data.
void setShowLabel(bool)
Change the visibility of the display name 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...
static QList< ShapeDisplayProperties * > senderToData(QObject *sender)
Get the display properties from a slot.
void setSelected(bool)
Change the selected state associated with this shape.
void toggleShowLabel()
Change the visibility of the display name.
ShapeDisplayProperties(QString displayName, QObject *parent=NULL)
ShapeDisplayProperties constructor.
XML Handler that parses XMLs in a stack-oriented way.
Manage a stack of content handlers for reading XML files.
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16