00001
00032
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 #define SIM_NULL_MAP_SCALE 2 // width in pixels, where we start drawing "null" sims
00056 #define SIM_MAP_AGENT_SCALE 20 // width in pixels, where we start drawing agents
00057 #define SIM_MAP_SCALE 90 // width in pixels, where we start drawing sim tiles
00058
00059
00060 #define AGENTS_UPDATE_TIME 60.0 // in seconds
00061
00062
00063 class LLWorldMapView : public LLPanel
00064 {
00065 public:
00066 static void initClass();
00067 static void cleanupClass();
00068
00069 LLWorldMapView(const std::string& name, const LLRect& rect );
00070 virtual ~LLWorldMapView();
00071
00072 virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE );
00073 virtual void setVisible(BOOL visible);
00074
00075 virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
00076 virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
00077 virtual BOOL handleDoubleClick( S32 x, S32 y, MASK mask );
00078 virtual BOOL handleHover( S32 x, S32 y, MASK mask );
00079 virtual BOOL handleToolTip( S32 x, S32 y, LLString& msg, LLRect* sticky_rect_screen );
00080
00081 bool checkItemHit(S32 x, S32 y, LLItemInfo& item, LLUUID* id, bool track);
00082 void handleClick(S32 x, S32 y, MASK mask, S32* hit_type, LLUUID* id);
00083
00084
00085 static void setScale( F32 scale );
00086 static void translatePan( S32 delta_x, S32 delta_y );
00087 static void setPan( S32 x, S32 y, BOOL snap = TRUE );
00088
00089 LLVector3 globalPosToView(const LLVector3d& global_pos);
00090 LLVector3d viewPosToGlobal(S32 x,S32 y);
00091
00092 virtual void draw();
00093 void drawGenericItems(const LLWorldMap::item_info_list_t& items, LLPointer<LLViewerImage> image);
00094 void drawGenericItem(const LLItemInfo& item, LLPointer<LLViewerImage> image);
00095 void drawImage(const LLVector3d& global_pos, LLPointer<LLViewerImage> image, const LLColor4& color = LLColor4::white);
00096 void drawImageStack(const LLVector3d& global_pos, LLPointer<LLViewerImage> image, U32 count, F32 offset, const LLColor4& color);
00097 void drawAgents();
00098 void drawEvents();
00099 void drawFrustum();
00100
00101 static void cleanupTextures();
00102
00103
00104
00105 void drawTracking( const LLVector3d& pos_global,
00106 const LLColor4& color,
00107 BOOL draw_arrow = TRUE, LLString label = LLString(), LLString tooltip = "", S32 vert_offset = 0);
00108 static void drawTrackingArrow(const LLRect& view_rect, S32 x, S32 y,
00109 const LLColor4& color,
00110 S32 arrow_size = DEFAULT_TRACKING_ARROW_SIZE);
00111 static void drawTrackingDot(F32 x_pixels,
00112 F32 y_pixels,
00113 const LLColor4& color,
00114 F32 relative_z = 0.f,
00115 F32 dot_radius = 3.f);
00116
00117 static void drawTrackingCircle( const LLRect& rect, S32 x, S32 y,
00118 const LLColor4& color,
00119 S32 min_thickness,
00120 S32 overlap );
00121 static void drawAvatar( F32 x_pixels,
00122 F32 y_pixels,
00123 const LLColor4& color,
00124 F32 relative_z = 0.f,
00125 F32 dot_radius = 3.f);
00126 static void drawIconName(F32 x_pixels,
00127 F32 y_pixels,
00128 const LLColor4& color,
00129 const std::string& first_line,
00130 const std::string& second_line);
00131
00132
00133 static void clearLastClick() { sHandledLastClick = FALSE; }
00134
00135
00136 void updateBlock(S32 block_x, S32 block_y);
00137 void updateVisibleBlocks();
00138
00139 protected:
00140 void setDirectionPos( LLTextBox* text_box, F32 rotation );
00141 void updateDirections();
00142
00143 public:
00144 LLColor4 mBackgroundColor;
00145
00146 static LLPointer<LLViewerImage> sAvatarYouSmallImage;
00147 static LLPointer<LLViewerImage> sAvatarSmallImage;
00148 static LLPointer<LLViewerImage> sAvatarLargeImage;
00149 static LLPointer<LLViewerImage> sAvatarAboveImage;
00150 static LLPointer<LLViewerImage> sAvatarBelowImage;
00151 static LLPointer<LLViewerImage> sTelehubImage;
00152 static LLPointer<LLViewerImage> sInfohubImage;
00153 static LLPointer<LLViewerImage> sHomeImage;
00154 static LLPointer<LLViewerImage> sEventImage;
00155 static LLPointer<LLViewerImage> sEventMatureImage;
00156 static LLPointer<LLViewerImage> sTrackCircleImage;
00157 static LLPointer<LLViewerImage> sTrackArrowImage;
00158 static LLPointer<LLViewerImage> sClassifiedsImage;
00159 static LLPointer<LLViewerImage> sPopularImage;
00160 static LLPointer<LLViewerImage> sForSaleImage;
00161
00162 static F32 sThresholdA;
00163 static F32 sThresholdB;
00164 static F32 sPixelsPerMeter;
00165
00166 BOOL mItemPicked;
00167
00168 static F32 sPanX;
00169 static F32 sPanY;
00170 static F32 sTargetPanX;
00171 static F32 sTargetPanY;
00172 static S32 sTrackingArrowX;
00173 static S32 sTrackingArrowY;
00174
00175
00176 BOOL mPanning;
00177 S32 mMouseDownPanX;
00178 S32 mMouseDownPanY;
00179 S32 mMouseDownX;
00180 S32 mMouseDownY;
00181
00182 LLTextBox* mTextBoxEast;
00183 LLTextBox* mTextBoxNorth;
00184 LLTextBox* mTextBoxWest;
00185 LLTextBox* mTextBoxSouth;
00186
00187 LLTextBox* mTextBoxSouthEast;
00188 LLTextBox* mTextBoxNorthEast;
00189 LLTextBox* mTextBoxNorthWest;
00190 LLTextBox* mTextBoxSouthWest;
00191 LLTextBox* mTextBoxScrollHint;
00192
00193 static BOOL sHandledLastClick;
00194 S32 mSelectIDStart;
00195
00196 typedef std::vector<U64> handle_list_t;
00197 handle_list_t mVisibleRegions;
00198 };
00199
00200 #endif