VR-Forces 4.0.4 Class Documentation
include/tmqt/tmMapArea.h
Go to the documentation of this file.
00001 /*********************************************************************
00002 ** Copyright (c) 2001 MAK Technologies, Inc.
00003 ** All rights reserved.
00004 *********************************************************************/
00005 /*********************************************************************
00006 ** $RCSfile: tmMapArea.h,v $ $Revision: 1.93 $ $State: Exp $
00007 *********************************************************************/
00008 
00011 
00012 #ifndef TMMAPAREA_H
00013 #define TMMAPAREA_H
00014 
00015 #include "tmqt/tmArea.h"
00016 #include "tmqt/symbolSelector.h"
00017 #include "symbology/symbolList.h"
00018 
00019 #include <QtGui/QWidget>
00020 #include <QtGui/QPixmap>
00021 #include <QtCore/QTimer>
00022 #include <QtCore/QStringList>
00023 
00024 class DtTMFactory;
00025 class DtTMWindow;
00026 class DtPoint;
00027 class DtTMDisplayOptions;
00028 class DtExtent;
00029 class DtObjectSelector;
00030 class DtFilter;
00031 
00037 
00038 
00039 #include "tmqt/tmqtDefines.h"
00040 class DT_DLL_tmqt DtTMMapArea : public DtTMArea
00041 {
00042    Q_OBJECT
00043 
00044 public:
00045   
00046    DtTMMapArea(QWidget * parent = 0, const Qt::WindowFlags& flags = 0);
00047 
00048    virtual ~DtTMMapArea();
00049 
00051    virtual bool init(const DtTMFactory* f);
00052 
00053    //Set the selection type to rectangle, point, or circle. 
00054    //The types themselves are defined in symbolSelector.h
00055    virtual void setSelectorType(DtSymbolSelector::DtSelectorType type);
00056 
00057    virtual DtSymbolSelector& symbolSelector();
00058    virtual DtSymbolList& selectedSymbols();
00059 
00063    virtual const QVector<DtModelKey>& selectedModelKeys() const;
00064    virtual QVector<DtModelKey>& selectedModelKeys();
00065 
00066    virtual bool leftButtonClicked();
00067    
00068    virtual double getDatabaseHeight(double x, double y) const;
00069 
00071    virtual bool tick();
00072 
00074    virtual void setActivateMap();
00075 
00076    virtual void updateSelectedModelData();
00077 
00080    virtual void setResetLabelPositions(bool b);
00081 
00083    virtual void clear();
00084 
00085    virtual void removeFromPersistentData(const QString& key);
00086 
00089    virtual void applyOptions(DtSymbol* s);
00090 
00091    DtObjectSelector* objectSelector();
00092 
00093 public:
00094 
00096    static DtTMMapArea * create(QWidget * parent, const Qt::WindowFlags& flags);
00097 
00098 public:
00101    virtual bool startNullSelectionMode(bool showHandCursor = false);
00102 
00104    virtual bool startNormalSelectionMode();
00105 
00106    virtual bool startSymbolPointSelectionMode(int selectionMode,
00107       bool showHandCursor = false, bool reset = false, bool backup = true, bool force = false);
00108 
00109    virtual bool startSymbolRectangleSelectionMode(int selectionMode,
00110       bool showHandCursor = false, bool reset = false, bool backup = true, bool force = false);
00111 
00114    virtual bool startSelectionMode(int selectionMode, 
00115       DtSymbolSelector::DtSelectorType type, bool showHandCursor = false,
00116       bool reset = false, bool backup = true, bool force = false);
00117 
00118    virtual void swapModelKeys(QVector<DtModelKey>& orig, QVector<DtModelKey>& save, QVector<DtModelKey>& display);
00119    virtual int symbolSelectionMode() const;
00120    const DtPoint& lastSelectedPoint() const;
00121 
00124    virtual void removeSymbol(const DtModelData& data, bool force);
00125 
00127    virtual DtSymbolSelector* setCurrentSelector(DtSymbolSelector* s);
00128    virtual DtSymbolSelector* currentSelector();
00129 
00133    virtual void setObjectSelectionMode(const DtFilter* f = NULL, bool swapKeys = false);
00134 
00136    virtual bool inObjectSelectionMode() const;
00137 
00140    virtual DtSymbol* symbolAtLocation(const DtPoint& pnt) const;
00141 
00143    virtual bool event(QEvent*);
00144 
00145 signals:
00146 
00147    void leftDoubleClick();
00148 
00149    void symbolsSelected(DtSymbolList*);
00150    void selectionChanged(const QVector<DtModelKey>&);
00151    void selectionUpdated(const QVector<DtModelKey>&);
00152 
00153    void databasePointSelected(const DtPoint&);
00154 
00155    void nullSelected();
00156 
00157    void rightMouseContext(DtSymbolList*,QPoint);
00158    void middleMouseContext(DtSymbolList*,QPoint);
00159 
00163    void mouseSignal(QMouseEvent*,const DtPoint&);
00164 
00167    void keyboardSignal(QKeyEvent*);
00168 
00172    void focusEventSignal(QEvent*);
00173    void enterEventSignal(QEvent*);
00174    void leaveEventSignal(QEvent*);
00175    void activateMap(DtTMMapArea*);
00176    void dropEventSignal(QDropEvent*);
00177    void dragEnterEventSignal(QDragEnterEvent*);
00178    void dragLeaveEventSignal(QDragLeaveEvent*);
00179    void dragMoveEventSignal(QDragMoveEvent*);
00180 
00182    void selectionInProgress(DtSymbolSelector& symbolSelector);
00183 
00185    void selectedModelDataUpdated();
00186 
00188    void aboutToDraw(QPainter* map);
00189 
00191    void selectionModeChanged(int iNewMode);
00192 
00194 
00195    void frozenChanged(bool);
00196 
00197 public slots:
00199    virtual void zoomIn();
00200 
00202    virtual void zoomOut();
00203 
00204    virtual void drawRubberBands(QPainter* p);
00205 
00206    virtual void clearSelection(bool signal = true);
00207    virtual void changeSelection(const QVector<DtModelKey>& d);
00208 
00211    virtual bool addSelection(const QVector<DtModelKey>& d);
00212 
00215    virtual bool removeSelection(const QVector<DtModelKey>& d);
00216 
00217    virtual void setRightClickMaintainSelection(bool b);
00218    virtual bool rightClickMaintainSelection();
00219 
00220    //manually forces a symbol to be persistent even if it exits
00221    //the scopeof your view area
00222    virtual void forcePersistentSymbol(DtSymbol* s);
00223    virtual void stopForcePersistentSymbol(DtSymbol* s);
00224 
00225    virtual void catchViewportChange(const DtTMViewportExtents* v);
00226 
00229    virtual bool dragStart();
00230 
00233    virtual void dragComplete();
00234 
00238    virtual void setFreezeSelection(bool);
00239    bool freezeSelection() const;
00240 
00241 protected:
00242    virtual void setViewportExtents(const DtTMViewportExtents* v);
00243    virtual void modifySymbol(const DtModelData& data);
00244 
00245 private:
00246 
00248    DtTMMapArea(const DtTMMapArea& orig);
00249 
00251    DtTMMapArea& operator=(const DtTMMapArea& rhs);
00252 
00253 protected:
00254    virtual bool initViewDriver(const DtTMFactory* f);
00255    virtual bool initObjectSelector(const DtTMFactory* f);
00256 
00257    virtual void updateSymbolSelection(Qt::KeyboardModifiers keyState, Qt::MouseButtons mouseState,
00258       bool updateInternalSelection = true);
00259    virtual void updateSelectedSymbols(const QVector<DtModelKey>& selectedKeys);
00260    virtual void updatePersistentModelData();
00261    
00262    virtual void highlightNoSymbols();
00263    virtual void highlightSymbols(QVector<DtModelKey>* display = NULL);
00264 
00266    virtual void mousePressEvent ( QMouseEvent * e );
00267    virtual void mouseReleaseEvent ( QMouseEvent * e );
00268    virtual void mouseMoveEvent ( QMouseEvent * e );
00269    virtual void mouseDoubleClickEvent ( QMouseEvent * e );
00270    virtual void keyPressEvent ( QKeyEvent * e );
00271    virtual void keyReleaseEvent ( QKeyEvent * e );
00272    virtual void wheelEvent ( QWheelEvent* e );
00273    virtual void focusOutEvent ( QFocusEvent *e );
00274    virtual void leaveEvent ( QEvent *e );
00275    virtual void enterEvent ( QEvent *e );
00276 
00277    //Helper event functions
00278    virtual void mouseSelect( QMouseEvent * e );
00279    virtual void mousePressSelect( QMouseEvent * e );
00280 
00282 
00283    virtual void dragEnterEvent( QDragEnterEvent* e);
00284    virtual void dragLeaveEvent( QDragLeaveEvent* e);
00285    virtual void dragMoveEvent( QDragMoveEvent* e);
00286    virtual void dropEvent( QDropEvent* e);
00287    
00288 protected:
00289 
00290    DtObjectSelector* myObjectSelector;
00291    DtSymbolSelector* myCurrentSelector;
00292    
00293    QVector<DtModelKey> myTemporarySelectedModelData;
00294    QVector<DtModelKey> mySelectedModelKeys;
00295    
00296    QStringList myPersistentModelData;
00297    DtSymbolList myForcedPersistentModelData;
00298 
00299    DtSymbolList mySelectedSymbols;
00300 
00301    QPoint myMouseBegin;
00302    QPoint myMouseLast;
00303    DtPoint* myLastSelectedPoint;
00304 
00305    bool myIsActivated;
00306    bool myRightClickMaintainSelection;
00307    Qt::MouseButtons myButtonState;
00308    Qt::KeyboardModifiers myKeyState;
00309 
00310    bool mySingleSelection;
00311 
00312    bool myFreezeSelection;
00313 
00314    int myKeyPressed;
00315 };
00316 
00317 inline bool DtTMMapArea::freezeSelection() const
00318 {
00319    return myFreezeSelection;
00320 }
00321 
00322 inline DtObjectSelector* DtTMMapArea::objectSelector()
00323 {
00324    return myObjectSelector;
00325 }
00326 
00327 #endif
00328 

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)