Loading isis/src/qisis/objs/Directory/Directory.cpp +2 −7 Original line number Diff line number Diff line Loading @@ -1432,7 +1432,7 @@ namespace Isis { stream.writeStartElement("footprintViews"); foreach (Footprint2DView *footprint2DViewWidget, m_footprint2DViewWidgets) { footprint2DViewWidget->mosaicSceneWidget()->save(stream, project(), newProjectRoot); footprint2DViewWidget->save(stream, project(), newProjectRoot); } stream.writeEndElement(); Loading Loading @@ -1502,7 +1502,7 @@ namespace Isis { if (result) { if (localName == "footprint2DView") { m_directory->addFootprint2DView()->mosaicSceneWidget()->load(reader()); m_directory->addFootprint2DView()->load(reader()); } else if (localName == "imageFileList") { m_directory->addImageFileListView()->load(reader()); Loading Loading @@ -1804,11 +1804,6 @@ namespace Isis { "has been saved."; m_historyTreeWidget->addToHistory(saveCnetHistoryEntry); } // Make sure the ControlPointEditView "Save Net" button is no longer red if (controlPointEditView()) { controlPointEditView()->controlPointEditWidget()->colorizeSaveNetButton(true); } } Loading isis/src/qisis/objs/Directory/Directory.h +4 −1 Original line number Diff line number Diff line Loading @@ -233,6 +233,9 @@ namespace Isis { * stored in m_cnetEditorViewWidgets. * @history 2018-05-08 Tracie Sucharski - When saving active control, reset the "Save Net" * button to black in the ControlPointEditorWidget. * @history 2018-05-14 Tracie Sucharski - Serialize Footprint2DView rather than * MosaicSceneWidget. This will allow all parts of Footprint2DView to be * saved/restored including the ImageFileListWidget. Fixes #5422. */ class Directory : public QObject { Q_OBJECT Loading isis/src/qisis/objs/Footprint2DView/Footprint2DView.cpp +92 −0 Original line number Diff line number Diff line Loading @@ -41,17 +41,21 @@ #include <QVBoxLayout> #include <QWidget> #include <QWidgetAction> #include <QXmlStreamWriter> #include "ControlPoint.h" #include "Cube.h" #include "Directory.h" #include "Image.h" #include "ImageFileListWidget.h" #include "MosaicGraphicsView.h" #include "MosaicSceneWidget.h" #include "Project.h" #include "ProjectItem.h" #include "ProjectItemModel.h" #include "Shape.h" #include "ToolPad.h" #include "XmlStackedHandlerReader.h" namespace Isis { /** Loading Loading @@ -351,4 +355,92 @@ namespace Isis { QList<QAction *> Footprint2DView::toolPadActions() { return m_toolPad->actions(); } /** * @brief Loads the Footprint2DView from an XML file. * @param xmlReader The reader that takes in and parses the XML file. */ void Footprint2DView::load(XmlStackedHandlerReader *xmlReader) { xmlReader->pushContentHandler( new XmlHandler(this) ); } /** * @brief Save the footprint view widgets (ImageFileListWidget and MosaicSceneWidget to an XML * file. * @param stream The XML stream writer * @param newProjectRoot The FileName of the project this Directory is attached to. * * @internal * @history 2016-11-07 Ian Humphrey - Restored saving of footprints (footprint2view). * References #4486. */ void Footprint2DView::save(QXmlStreamWriter &stream, Project *project, FileName newProjectRoot) const { stream.writeStartElement("footprint2DView"); m_fileListWidget->save(stream, project, newProjectRoot); m_sceneWidget->save(stream, project, newProjectRoot); stream.writeEndElement(); } /** * @brief This function sets the Directory pointer for the Directory::XmlHandler class * @param directory The new directory we are setting XmlHandler's member variable to. */ Footprint2DView::XmlHandler::XmlHandler(Footprint2DView *footprintView) { m_footprintView = footprintView; } /** * @brief The Destructor for Directory::XmlHandler */ Footprint2DView::XmlHandler::~XmlHandler() { } /** * @brief The XML reader invokes this method at the start of every element in the * XML document. This method expects <footprint2DView/> and <imageFileList/> * elements. * A quick example using this function: * startElement("xsl","stylesheet","xsl:stylesheet",attributes) * * @param namespaceURI The Uniform Resource Identifier of the element's namespace * @param localName The local name string * @param qName The XML qualified string (or empty, if QNames are not available). * @param atts The XML attributes attached to each element * @return @b bool Returns True signalling to the reader the start of a valid XML element. If * False is returned, something bad happened. * */ bool Footprint2DView::XmlHandler::startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts) { bool result = XmlStackedHandler::startElement(namespaceURI, localName, qName, atts); if (result) { if (localName == "mosaicScene") { m_footprintView->mosaicSceneWidget()->load(reader()); } if (localName == "imageFileList") { m_footprintView->m_fileListWidget->load(reader()); } } return result; } bool Footprint2DView::XmlHandler::endElement(const QString &namespaceURI, const QString &localName, const QString &qName) { bool result = XmlStackedHandler::endElement(namespaceURI, localName, qName); return result; } } isis/src/qisis/objs/Footprint2DView/Footprint2DView.h +33 −0 Original line number Diff line number Diff line Loading @@ -27,12 +27,15 @@ #include <QSize> #include "AbstractProjectItemView.h" #include "FileName.h" #include "XmlStackedHandler.h" class QAction; class QEvent; class QMainWindow; class QToolBar; class QWidgetAction; class QXmlStreamWriter; namespace Isis { Loading @@ -41,7 +44,9 @@ namespace Isis { class Image; class ImageFileListWidget; class MosaicSceneWidget; class Project; class ToolPad; class XmlStackedHandlerReader; /** * View for displaying footprints of images in a QMos like way. Loading @@ -64,6 +69,9 @@ namespace Isis { * footprint. Fixes #5050. * @history 2017-08-02 Tracie Sucharski - Fixed connections between views for control point * editing. Fixes #5007, #5008. * @history 2018-05-14 Tracie Sucharski - Serialize Footprint2DView rather than * MosaicSceneWidget. This will allow all parts of Footprint2DView to be * saved/restored including the ImageFileListWidget. Fixes #5422. */ class Footprint2DView : public AbstractProjectItemView { Loading @@ -80,6 +88,9 @@ namespace Isis { QSize sizeHint() const; void load(XmlStackedHandlerReader *xmlReader); void save(QXmlStreamWriter &stream, Project *project, FileName newProjectRoot) const; signals: void modifyControlPoint(ControlPoint *controlPoint); void deleteControlPoint(ControlPoint *controlPoint); Loading @@ -97,6 +108,28 @@ namespace Isis { void onQueueSelectionChanged(); void onMosItemRemoved(Image *image); private: /** * @author 2018-05-11 Tracie Sucharski * * @internal */ class XmlHandler : public XmlStackedHandler { public: XmlHandler(Footprint2DView *footprintView); ~XmlHandler(); virtual bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts); virtual bool endElement(const QString &namespaceURI, const QString &localName, const QString &qName); private: Q_DISABLE_COPY(XmlHandler); Footprint2DView *m_footprintView; //!< The Footprint2DView }; private: MosaicSceneWidget *m_sceneWidget; //!< The scene widget ImageFileListWidget *m_fileListWidget; //!< The file list widget Loading isis/src/qisis/objs/ImageFileListWidget/ImageFileListWidget.cpp +15 −14 Original line number Diff line number Diff line Loading @@ -217,15 +217,6 @@ namespace Isis { return output; } /** * This method pushes a new XmlHandler into the parser stack. * * @param xmlReader This is the parser stack. */ void ImageFileListWidget::load(XmlStackedHandlerReader *xmlReader) { xmlReader->pushContentHandler(new XmlHandler(this)); } /** * This method calls ImageTreeWidget::actions() which sets up a QAction * that sets a default for the file list columns and returns a QList of Loading Loading @@ -611,6 +602,17 @@ namespace Isis { return result; } /** * This method pushes a new XmlHandler into the parser stack. * * @param xmlReader This is the parser stack. */ void ImageFileListWidget::load(XmlStackedHandlerReader *xmlReader) { xmlReader->pushContentHandler(new XmlHandler(this)); } /** * This method saves the FootprintColumns in the project and the settings associated * with every column. Loading @@ -621,10 +623,11 @@ namespace Isis { */ void ImageFileListWidget::save(QXmlStreamWriter &stream, Project *project, FileName newProjectRoot) const { stream.writeStartElement("imageFileList"); // Write QSettings stream.writeStartElement("widgetGeometry"); // stream.writeStartElement("widgetGeometry"); // QString geom = saveGeometry(); // //qDebug()<<"ImageFileListWidget::save geometry = "<<geom; // stream.writeAttribute("value", saveGeometry()); Loading Loading @@ -672,6 +675,7 @@ namespace Isis { stream.writeEndElement(); } /** * This method saves the QTreeWidgetItem and the settings associated with the QTreeWidgetItem * to the stream. Loading Loading @@ -758,7 +762,7 @@ namespace Isis { bool ImageFileListWidget::XmlHandler::startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts) { bool result = XmlStackedHandler::startElement(namespaceURI, localName, qName, atts); /* //tjw if (result) { // if (localName == "geometry") { Loading Loading @@ -826,7 +830,6 @@ namespace Isis { } } */ return result; } Loading Loading @@ -905,6 +908,4 @@ namespace Isis { } } } } Loading
isis/src/qisis/objs/Directory/Directory.cpp +2 −7 Original line number Diff line number Diff line Loading @@ -1432,7 +1432,7 @@ namespace Isis { stream.writeStartElement("footprintViews"); foreach (Footprint2DView *footprint2DViewWidget, m_footprint2DViewWidgets) { footprint2DViewWidget->mosaicSceneWidget()->save(stream, project(), newProjectRoot); footprint2DViewWidget->save(stream, project(), newProjectRoot); } stream.writeEndElement(); Loading Loading @@ -1502,7 +1502,7 @@ namespace Isis { if (result) { if (localName == "footprint2DView") { m_directory->addFootprint2DView()->mosaicSceneWidget()->load(reader()); m_directory->addFootprint2DView()->load(reader()); } else if (localName == "imageFileList") { m_directory->addImageFileListView()->load(reader()); Loading Loading @@ -1804,11 +1804,6 @@ namespace Isis { "has been saved."; m_historyTreeWidget->addToHistory(saveCnetHistoryEntry); } // Make sure the ControlPointEditView "Save Net" button is no longer red if (controlPointEditView()) { controlPointEditView()->controlPointEditWidget()->colorizeSaveNetButton(true); } } Loading
isis/src/qisis/objs/Directory/Directory.h +4 −1 Original line number Diff line number Diff line Loading @@ -233,6 +233,9 @@ namespace Isis { * stored in m_cnetEditorViewWidgets. * @history 2018-05-08 Tracie Sucharski - When saving active control, reset the "Save Net" * button to black in the ControlPointEditorWidget. * @history 2018-05-14 Tracie Sucharski - Serialize Footprint2DView rather than * MosaicSceneWidget. This will allow all parts of Footprint2DView to be * saved/restored including the ImageFileListWidget. Fixes #5422. */ class Directory : public QObject { Q_OBJECT Loading
isis/src/qisis/objs/Footprint2DView/Footprint2DView.cpp +92 −0 Original line number Diff line number Diff line Loading @@ -41,17 +41,21 @@ #include <QVBoxLayout> #include <QWidget> #include <QWidgetAction> #include <QXmlStreamWriter> #include "ControlPoint.h" #include "Cube.h" #include "Directory.h" #include "Image.h" #include "ImageFileListWidget.h" #include "MosaicGraphicsView.h" #include "MosaicSceneWidget.h" #include "Project.h" #include "ProjectItem.h" #include "ProjectItemModel.h" #include "Shape.h" #include "ToolPad.h" #include "XmlStackedHandlerReader.h" namespace Isis { /** Loading Loading @@ -351,4 +355,92 @@ namespace Isis { QList<QAction *> Footprint2DView::toolPadActions() { return m_toolPad->actions(); } /** * @brief Loads the Footprint2DView from an XML file. * @param xmlReader The reader that takes in and parses the XML file. */ void Footprint2DView::load(XmlStackedHandlerReader *xmlReader) { xmlReader->pushContentHandler( new XmlHandler(this) ); } /** * @brief Save the footprint view widgets (ImageFileListWidget and MosaicSceneWidget to an XML * file. * @param stream The XML stream writer * @param newProjectRoot The FileName of the project this Directory is attached to. * * @internal * @history 2016-11-07 Ian Humphrey - Restored saving of footprints (footprint2view). * References #4486. */ void Footprint2DView::save(QXmlStreamWriter &stream, Project *project, FileName newProjectRoot) const { stream.writeStartElement("footprint2DView"); m_fileListWidget->save(stream, project, newProjectRoot); m_sceneWidget->save(stream, project, newProjectRoot); stream.writeEndElement(); } /** * @brief This function sets the Directory pointer for the Directory::XmlHandler class * @param directory The new directory we are setting XmlHandler's member variable to. */ Footprint2DView::XmlHandler::XmlHandler(Footprint2DView *footprintView) { m_footprintView = footprintView; } /** * @brief The Destructor for Directory::XmlHandler */ Footprint2DView::XmlHandler::~XmlHandler() { } /** * @brief The XML reader invokes this method at the start of every element in the * XML document. This method expects <footprint2DView/> and <imageFileList/> * elements. * A quick example using this function: * startElement("xsl","stylesheet","xsl:stylesheet",attributes) * * @param namespaceURI The Uniform Resource Identifier of the element's namespace * @param localName The local name string * @param qName The XML qualified string (or empty, if QNames are not available). * @param atts The XML attributes attached to each element * @return @b bool Returns True signalling to the reader the start of a valid XML element. If * False is returned, something bad happened. * */ bool Footprint2DView::XmlHandler::startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts) { bool result = XmlStackedHandler::startElement(namespaceURI, localName, qName, atts); if (result) { if (localName == "mosaicScene") { m_footprintView->mosaicSceneWidget()->load(reader()); } if (localName == "imageFileList") { m_footprintView->m_fileListWidget->load(reader()); } } return result; } bool Footprint2DView::XmlHandler::endElement(const QString &namespaceURI, const QString &localName, const QString &qName) { bool result = XmlStackedHandler::endElement(namespaceURI, localName, qName); return result; } }
isis/src/qisis/objs/Footprint2DView/Footprint2DView.h +33 −0 Original line number Diff line number Diff line Loading @@ -27,12 +27,15 @@ #include <QSize> #include "AbstractProjectItemView.h" #include "FileName.h" #include "XmlStackedHandler.h" class QAction; class QEvent; class QMainWindow; class QToolBar; class QWidgetAction; class QXmlStreamWriter; namespace Isis { Loading @@ -41,7 +44,9 @@ namespace Isis { class Image; class ImageFileListWidget; class MosaicSceneWidget; class Project; class ToolPad; class XmlStackedHandlerReader; /** * View for displaying footprints of images in a QMos like way. Loading @@ -64,6 +69,9 @@ namespace Isis { * footprint. Fixes #5050. * @history 2017-08-02 Tracie Sucharski - Fixed connections between views for control point * editing. Fixes #5007, #5008. * @history 2018-05-14 Tracie Sucharski - Serialize Footprint2DView rather than * MosaicSceneWidget. This will allow all parts of Footprint2DView to be * saved/restored including the ImageFileListWidget. Fixes #5422. */ class Footprint2DView : public AbstractProjectItemView { Loading @@ -80,6 +88,9 @@ namespace Isis { QSize sizeHint() const; void load(XmlStackedHandlerReader *xmlReader); void save(QXmlStreamWriter &stream, Project *project, FileName newProjectRoot) const; signals: void modifyControlPoint(ControlPoint *controlPoint); void deleteControlPoint(ControlPoint *controlPoint); Loading @@ -97,6 +108,28 @@ namespace Isis { void onQueueSelectionChanged(); void onMosItemRemoved(Image *image); private: /** * @author 2018-05-11 Tracie Sucharski * * @internal */ class XmlHandler : public XmlStackedHandler { public: XmlHandler(Footprint2DView *footprintView); ~XmlHandler(); virtual bool startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts); virtual bool endElement(const QString &namespaceURI, const QString &localName, const QString &qName); private: Q_DISABLE_COPY(XmlHandler); Footprint2DView *m_footprintView; //!< The Footprint2DView }; private: MosaicSceneWidget *m_sceneWidget; //!< The scene widget ImageFileListWidget *m_fileListWidget; //!< The file list widget Loading
isis/src/qisis/objs/ImageFileListWidget/ImageFileListWidget.cpp +15 −14 Original line number Diff line number Diff line Loading @@ -217,15 +217,6 @@ namespace Isis { return output; } /** * This method pushes a new XmlHandler into the parser stack. * * @param xmlReader This is the parser stack. */ void ImageFileListWidget::load(XmlStackedHandlerReader *xmlReader) { xmlReader->pushContentHandler(new XmlHandler(this)); } /** * This method calls ImageTreeWidget::actions() which sets up a QAction * that sets a default for the file list columns and returns a QList of Loading Loading @@ -611,6 +602,17 @@ namespace Isis { return result; } /** * This method pushes a new XmlHandler into the parser stack. * * @param xmlReader This is the parser stack. */ void ImageFileListWidget::load(XmlStackedHandlerReader *xmlReader) { xmlReader->pushContentHandler(new XmlHandler(this)); } /** * This method saves the FootprintColumns in the project and the settings associated * with every column. Loading @@ -621,10 +623,11 @@ namespace Isis { */ void ImageFileListWidget::save(QXmlStreamWriter &stream, Project *project, FileName newProjectRoot) const { stream.writeStartElement("imageFileList"); // Write QSettings stream.writeStartElement("widgetGeometry"); // stream.writeStartElement("widgetGeometry"); // QString geom = saveGeometry(); // //qDebug()<<"ImageFileListWidget::save geometry = "<<geom; // stream.writeAttribute("value", saveGeometry()); Loading Loading @@ -672,6 +675,7 @@ namespace Isis { stream.writeEndElement(); } /** * This method saves the QTreeWidgetItem and the settings associated with the QTreeWidgetItem * to the stream. Loading Loading @@ -758,7 +762,7 @@ namespace Isis { bool ImageFileListWidget::XmlHandler::startElement(const QString &namespaceURI, const QString &localName, const QString &qName, const QXmlAttributes &atts) { bool result = XmlStackedHandler::startElement(namespaceURI, localName, qName, atts); /* //tjw if (result) { // if (localName == "geometry") { Loading Loading @@ -826,7 +830,6 @@ namespace Isis { } } */ return result; } Loading Loading @@ -905,6 +908,4 @@ namespace Isis { } } } }