Isis Developer Reference
Control.h
Go to the documentation of this file.
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 
116  Control *m_xmlHandlerControl;
118  FileName m_xmlHandlerCnetFolderName;
119  };
120 
121  private:
122  Control(const Control &other);
123  Control &operator=(const Control &rhs);
124 
125  bool m_modified;
126 
127  ControlDisplayProperties *m_displayProperties;
129  Project *m_project;
130  QString m_fileName;
136  QUuid *m_id;
137  };
138 }
139 
141 
142 #endif // Control_H
FileName.h
Isis::IException::Io
@ Io
A type of error that occurred when performing an actual I/O operation.
Definition: IException.h:155
Isis::Control::Control
Control(QString cnetFileName, QObject *parent=0)
Create a Control from control net located on disk.
Definition: Control.cpp:35
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(Isis::Control *)
Isis::ControlNet::SetMutex
void SetMutex(QMutex *mutex)
Set mutex to lock for making Naif calls.
Definition: ControlNet.cpp:1666
Project.h
Isis::Project::mutex
QMutex * mutex()
Return mutex used for Naif calls.
Definition: Project.cpp:1658
Isis::Control::deleteFromDisk
void deleteFromDisk()
Delete the control net from disk.
Definition: Control.cpp:334
Isis::FileName::name
QString name() const
Returns the name of the file excluding the path and the attributes in the file name.
Definition: FileName.cpp:162
Isis::FileName
File name manipulation and expansion.
Definition: FileName.h:100
Isis::XmlStackedHandlerReader::pushContentHandler
virtual void pushContentHandler(XmlStackedHandler *newHandler)
Push a contentHandler and maybe continue parsing...
Definition: XmlStackedHandlerReader.cpp:55
Isis::ControlNet::Write
void Write(const QString &filename, bool pvl=false)
Writes out the control network.
Definition: ControlNet.cpp:311
Isis::XmlStackedHandler::startElement
virtual bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts)
Definition: XmlStackedHandler.cpp:44
Isis::Project::cnetRoot
static QString cnetRoot(QString projectRoot)
Appends the root directory name 'cnets' to the project.
Definition: Project.cpp:2019
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::copyToNewProjectRoot
void copyToNewProjectRoot(const Project *project, FileName newProjectRoot)
Copies the files of the given Project to the given location.
Definition: Control.cpp:294
Isis::toString
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:211
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
IString.h
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::FileName::expanded
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
Definition: FileName.cpp:196
ControlNet.h
Isis::Control::controlNet
ControlNet * controlNet()
Open and return a pointer to the ControlNet for this Control.
Definition: Control.cpp:150
_FILEINFO_
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:24
Isis::FileName::dir
QDir dir() const
Returns the path of the file's parent directory as a QDir object.
Definition: FileName.cpp:465
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
ControlDisplayProperties.h
Isis::IException
Isis exception class.
Definition: IException.h:91
Isis::FileName::toString
QString toString() const
Returns a QString of the full file name including the file path, excluding the attributes with any Is...
Definition: FileName.cpp:515
Isis::Project::projectRoot
QString projectRoot() const
Get the top-level folder of the project.
Definition: Project.cpp:1666
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
IException.h
Isis::IException::Programmer
@ Programmer
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:146
Isis::XmlStackedHandler
XML Handler that parses XMLs in a stack-oriented way.
Definition: XmlStackedHandler.h:118
PvlObject.h
Control.h
Isis::Control::displayProperties
ControlDisplayProperties * displayProperties()
Access a pointer to the display properties for the control network.
Definition: Control.cpp:252
Isis::ControlDisplayProperties::save
void save(QXmlStreamWriter &stream, const Project *project, FileName newProjectRoot) const
Definition: ControlDisplayProperties.cpp:121
QObject
XmlStackedHandlerReader.h
XmlStackedHandler.h
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
Isis::Control::fileName
QString fileName() const
Access the name of the control network file associated with this Control.
Definition: Control.cpp:272