00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef _SO_MARKER_H_
00026 #define _SO_MARKER_H_
00027
00028 #include <Inventor/nodes/SoNode.h>
00029 #include <Inventor/fields/SoMFUInt32.h>
00030 #include <Inventor/fields/SoSFBool.h>
00031 #include <Inventor/fields/SoMFUByte.h>
00032 #include <Inventor/fields/SoSFVec2s.h>
00033 #include <Inventor/fields/SoSFInt32.h>
00034
00035 class SoState;
00036 class SoGLObjectCache;
00037
00038 #define MARKER_HASH_TAB_SIZE 151
00039
00127 class SoMarker : public SoNode
00128 {
00129 SO_NODE_HEADER(SoMarker);
00130
00131 public:
00132
00134 enum MarkerType {
00136 CROSS_5_5,
00138 PLUS_5_5,
00140 MINUS_5_5,
00142 SLASH_5_5,
00144 BACKSLASH_5_5,
00146 BAR_5_5,
00148 STAR_5_5,
00150 Y_5_5,
00152 LIGHTNING_5_5,
00154 WELL_5_5,
00155
00157 CIRCLE_LINE_5_5,
00159 SQUARE_LINE_5_5,
00161 DIAMOND_LINE_5_5,
00163 TRIANGLE_LINE_5_5,
00165 RHOMBUS_LINE_5_5,
00167 HOURGLASS_LINE_5_5,
00169 SATELLITE_LINE_5_5,
00171 PINE_TREE_LINE_5_5,
00173 CAUTION_LINE_5_5,
00175 SHIP_LINE_5_5,
00176
00178 CIRCLE_FILLED_5_5,
00180 SQUARE_FILLED_5_5,
00182 DIAMOND_FILLED_5_5,
00184 TRIANGLE_FILLED_5_5,
00186 RHOMBUS_FILLED_5_5,
00188 HOURGLASS_FILLED_5_5,
00190 SATELLITE_FILLED_5_5,
00192 PINE_TREE_FILLED_5_5,
00194 CAUTION_FILLED_5_5,
00196 SHIP_FILLED_5_5,
00197
00199 CROSS_7_7,
00201 PLUS_7_7,
00203 MINUS_7_7,
00205 SLASH_7_7,
00207 BACKSLASH_7_7,
00209 BAR_7_7,
00211 STAR_7_7,
00213 Y_7_7,
00215 LIGHTNING_7_7,
00217 WELL_7_7,
00218
00220 CIRCLE_LINE_7_7,
00222 SQUARE_LINE_7_7,
00224 DIAMOND_LINE_7_7,
00226 TRIANGLE_LINE_7_7,
00228 RHOMBUS_LINE_7_7,
00230 HOURGLASS_LINE_7_7,
00232 SATELLITE_LINE_7_7,
00234 PINE_TREE_LINE_7_7,
00236 CAUTION_LINE_7_7,
00238 SHIP_LINE_7_7,
00239
00241 CIRCLE_FILLED_7_7,
00243 SQUARE_FILLED_7_7,
00245 DIAMOND_FILLED_7_7,
00247 TRIANGLE_FILLED_7_7,
00249 RHOMBUS_FILLED_7_7,
00251 HOURGLASS_FILLED_7_7,
00253 SATELLITE_FILLED_7_7,
00255 PINE_TREE_FILLED_7_7,
00257 CAUTION_FILLED_7_7,
00259 SHIP_FILLED_7_7,
00260
00262 CROSS_9_9,
00264 PLUS_9_9,
00266 MINUS_9_9,
00268 SLASH_9_9,
00270 BACKSLASH_9_9,
00272 BAR_9_9,
00274 STAR_9_9,
00276 Y_9_9,
00278 LIGHTNING_9_9,
00280 WELL_9_9,
00281
00283 CIRCLE_LINE_9_9,
00285 SQUARE_LINE_9_9,
00287 DIAMOND_LINE_9_9,
00289 TRIANGLE_LINE_9_9,
00291 RHOMBUS_LINE_9_9,
00293 HOURGLASS_LINE_9_9,
00295 SATELLITE_LINE_9_9,
00297 PINE_TREE_LINE_9_9,
00299 CAUTION_LINE_9_9,
00301 SHIP_LINE_9_9,
00302
00304 CIRCLE_FILLED_9_9,
00306 SQUARE_FILLED_9_9,
00308 DIAMOND_FILLED_9_9,
00310 TRIANGLE_FILLED_9_9,
00312 RHOMBUS_FILLED_9_9,
00314 HOURGLASS_FILLED_9_9,
00316 SATELLITE_FILLED_9_9,
00318 PINE_TREE_FILLED_9_9,
00320 CAUTION_FILLED_9_9,
00322 SHIP_FILLED_9_9
00323 };
00324
00328 SoMarker();
00329
00333 SoMFUByte bitmap;
00334
00338 SoMFUInt32 orderedRGBA;
00339
00345 SoSFBool upToDown;
00346
00351 SoSFBool isLSBFirst;
00352
00356 SoSFVec2s size;
00357
00361 SoSFInt32 index;
00362
00363 private:
00364
00365 static void initClass();
00366 static void exitClass();
00367
00368 virtual void notify( SoNotList* list );
00369
00373 int getMarkerIndex()
00374 { return m_markerIndex; }
00375
00379 void setMarkerIndex( const int tindex )
00380 { m_markerIndex = tindex; }
00381
00385 static int getNumDefinedMarkers();
00386
00390 static int getMaxIndexDefinedMarker();
00391
00395 static void addMarker(int markerIndex,
00396 const SbVec2s &size,
00397 const unsigned char *bytes,
00398 const uint32_t *orderedRGBA,
00399 SbBool isLSBFirst = TRUE,
00400 SbBool isUpToDown = TRUE);
00404 static void addMarker(int markerIndex, SoMarker* marker );
00405
00409 static SbBool removeMarker(int markerIndex);
00410
00411 static SoMarker* getMarkerDesc( int markerInd );
00412
00413 static SbBool isMarkerBitSet(int markerIndex, int bitNumber) ;
00414
00415
00416 static void updateListInstanciedMarkerSet();
00417 static void addMarkerSetDependency(SoNode* );
00418 static void removeMarkerSetDependency(SoNode* );
00419
00420 private:
00424 virtual ~SoMarker();
00425
00426 SbBool useDL;
00427
00428 virtual SbBool readInstance(SoInput *in, unsigned short flags);
00429
00430 private:
00431
00432
00433 int m_markerIndex;
00434
00435
00436 SoGLObjectCache* m_objCache;
00437
00438
00439 static SbPList m_markerHashTab[MARKER_HASH_TAB_SIZE];
00440
00441
00442 static void createListOfPreDefinedMarkers();
00443 static void destroyListOfPreDefinedMarkers();
00444 static bool m_isBuildingPredefinedMarkers;
00445
00446
00447 static inline int getMarkerHashTabIndex(int markerIndex);
00448
00449
00450 static SbPList m_listInstanciedMarkerSet;
00451
00452 void setPredefined(bool b);
00453
00454 bool m_predefined;
00455 bool m_prevUpToDown;
00456
00457
00458 static int s_cachedCurrentMarkerIndex;
00459 };
00460
00461 #endif // !_SO_MARKER_H_
00462
00463
00464