00001 // Copyright (c) 1998-2014 by Tech Soft 3D, Inc. 00002 // 00003 // The information contained herein is confidential and proprietary to Tech Soft 3D, Inc., 00004 // and considered a trade secret as defined under civil and criminal statutes. 00005 // Tech Soft 3D, Inc. shall pursue its civil and criminal remedies in the event of 00006 // unauthorized use or misappropriation of its trade secrets. Use of this information 00007 // by anyone other than authorized employees of Tech Soft 3D, Inc. is granted only under 00008 // a written non-disclosure agreement, expressly prescribing the scope and manner of such use. 00009 00010 // HUtilityAnnotation.h : interface of the HUtilityAnnotation class 00011 00012 00013 00014 #ifndef _HUtilityAnnotation_H 00015 #define _HUtilityAnnotation_H 00016 00017 #ifdef H_PACK_8 00018 #pragma pack(push) 00019 #pragma pack(8) 00020 #endif 00021 00022 #include "hic_types.h" 00023 00024 #include "HTools.h" 00025 00026 class HPoint; 00027 class HBaseView; 00028 class HCamera; 00029 00030 #define BG_CIRCLE 0 00031 #define BG_QUAD 1 00032 #define BG_CLOUD 2 00033 #define BG_NONE 3 00034 00035 00037 00040 class MVO_API HUtilityAnnotation 00041 { 00042 public: 00043 HUtilityAnnotation() : m_MyTextKey(INVALID_KEY) {;}; 00044 00045 virtual ~HUtilityAnnotation() {;}; 00046 00048 virtual void AddChar(char the_char); 00049 00051 virtual void AddChar(unsigned short the_char); 00052 00056 virtual HC_KEY GetBackgroundSegmentKey(); 00057 00059 virtual HC_KEY GetKey() {return m_MyKey;} 00060 00062 static HC_KEY GetKey(HC_KEY); 00063 00067 virtual void GetText(char * text, int &length); 00068 00070 virtual int GetTextLength(); 00071 00075 virtual void GetTextWithEncoding(unsigned short * text, int &length); 00076 00078 virtual char const* GetType() {return "HUtilityAnnotation";}; 00079 00091 virtual HC_KEY Insert( 00092 HPoint target, 00093 HPoint position, 00094 HC_KEY AnnotateThis, 00095 HBaseView * pView, 00096 HC_KEY layer_key = INVALID_KEY, 00097 int bg_type = BG_QUAD, 00098 bool useArrow = true, 00099 HC_KEY * key_path = (HC_KEY*)0, 00100 int key_path_length = 0); 00101 00114 virtual HC_KEY Insert( 00115 const char * text, 00116 HPoint target, 00117 HPoint position, 00118 HC_KEY AnnotateThis, 00119 HBaseView * pView, 00120 HC_KEY layer_key = INVALID_KEY, 00121 int bg_type = BG_QUAD, 00122 bool useArrow = true, 00123 HC_KEY * key_path = (HC_KEY*)0, 00124 int key_path_length = 0); 00125 00138 virtual HC_KEY InsertWithEncoding( 00139 const unsigned short * text, 00140 HPoint target, 00141 HPoint position, 00142 HC_KEY AnnotateThis, 00143 HBaseView * pView, 00144 HC_KEY layer_key = INVALID_KEY, 00145 int bg_type = BG_QUAD, 00146 bool useArrow = true, 00147 HC_KEY * key_path = (HC_KEY*)0, 00148 int key_path_length = 0); 00149 00154 static bool IsAnnotation(HC_KEY key); 00155 00158 static bool IsNote(HC_KEY noteskey); 00159 00161 static void ChangeAllFonts(HBaseView * view, char const * const font, HC_KEY seg_key = INVALID_KEY); 00162 00164 virtual void MoveText(HPoint const & pos, HCamera const * camera = 0); 00165 00167 virtual void MoveText(HPoint const & tar, HPoint const & pos, HCamera const * camera = 0); 00168 00171 virtual void SetBackgroundType(long type); 00172 00175 virtual void SetColor(char const * color); 00176 00178 virtual void SetEdgeWeight(float weight); 00179 00181 virtual void SetExtents(int xpixels, int ypixels, HC_KEY view_key); 00182 00185 virtual void SetFacePattern(char const * pattern); 00186 00189 virtual void SetLinePattern(char const * pattern); 00190 00192 virtual void SetLineWeight(float weight); 00193 00198 virtual void SetNote(HC_KEY noteskey, HC_KEY view_key); 00199 00204 virtual void SetNote(HC_KEY noteskey, HBaseView* pView); 00205 00208 virtual void SetOnTop(bool t); 00209 00212 virtual bool GetOnTop(); 00213 00215 virtual void SetText(char const * text); 00216 00220 virtual void SetTextFont(char const * font); 00221 00223 virtual void SetTextWithEncoding(unsigned short const * text); 00224 00226 virtual void ShowPosition(HPoint &p); 00227 00229 virtual void ShowPosition(float *x, float *y, float *z); 00230 00232 virtual void ShowTarget(HPoint &p); 00233 00235 virtual void ShowTarget(float *x, float *y, float *z); 00236 00238 virtual void UnSetExtents(); 00239 00243 virtual void Resize(int include_count, HC_KEY include_keys[], HC_KEY view_key); 00244 00245 virtual void Resize(HC_KEY include_keys, HC_KEY view_key) { 00246 HC_KEY key = include_keys; 00247 Resize(1, &key, view_key); 00248 }; 00249 00250 /* This is the direction the note was facing the last time it was moved (if the caller passed 00251 * in a camera on the last move). */ 00252 virtual HPoint GetFacing() const; 00253 00254 /* This is the up direction of the note the last time it was moved (if the caller passed 00255 * in a camera on the last move). */ 00256 virtual HPoint GetUp() const; 00257 00260 static void WindowResizeCallback(int signal, void * signal_data, void * user_data); 00261 00264 static void recursive_resize(HC_KEY seg_key, int include_count, HC_KEY include_keys[], HC_KEY view_key); 00265 00266 static void drawLineCallback (HIC_Rendition const *rendition,int count, HIC_DC_Point p[]); 00267 static void drawLineCallbackClip (HIC_Rendition const *rendition,int count, HIC_DC_Point p[]); 00268 static void drawMarkerCallback (HIC_Rendition const *rendition, HIC_DC_Point *p); 00269 private: 00270 00271 00272 00274 static void recursive_change_font(HC_KEY seg_key, int include_count, HC_KEY include_keys[], HC_KEY view_key, char const * const font); 00275 00276 void SetConditionalVisibility(HBaseView * pView, HC_KEY const key_path[], int const key_path_length); 00277 00278 protected: 00279 static int Clip_Line_Inverse(HIC_DC_Point *p, HIC_DC_Point *po, int top, int left, int bottom, int right); 00280 static int Clip_Line(HIC_DC_Point *p, HIC_DC_Point *po, int top, int left, int bottom, int right); 00281 00282 HC_KEY m_MyKey; 00283 HC_KEY m_MyTextKey; 00284 static HC_KEY g_segmentkey; 00285 static int g_width; 00286 static int g_height; 00287 00288 HPoint m_target, m_position; 00289 }; 00290 00291 #ifdef H_PACK_8 00292 #pragma pack(pop) 00293 #endif 00294 00295 #endif 00296 00297 00298