Isis 3 Programmer Reference
Control.h
1 #ifndef Control_H
2 #define Control_H
3 
10 /* SPDX-License-Identifier: CC0-1.0 */
11 
12 #include <QObject> // parent
13 #include <QString>
14 
15 #include "FileName.h"
16 #include "XmlStackedHandler.h"
17 
18 class QMutex;
19 class QUuid;
20 class QXmlStreamWriter;
21 
22 namespace Isis {
23  class ControlDisplayProperties;
24  class ControlNet;
25  class FileName;
26  class Project;
27  class PvlObject;
28 
66  class Control : public QObject {
67  Q_OBJECT
68  public:
71  explicit Control(QString cnetFileName, QObject *parent = 0);
72  explicit Control(Project *project, QString cnetFileName, QObject *parent = 0);
73  explicit Control(ControlNet *controlNet, QString cnetFileName, QObject *parent = 0);
74  Control(FileName cnetFolder, XmlStackedHandlerReader *xmlReader, QObject *parent = 0);
75  ~Control();
76 
78  void openControlNet();
81  QString fileName() const;
82 
83  QString id() const;
84 
85  bool isModified();
86  void setModified(bool modified = true);
87  bool write();
88 
89  void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const;
90  void copyToNewProjectRoot(const Project *project, FileName newProjectRoot);
91  void deleteFromDisk();
92 
93  public slots:
94  void updateFileName(Project *);
95  void closeControlNet();
96 
97  private:
106  class XmlHandler : public XmlStackedHandler {
107  public:
108  XmlHandler(Control *control, FileName cnetFolder);
109 
110  virtual bool startElement(const QString &namespaceURI, const QString &localName,
111  const QString &qName, const QXmlAttributes &atts);
112 
113  private:
114  Q_DISABLE_COPY(XmlHandler);
115 
119  };
120 
121  private:
122  Control(const Control &other);
123  Control &operator=(const Control &rhs);
124 
125  bool m_modified;
126 
129  Project *m_project;
130  QString m_fileName;
136  QUuid *m_id;
137  };
138 }
139 
141 
142 #endif // Control_H
Isis::Control::Control
Control(QString cnetFileName, QObject *parent=0)
Create a Control from control net located on disk.
Definition: Control.cpp:35
Isis::Control::m_displayProperties
ControlDisplayProperties * m_displayProperties
Contains the display properties for this Control object.
Definition: Control.h:127
Isis::Control::XmlHandler::XmlHandler
XmlHandler(Control *control, FileName cnetFolder)
Constructor for the Control object's XmlHandler.
Definition: Control.cpp:393
Isis::Control::deleteFromDisk
void deleteFromDisk()
Delete the control net from disk.
Definition: Control.cpp:334
Isis::FileName
File name manipulation and expansion.
Definition: FileName.h:100
Isis::Control::XmlHandler::m_xmlHandlerCnetFolderName
FileName m_xmlHandlerCnetFolderName
The name of the folder for the control xml.
Definition: Control.h:118
Isis::Control::XmlHandler
Nested class used to write the Control object information to an XML file for the purpose of saving an...
Definition: Control.h:106
Isis::ControlDisplayProperties
This is the GUI communication mechanism for cubes.
Definition: ControlDisplayProperties.h:59
Isis::Control
This represents an ISIS control net in a project-based GUI interface.
Definition: Control.h:66
Isis::Control::m_id
QUuid * m_id
A unique ID for this Control.
Definition: Control.h:136
Isis::Control::copyToNewProjectRoot
void copyToNewProjectRoot(const Project *project, FileName newProjectRoot)
Copies the files of the given Project to the given location.
Definition: Control.cpp:294
Isis::XmlStackedHandlerReader
Manage a stack of content handlers for reading XML files.
Definition: XmlStackedHandlerReader.h:30
Isis::Control::save
void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
Method to write this Control object's member data to an XML stream.
Definition: Control.cpp:373
Isis::Control::isModified
bool isModified()
@description Has this control been modified?
Definition: Control.cpp:229
Isis::Control::~Control
~Control()
Destroys Control object.
Definition: Control.cpp:126
Isis::Project
The main project for ipce.
Definition: Project.h:289
Isis::Control::closeControlNet
void closeControlNet()
Cleans up the ControlNet pointer.
Definition: Control.cpp:214
Isis::Control::write
bool write()
@description Write control net to disk.
Definition: Control.cpp:191
Isis::Control::controlNet
ControlNet * controlNet()
Open and return a pointer to the ControlNet for this Control.
Definition: Control.cpp:150
Isis::Control::openControlNet
void openControlNet()
Sets the ControlNet from the control net file name provided in the constructor.
Definition: Control.cpp:165
Isis::Control::setModified
void setModified(bool modified=true)
@description Sets the modification state of this control.
Definition: Control.cpp:241
Isis::ControlNet
a control network
Definition: ControlNet.h:257
Isis::Control::XmlHandler::m_xmlHandlerControl
Control * m_xmlHandlerControl
A pointer to the Control object to be read or written.
Definition: Control.h:116
Isis::Control::updateFileName
void updateFileName(Project *)
Change the on-disk file name for this control to be where the control ought to be in the given projec...
Definition: Control.cpp:355
Isis::Control::m_controlNet
ControlNet * m_controlNet
A pointer to the ControlNet object associated with this Control object.
Definition: Control.h:69
Isis::Control::XmlHandler::startElement
virtual bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts)
Method to read the given XML formatted attribute for a Control object into the XmlHandler.
Definition: Control.cpp:411
Isis::XmlStackedHandler
XML Handler that parses XMLs in a stack-oriented way.
Definition: XmlStackedHandler.h:118
Isis::Control::m_fileName
QString m_fileName
Project associated with this control.
Definition: Control.h:130
Isis::Control::displayProperties
ControlDisplayProperties * displayProperties()
Access a pointer to the display properties for the control network.
Definition: Control.cpp:252
QObject
Isis::Control::id
QString id() const
Access the unique ID associated with this Control.
Definition: Control.cpp:282
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(Isis::PlotWindow *)
We have plot windows as QVariant data types, so here it's enabled.
Isis::Control::fileName
QString fileName() const
Access the name of the control network file associated with this Control.
Definition: Control.cpp:272