// $Id: GeoRefCoordEditorDlg.hpp,v 1.8 2010/01/25 23:34:23 philw Exp $ // Dialog for editing Simulation Object Georeference Coordinate Data // // class GeoRefCoordEditorPanel : public QFrame // class GeoRefCoordEditorPanel::TreeWidget : public QTreeWidget // class GeoRefCoordEditorPanel::TreeItem : public QTreeWidgetItem // class GeoRefCoordEditorDlg : public QMainWindow #ifndef GeoRefCoordEditorDlgINCLUDED #define GeoRefCoordEditorDlgINCLUDED #include #include #include #include #include #ifndef CanvasDefsINCLUDED #include "CanvasDefs.hpp" #endif #ifndef CallbackINCLUDED #include "Callback.hpp" #endif class Ui_GeoRefCoordEditorWidgets; class GeoRefCoordEditorDlg; class SimObj; class Workspace; class RwGraphicsScene; class QAction; class QShowEvent; class QHideEvent; class QMenu; // ************************************** // *** class GeoRefCoordEditorPanel *** // ************************************** class GeoRefCoordEditorPanel : public QFrame { Q_OBJECT private: class TreeWidget; // : public QTreeWidget -- declared below class TreeItem; // : public QTreeWidgetItem -- declared below friend class GeoRefCoordEditorDlg; // ********************************************** // *** class GeoRefCoordEditorPanel Members *** // ********************************************** private: Workspace* _parentWorkspace; RwGraphicsScene* _rwGfxScene; CanvasDefs::CanvasID _canvasID; bool _showCoordSysParts; Ui_GeoRefCoordEditorWidgets& _ui; // from GeoRefCoordEditorWidgets.ui TreeWidget* _coordDataTreeWidget; public: GeoRefCoordEditorPanel (QWidget* parent, Workspace* workspace); virtual ~GeoRefCoordEditorPanel(); void setRwGraphicsScene (RwGraphicsScene*, CanvasDefs::CanvasID); void setShowCoordSysParts (bool); // design option private: void createDataTreeWidget(); void initWidgets(); void initConnections(); void sensitizeWidgets(); void createObjItem (QList&, SimObj*); bool coordColumnIsEditable (int col) const; public: void loadMockupData(); private slots: void enaEditingCheckBox_toggled (bool checked); void objFilterDataObjCheckBox_toggled (bool checked); void closePushButton_clicked (bool checked=false); void simObjTreeItem_pressed (QTreeWidgetItem*, int column); void simObjTreeItem_clicked (QTreeWidgetItem*, int column); void simObjTreeItem_doubleClicked (QTreeWidgetItem*, int column); void simObjTreeItem_changed (QTreeWidgetItem*, int column); void emitEditHelpStatusMsg(); signals: void setStatusMsgRequested (const QString&, int timeoutMsecs); void closeRequested(); }; //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // ************************************************** // *** class GeoRefCoordEditorPanel::TreeWidget *** // ************************************************** class GeoRefCoordEditorPanel::TreeWidget : public QTreeWidget { Q_OBJECT public: TreeWidget (QWidget* parent); virtual ~TreeWidget(); void updateIconSize(); }; //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // ************************************************ // *** class GeoRefCoordEditorPanel::TreeItem *** // ************************************************ class GeoRefCoordEditorPanel::TreeItem : public QTreeWidgetItem { private: TreeWidget* _twid; SimObj* _obj; int _numEasting; int _numNorthing; int _adjEasting; int _adjNorthing; int _iconOffsetX; int _iconOffsetY; Callback* _simObjCallback; public: TreeItem (TreeWidget* twid, SimObj* obj); virtual ~TreeItem(); // virtual from QTreeWidgetItem bool operator< (const QTreeWidgetItem&) const; private: void addCallbacks(); void deleteCallbacks(); int simObjCallbackHandler (CallbackType, CallbackData*, void* clientDat); }; //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // ************************************ // *** class GeoRefCoordEditorDlg *** // ************************************ class GeoRefCoordEditorDlg : public QMainWindow { Q_OBJECT private: static GeoRefCoordEditorDlg* _instance; Workspace* _parentWorkspace; RwGraphicsScene* _rwGfxScene; CanvasDefs::CanvasID _canvasID; GeoRefCoordEditorPanel* _panel; QMenu* _fileMenu; QMenu* _configMenu; QAction* _exportCoordsAction; QAction* _importCoordsAction; QAction* _showWorkspaceAction; QAction* _closeDlgAction; QAction* _showCoordCalibAction; QAction* _clearCalloutOffsetsAction; QAction* _showCoordSysPartsAction; public: static void openDlg (Workspace* parentWorkspace, RwGraphicsScene*, CanvasDefs::CanvasID); static void closeDlg(); void setRwGraphicsScene (RwGraphicsScene*, CanvasDefs::CanvasID); private: GeoRefCoordEditorDlg (Workspace* parentWorkspace); virtual ~GeoRefCoordEditorDlg(); void createMenus(); void initConnections(); void sensitizeWidgets(); GeoRefCoordEditorPanel* panel() const { return (_panel); } void setStatusMsg (const QString&); protected: // Virtual from QWidget virtual void showEvent (QShowEvent*); virtual void hideEvent (QHideEvent*); private slots: void setStatusMsgRequested (const QString&, int timeoutMsecs=0); void closeRequested(); void exportCoords_triggered(); void importCoords_triggered(); void showWorkspace_triggered(); void closeDlg_triggered(); void showCoordCalib_triggered(); void clearCalloutOffsets_triggered(); void showCoordSysParts_toggled (bool); }; #endif // GeoRefCoordEditorDlgINCLUDED //--- (end GeoRefCoordEditorDlg.hpp) ---