AnnotationObjectManager.qt.H

00001 #ifndef ANNOTATIONOBJECTMANAGER_H
00002 #define ANNOTATIONOBJECTMANAGER_H
00003 
00004 #include <QtCore/qabstractitemmodel.h>
00005 
00006 #include "NeovisionII/NeoAnnotate/AnnotationObject.qt.H"
00007 
00008 class AnnotationObjectManager : public QAbstractTableModel
00009 {
00010   Q_OBJECT
00011 
00012   public:
00013     //! Construct a new Annotation Object Manager inside of parent
00014     AnnotationObjectManager(QObject * parent = 0);
00015 
00016     //! Get the number Annotation Objects being managed by this manager
00017     int rowCount(const QModelIndex &parent = QModelIndex()) const;
00018 
00019     //! Get the number of data items to report for each Annotation Object
00020     int columnCount(const QModelIndex &parent = QModelIndex()) const;
00021 
00022     //! Get a data item from the object list
00023     QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
00024 
00025     //! Get the header names
00026     QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
00027 
00028     //! Set a particular data member of one of our Annotation Objects
00029     bool setData(const QModelIndex &index, const QVariant &value, int role);
00030 
00031     //! Return the flags of a particular row/column cell
00032     Qt::ItemFlags flags(const QModelIndex &index) const;
00033 
00034     //! Add an object to our object list
00035     bool addObject(AnnotationObject * object);
00036 
00037     //! Get an object reference by it's ID, or NULL if no object exists with that ID
00038     AnnotationObject* getObjectById(int id);
00039 
00040     //! Sets itsAnimationView
00041     void setAnimationView(QTableView *animationView);
00042 
00043     //! Pass a request to construct a menu off to the current selected object
00044     void constructAnimationContextMenu(QPoint globalPos, int row, int column);
00045 
00046     //! Clear the entire storage, deleting all existing Annotation Objects
00047     void clear();
00048 
00049     void setAnimationRowSelected(int rowIdx);
00050 
00051     void setLastAnimViewClick(const QModelIndex & pos);
00052 
00053     std::map<int, std::map<int, AnnotationObjectFrame> > renderAnimations();
00054 
00055     QList<AnnotationObject *> getAnnotationObjects() { return itsObjects; }
00056 
00057   signals:
00058     //! Emit a signal to let the view know that a particular object has been selected
00059     /*! The integer parameter indicates the item's row. */
00060     void selectingObject(int);
00061 
00062   public slots:
00063     //! select() is called when an item is selected in the table
00064     /*! In this method we ensure that our graphicsview and tableview are in sync
00065         and that only one item is selected at a time */
00066     void select(const QModelIndex & index);
00067 
00068     //! Inform the manager that an item is being selected in the graphicsview
00069     /*! This highlights and selects the object*/
00070     void objectSelected(int itemId);
00071 
00072     //! Add a vertex to the selected object
00073     void addVertex(QPointF);
00074 
00075     //! Remove a vertex from the selected object
00076     void removeVertex(QPointF);
00077 
00078     //! Remove an object
00079     void removeObject();
00080 
00081     //! The frame number has changed
00082     void frameChanged(int fnum);
00083 
00084     //! Select a row in the animation view
00085     void selectAnimationRow(int rowIdx);
00086 
00087     //! Set the opacity of all objects
00088     void setOpacity(int opacity);
00089 
00090   private:
00091     //! Select the given object, and deselect the last selected object
00092     void selectObject(int rowIdx);
00093 
00094     //! Deselect the given object
00095     void deselectObject(int rowIdx);
00096 
00097     int itsCurrentFrame;                  //!< The current frame number
00098 
00099     QList<AnnotationObject *> itsObjects; //!< Storage for this manager's Annotation Objects
00100 
00101     int itsCurrentSelectedRow;            //!< The currently selected row,
00102                                           //!< or -1 if no row is selected
00103 
00104     int itsOpacity;                       //!< The current user selected opacity
00105 
00106     QTableView * itsAnimationView;        //!< A pointer to the QTableView which displays
00107                                           //!< the current animation in the MainWindow
00108 };
00109 
00110 #endif //ANNOTATIONOBJECTMANAGER_H
00111 
00112 
Generated on Sun May 8 08:41:02 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3