llworldmapview.h

Go to the documentation of this file.
00001 
00032 // Global map of the world.
00033 
00034 #ifndef LL_LLWORLDMAPVIEW_H
00035 #define LL_LLWORLDMAPVIEW_H
00036 
00037 #include "llpanel.h"
00038 #include "v3math.h"
00039 #include "v3dmath.h"
00040 #include "v4color.h"
00041 #include "llviewerimage.h"
00042 #include "llmapimagetype.h"
00043 #include "llworldmap.h"
00044 
00045 class LLItemInfo;
00046 
00047 const S32 DEFAULT_TRACKING_ARROW_SIZE = 16;
00048 
00049 class LLColor4;
00050 class LLColor4U;
00051 class LLCoordGL;
00052 class LLViewerImage;
00053 class LLTextBox;
00054 
00055 
00056 class LLWorldMapView : public LLPanel
00057 {
00058 public:
00059         static void initClass();
00060         static void cleanupClass();
00061 
00062         LLWorldMapView(const std::string& name, const LLRect& rect );
00063         virtual ~LLWorldMapView();
00064 
00065         virtual void    reshape(S32 width, S32 height, BOOL called_from_parent = TRUE );
00066         virtual void    setVisible(BOOL visible);
00067 
00068         virtual BOOL    handleMouseDown(S32 x, S32 y, MASK mask);
00069         virtual BOOL    handleMouseUp(S32 x, S32 y, MASK mask);
00070         virtual BOOL    handleDoubleClick( S32 x, S32 y, MASK mask );
00071         virtual BOOL    handleHover( S32 x, S32 y, MASK mask );
00072         virtual BOOL    handleToolTip( S32 x, S32 y, LLString& msg, LLRect* sticky_rect_screen );
00073 
00074         bool                    checkItemHit(S32 x, S32 y, LLItemInfo& item, LLUUID* id, bool track);
00075         void                    handleClick(S32 x, S32 y, MASK mask, S32* hit_type, LLUUID* id);
00076 
00077         // Scale and pan are shared across all instances.
00078         static void             setScale( F32 scale );
00079         static void             translatePan( S32 delta_x, S32 delta_y );
00080         static void             setPan( S32 x, S32 y, BOOL snap = TRUE );
00081 
00082         LLVector3               globalPosToView(const LLVector3d& global_pos);
00083         LLVector3d              viewPosToGlobal(S32 x,S32 y);
00084 
00085         virtual void    draw();
00086         void                    drawGenericItems(const LLWorldMap::item_info_list_t& items, LLUIImagePtr image);
00087         void                    drawGenericItem(const LLItemInfo& item, LLUIImagePtr image);
00088         void                    drawImage(const LLVector3d& global_pos, LLUIImagePtr image, const LLColor4& color = LLColor4::white);
00089         void                    drawImageStack(const LLVector3d& global_pos, LLUIImagePtr image, U32 count, F32 offset, const LLColor4& color);
00090         void                    drawAgents();
00091         void                    drawEvents();
00092         void                    drawFrustum();
00093 
00094         static void             cleanupTextures();
00095 
00096         // Draw the tracking indicator, doing the right thing if it's outside
00097         // the view area.
00098         void                    drawTracking( const LLVector3d& pos_global, 
00099                                                                   const LLColor4& color,
00100                                                                   BOOL draw_arrow = TRUE, LLString label = LLString(), LLString tooltip = "", S32 vert_offset = 0);
00101         static void             drawTrackingArrow(const LLRect& view_rect, S32 x, S32 y, 
00102                                                                           const LLColor4& color,
00103                                                                           S32 arrow_size = DEFAULT_TRACKING_ARROW_SIZE);
00104         static void             drawTrackingDot(F32 x_pixels, 
00105                                                                         F32 y_pixels, 
00106                                                                         const LLColor4& color,
00107                                                                         F32 relative_z = 0.f,
00108                                                                         F32 dot_radius = 3.f);
00109 
00110         static void             drawTrackingCircle( const LLRect& rect, S32 x, S32 y, 
00111                                                                                 const LLColor4& color, 
00112                                                                                 S32 min_thickness, 
00113                                                                                 S32 overlap );
00114         static void             drawAvatar(     F32 x_pixels, 
00115                                                                 F32 y_pixels, 
00116                                                                 const LLColor4& color,
00117                                                                 F32 relative_z = 0.f,
00118                                                                 F32 dot_radius = 3.f);
00119         static void             drawIconName(F32 x_pixels, 
00120                                                                         F32 y_pixels, 
00121                                                                         const LLColor4& color,
00122                                                                         const std::string& first_line,
00123                                                                         const std::string& second_line);
00124 
00125         // Prevents accidental double clicks
00126         static void             clearLastClick() { sHandledLastClick = FALSE; }
00127 
00128         // if the view changes, download additional sim info as needed
00129         void                    updateBlock(S32 block_x, S32 block_y);
00130         void                    updateVisibleBlocks();
00131 
00132 protected:
00133         void                    setDirectionPos( LLTextBox* text_box, F32 rotation );
00134         void                    updateDirections();
00135 
00136 public:
00137         LLColor4                mBackgroundColor;
00138 
00139         static LLUIImagePtr     sAvatarYouSmallImage;
00140         static LLUIImagePtr     sAvatarSmallImage;
00141         static LLUIImagePtr     sAvatarLargeImage;
00142         static LLUIImagePtr     sAvatarAboveImage;
00143         static LLUIImagePtr     sAvatarBelowImage;
00144         static LLUIImagePtr     sTelehubImage;
00145         static LLUIImagePtr     sInfohubImage;
00146         static LLUIImagePtr     sHomeImage;
00147         static LLUIImagePtr     sEventImage;
00148         static LLUIImagePtr     sEventMatureImage;
00149         static LLUIImagePtr     sTrackCircleImage;
00150         static LLUIImagePtr     sTrackArrowImage;
00151         static LLUIImagePtr     sClassifiedsImage;
00152         static LLUIImagePtr     sForSaleImage;
00153 
00154         static F32              sThresholdA;
00155         static F32              sThresholdB;
00156         static F32              sPixelsPerMeter;                // world meters to map pixels
00157 
00158         BOOL                    mItemPicked;
00159 
00160         static F32              sPanX;          // in pixels
00161         static F32              sPanY;          // in pixels
00162         static F32              sTargetPanX;            // in pixels
00163         static F32              sTargetPanY;            // in pixels
00164         static S32              sTrackingArrowX;
00165         static S32              sTrackingArrowY;
00166 
00167         // Are we mid-pan from a user drag?
00168         BOOL                    mPanning;
00169         S32                             mMouseDownPanX;         // value at start of drag
00170         S32                             mMouseDownPanY;         // value at start of drag
00171         S32                             mMouseDownX;
00172         S32                             mMouseDownY;
00173 
00174         LLTextBox*              mTextBoxEast;
00175         LLTextBox*              mTextBoxNorth;
00176         LLTextBox*              mTextBoxWest;
00177         LLTextBox*              mTextBoxSouth;
00178 
00179         LLTextBox*              mTextBoxSouthEast;
00180         LLTextBox*              mTextBoxNorthEast;
00181         LLTextBox*              mTextBoxNorthWest;
00182         LLTextBox*              mTextBoxSouthWest;
00183         LLTextBox*              mTextBoxScrollHint;
00184 
00185         static BOOL             sHandledLastClick;
00186         S32                             mSelectIDStart;
00187 
00188         typedef std::vector<U64> handle_list_t;
00189         handle_list_t mVisibleRegions; // set every frame
00190 };
00191 
00192 #endif

Generated on Fri May 16 08:34:27 2008 for SecondLife by  doxygen 1.5.5