00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _PO_AUTO_CUBE_AXIS_
00025 #define _PO_AUTO_CUBE_AXIS_
00026
00027 #include <Inventor/fields/SoSFEnum.h>
00028 #include <Inventor/fields/SoSFString.h>
00029 #include <Inventor/fields/SoSFVec3f.h>
00030 #include <Inventor/fields/SoSFBool.h>
00031 #include <Inventor/fields/SoSFMatrix.h>
00032
00033 #include <MeshViz/graph/PoBaseAxis.h>
00034 #include <MeshViz/graph/PbMiscTextAttr.h>
00035
00036 struct Pedge ;
00037 class PoCartesianAxis ;
00038
00106 class PoAutoCubeAxis : public PoBaseAxis {
00107 SO_KIT_HEADER(PoAutoCubeAxis) ;
00108
00109
00110
00111 SO_KIT_CATALOG_ENTRY_HEADER(backgroundFaceSep) ;
00112 SO_KIT_CATALOG_ENTRY_HEADER(backgroundFaceApp) ;
00113 SO_KIT_CATALOG_ENTRY_HEADER(backgroundFace) ;
00114
00115
00116 SO_KIT_CATALOG_ENTRY_HEADER(mainGradGridSep) ;
00117 SO_KIT_CATALOG_ENTRY_HEADER(mainGradGridApp) ;
00118 SO_KIT_CATALOG_ENTRY_HEADER(mainGradGrid) ;
00119
00120
00121 SO_KIT_CATALOG_ENTRY_HEADER(subGradGridSep) ;
00122 SO_KIT_CATALOG_ENTRY_HEADER(subGradGridApp) ;
00123 SO_KIT_CATALOG_ENTRY_HEADER(subGradGrid) ;
00124
00125
00126
00127 SO_KIT_CATALOG_ENTRY_HEADER(xAxisSwitch03) ;
00128 SO_KIT_CATALOG_ENTRY_HEADER(xAxis03) ;
00129
00130
00131 SO_KIT_CATALOG_ENTRY_HEADER(xAxisSwitch12) ;
00132 SO_KIT_CATALOG_ENTRY_HEADER(xAxis12) ;
00133
00134
00135 SO_KIT_CATALOG_ENTRY_HEADER(xAxisSwitch65) ;
00136 SO_KIT_CATALOG_ENTRY_HEADER(xAxis65) ;
00137
00138
00139 SO_KIT_CATALOG_ENTRY_HEADER(xAxisSwitch74) ;
00140 SO_KIT_CATALOG_ENTRY_HEADER(xAxis74) ;
00141
00142
00143
00144 SO_KIT_CATALOG_ENTRY_HEADER(yAxisSwitch01) ;
00145 SO_KIT_CATALOG_ENTRY_HEADER(yAxis01) ;
00146
00147
00148 SO_KIT_CATALOG_ENTRY_HEADER(yAxisSwitch76) ;
00149 SO_KIT_CATALOG_ENTRY_HEADER(yAxis76) ;
00150
00151
00152 SO_KIT_CATALOG_ENTRY_HEADER(yAxisSwitch45) ;
00153 SO_KIT_CATALOG_ENTRY_HEADER(yAxis45) ;
00154
00155
00156 SO_KIT_CATALOG_ENTRY_HEADER(yAxisSwitch32) ;
00157 SO_KIT_CATALOG_ENTRY_HEADER(yAxis32) ;
00158
00159
00160
00161 SO_KIT_CATALOG_ENTRY_HEADER(zAxisSwitch07) ;
00162 SO_KIT_CATALOG_ENTRY_HEADER(zAxis07) ;
00163
00164
00165 SO_KIT_CATALOG_ENTRY_HEADER(zAxisSwitch34) ;
00166 SO_KIT_CATALOG_ENTRY_HEADER(zAxis34) ;
00167
00168
00169 SO_KIT_CATALOG_ENTRY_HEADER(zAxisSwitch25) ;
00170 SO_KIT_CATALOG_ENTRY_HEADER(zAxis25) ;
00171
00172
00173 SO_KIT_CATALOG_ENTRY_HEADER(zAxisSwitch16) ;
00174 SO_KIT_CATALOG_ENTRY_HEADER(zAxis16) ;
00175
00176
00177 public:
00178
00182 enum AxisType {
00186 LINEAR,
00190 LOGARITHMIC,
00194 GENERALIZED
00195 } ;
00196
00197
00198
00202 SoSFVec3f start ;
00203
00207 SoSFVec3f end ;
00208
00217 SoSFVec3f gradStart;
00218
00227 SoSFVec3f gradEnd;
00228
00232 SoSFString xTitle ;
00233
00237 SoSFString yTitle ;
00238
00242 SoSFString zTitle ;
00243
00244
00245
00252 SoSFBool isGridLinesXVisible ;
00253
00260 SoSFBool isGridLinesYVisible ;
00261
00268 SoSFBool isGridLinesZVisible ;
00269
00273 SoSFBool isBackgroundFacesVisible ;
00274
00282 SoSFBool isIntersectingGradsVisible ;
00283
00290 SoSFMatrix modellingMatrix ;
00291
00299 SoSFMatrix viewingMatrix ;
00300
00308 SoSFMatrix projectionMatrix ;
00309
00310
00311
00312
00313
00317 PoAutoCubeAxis() ;
00318
00322 PoAutoCubeAxis(const SbVec3f &_start, const SbVec3f &_end, AxisType xAxisType,
00323 AxisType yAxisType, AxisType zAxisType, const char *xTtle = NULL,
00324 const char *yTtle = NULL, const char *zTtle = NULL) ;
00325
00329 virtual void GLRender( SoGLRenderAction *action );
00330 virtual void rebuild() ;
00331
00332
00333 private:
00334 static void initClass() ;
00335 static void exitClass() ;
00336
00337 private:
00338 virtual ~PoAutoCubeAxis() ;
00339
00340
00341
00342 virtual SbBool setUpConnections(SbBool onOff, SbBool doItAlways = FALSE) ;
00343 virtual void setDefaultOnNonWritingFields() ;
00344
00345 private:
00346
00347 void init(SbBool isDefault, const SbVec3f &_start, const SbVec3f &_end,
00348 AxisType xAxisType, AxisType yAxisType, AxisType zAxisType,
00349 const char *xTtle, const char *yTtle, const char *zTtle) ;
00350
00351
00352 void computeParalVertices() ;
00353
00354
00355 void computeParalFaceNormals() ;
00356
00357
00358
00359 void buildAxis(const Pedge *edge, PoCartesianAxis *axis) ;
00360
00361
00362 void drawBackgroundFaces() ;
00363
00364
00365 void handleGradsDrawing(const int *indexVisibleEdges, int nbVisibleEdges, PoCartesianAxis *axis[12]) ;
00366
00367
00368 void eliminateIntersectingGrads(const int *indexVisibleEdges, const int nbVisibleEdges,
00369 PoCartesianAxis *axis[12]) ;
00370
00371
00372 void drawGridLines(PoCartesianAxis *axis[12]) ;
00373
00374
00375 void resetAllParts() ;
00376
00377
00378
00379 void rebuildWithoutMatrix() ;
00380
00381
00382
00383
00384 static void catchActionCB(void *data, SoAction *action) ;
00385
00386
00387 SbVec3d m_paralVertices[8] ;
00388
00389
00390
00391
00392
00393 SbBool m_rebuildWithoutMatrix ;
00394
00395
00396 static SbBool m_firstInstance ;
00397
00398 SoSFEnum xAxisType, yAxisType, zAxisType ;
00399
00400
00401 FieldSensorList m_fieldSensorList ;
00402
00403
00404 SoFieldList m_fieldList ;
00405 } ;
00406
00407
00408
00409 #endif
00410
00411