00001
00032 #ifndef LL_LLNETMAP_H
00033 #define LL_LLNETMAP_H
00034
00035 #include "llmath.h"
00036 #include "lluictrl.h"
00037 #include "v3math.h"
00038 #include "v3dmath.h"
00039 #include "v4color.h"
00040 #include "llimage.h"
00041 #include "llimagegl.h"
00042
00043 class LLColor4U;
00044 class LLCoordGL;
00045 class LLTextBox;
00046 class LLMenuGL;
00047
00048 class LLRotateNetMapListener : public LLSimpleListener
00049 {
00050 public:
00051 bool handleEvent(LLPointer<LLEvent>, const LLSD& user_data);
00052 };
00053
00054 class LLNetMap : public LLUICtrl
00055 {
00056 public:
00057 LLNetMap(const std::string& name, const LLRect& rect, const LLColor4& bg_color );
00058 virtual ~LLNetMap();
00059
00060 virtual EWidgetType getWidgetType() const;
00061 virtual LLString getWidgetTag() const;
00062
00063 virtual void draw();
00064 virtual BOOL handleDoubleClick( S32 x, S32 y, MASK mask );
00065 virtual BOOL handleRightMouseDown( S32 x, S32 y, MASK mask );
00066 virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks);
00067 virtual BOOL handleToolTip( S32 x, S32 y, LLString& msg, LLRect* sticky_rect_screen );
00068
00069 void setScale( F32 scale );
00070 void translatePan( F32 delta_x, F32 delta_y );
00071 void setPan( F32 x, F32 y ) { mTargetPanX = x; mTargetPanY = y; }
00072
00073 const LLVector3d& getObjectImageCenterGlobal() { return mObjectImageCenterGlobal; }
00074 void renderPoint(const LLVector3 &pos, const LLColor4U &color,
00075 S32 diameter, S32 relative_height = 0);
00076 void renderScaledPointGlobal( const LLVector3d& pos, const LLColor4U &color, F32 radius );
00077
00078 LLVector3 globalPosToView(const LLVector3d& global_pos);
00079 LLVector3d viewPosToGlobal(S32 x,S32 y);
00080
00081 static void setRotateMap( BOOL b ) { LLNetMap::sRotateMap = b; }
00082 static void handleZoomLevel(void* which);
00083
00084 void drawTracking( const LLVector3d& pos_global,
00085 const LLColor4& color,
00086 BOOL draw_arrow = TRUE);
00087
00088 protected:
00089 void setDirectionPos( LLTextBox* text_box, F32 rotation );
00090 void createObjectImage();
00091 static void teleport( const LLVector3d& destination );
00092 static void fly( const LLVector3d& destination );
00093
00094 public:
00095 LLViewHandle mPopupMenuHandle;
00096 LLColor4 mBackgroundColor;
00097
00098 F32 mScale;
00099 F32 mPixelsPerMeter;
00100 F32 mObjectMapTPM;
00101 F32 mObjectMapPixels;
00102 F32 mTargetPanX;
00103 F32 mTargetPanY;
00104 F32 mCurPanX;
00105 F32 mCurPanY;
00106 BOOL mUpdateNow;
00107 LLVector3d mObjectImageCenterGlobal;
00108 LLPointer<LLImageRaw> mObjectRawImagep;
00109 LLPointer<LLImageGL> mObjectImagep;
00110 LLTextBox* mTextBoxEast;
00111 LLTextBox* mTextBoxNorth;
00112 LLTextBox* mTextBoxWest;
00113 LLTextBox* mTextBoxSouth;
00114
00115 LLTextBox* mTextBoxSouthEast;
00116 LLTextBox* mTextBoxNorthEast;
00117 LLTextBox* mTextBoxNorthWest;
00118 LLTextBox* mTextBoxSouthWest;
00119
00120 LLRotateNetMapListener mNetMapListener;
00121
00122 static BOOL sRotateMap;
00123 static LLNetMap* sInstance;
00124 };
00125
00126
00127 #endif