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_MESH3DVEC_
00025 #define _PO_MESH3DVEC_
00026
00027 #include <Inventor/SbLinear.h>
00028 #include <MeshViz/3Ddata/PoMesh3D.h>
00029
00030 class PiArrow;
00031 class PbIndexedMesh3D;
00032 class PbTetrahedronMesh3D;
00033 class PbHexahedronMesh3D;
00034 class PbCartesianGrid3D;
00035 class PbParalCartesianGrid3D;
00036 class PbRegularCartesianGrid3D;
00037
00095 class PoMesh3DVec : public PoMesh3D {
00096
00097 SO_KIT_HEADER(PoMesh3DVec) ;
00098
00099
00100 SO_KIT_CATALOG_ENTRY_HEADER(bodySep);
00101 SO_KIT_CATALOG_ENTRY_HEADER(bodyApp);
00102 SO_KIT_CATALOG_ENTRY_HEADER(bodyGroup);
00103
00104 SO_KIT_CATALOG_ENTRY_HEADER(startArrowSep);
00105 SO_KIT_CATALOG_ENTRY_HEADER(startArrowApp);
00106 SO_KIT_CATALOG_ENTRY_HEADER(startArrowGroup);
00107
00108 SO_KIT_CATALOG_ENTRY_HEADER(endArrowSep);
00109 SO_KIT_CATALOG_ENTRY_HEADER(endArrowApp);
00110 SO_KIT_CATALOG_ENTRY_HEADER(endArrowGroup);
00111
00112
00113 public:
00114
00118 PoMesh3DVec() ;
00119
00123 virtual void rebuild() ;
00124
00128 enum EliminationStatus {
00129 NONE,
00130 TOO_SMALL,
00131 TOO_LONG,
00132 TOO_SMALL_OR_LONG
00133 } ;
00134
00135
00136
00140 enum BodyShape {
00141 NO_BODY,
00142 LINE,
00143 CYLINDER
00144 } ;
00145
00146
00147
00151 enum BodyLengthType {
00152 CONSTANT_LENGTH,
00153 RELATIVE_LENGTH
00154 } ;
00155
00156
00157
00161 enum BodyRadiusType {
00162 CONSTANT_RADIUS,
00163 RELATIVE_RADIUS
00164 } ;
00165
00166
00167
00171 enum ArrowShape {
00172 NO_SHAPE,
00173 POINT,
00174 CHEVRON,
00175 TRIANGLE,
00176 RECTANGLE,
00177 CONE,
00178 BOX,
00179 SPHERE,
00180 INDIRECT_CHEVRON,
00181 INDIRECT_TRIANGLE,
00182 INDIRECT_CONE
00183 } ;
00184
00185
00186
00190 enum ArrowHeightType {
00191 CONSTANT_HEIGHT,
00192 RELATIVE_HEIGHT
00193 } ;
00194
00195
00196
00200 enum ArrowColoringType {
00201 CONSTANT_COLOR,
00202 MODULE_MAPPING_COLOR,
00203 SCALAR_MAPPING_COLOR
00204 } ;
00205
00206
00207
00208
00209
00214 SoSFInt32 density;
00215
00224 SoSFEnum eliminationStatus;
00225
00230 SoSFFloat minLength;
00231
00236 SoSFFloat maxLength;
00237
00238
00239
00240
00241
00246 SoSFEnum bodyShape;
00247
00253 SoSFEnum bodyLengthType;
00254
00258 SoSFFloat bodyLengthFactor;
00259
00268 SoSFEnum bodyRadiusType;
00269
00273 SoSFFloat bodyRadiusFactor;
00274
00292 SoSFEnum bodyColoringType;
00293
00294
00295
00296
00297
00302 SoSFEnum startArrowShape;
00303
00311 SoSFEnum startArrowHeightType;
00312
00316 SoSFFloat startArrowHeightFactor;
00317
00321 SoSFFloat startArrowRadiusFactor;
00322
00339 SoSFEnum startArrowColoringType;
00340
00341
00342
00343
00344
00349 SoSFEnum endArrowShape;
00350
00358 SoSFEnum endArrowHeightType;
00359
00363 SoSFFloat endArrowHeightFactor;
00364
00368 SoSFFloat endArrowRadiusFactor;
00369
00386 SoSFEnum endArrowColoringType;
00387
00388
00389 private:
00390 static void initClass() ;
00391 static void exitClass() ;
00392
00393 void indexedMesh3DVec(PbIndexedMesh3D *mesh) ;
00394 void tetrahedronMesh3DVec(PbTetrahedronMesh3D *mesh) ;
00395 void hexahedronMesh3DVec(PbHexahedronMesh3D *mesh) ;
00396 void cartGrid3DVec(PbCartesianGrid3D *mesh) ;
00397 void paralCartGrid3DVec(PbParalCartesianGrid3D *mesh) ;
00398 void regularGrid3DVec(PbRegularCartesianGrid3D *mesh) ;
00399
00400 private:
00401 virtual ~PoMesh3DVec() ;
00402
00403
00404
00405 virtual SbBool setUpConnections(SbBool onOff, SbBool doItAlways = FALSE) ;
00406 virtual void setDefaultOnNonWritingFields();
00407 virtual void addElementsAllCaches() ;
00408 virtual void preRebuild();
00409
00410 void addVector(const SbVec3f &orig, const SbVec3f &vec);
00411 void startVectorField();
00412 void finishVectorField();
00413
00414 SoGroup *m_bodyGroupNode, *m_startArrowGroupNode, *m_endArrowGroupNode;
00415
00416 PiArrow *m_arrow;
00417 const float *m_scalarDataSet;
00418 int m_vecIndexToDraw, m_vecIndex;
00419
00420 int m_allocVecPoints, m_allocModuleColr, m_allocScalarColr,
00421 m_allocModuleTransparencies, m_allocScalarTransparencies,
00422 m_numVecP, m_numVec;
00423 float (*m_vecPoints)[3];
00424 float (*m_moduleColr)[3];
00425 float (*m_scalarColr)[3];
00426 float *m_moduleTransparencies, *m_scalarTransparencies;
00427
00428
00429 private:
00430
00431 void drawVectorLine(int nod_index);
00432
00433 void drawVectorLineScalarColr(int nod_index);
00434 void drawVectorLineScalarTranspColr(int nod_index);
00435
00436 void drawVectorLineModuleColr(int nod_index);
00437 void drawVectorLineModuleTranspColr(int nod_index);
00438
00439 void drawVectorLineScalarModuleColr(int nod_index);
00440 void drawVectorLineScalarModuleTranspColr(int nod_index);
00441
00442 void drawVectorElaborated(int nod_index);
00443
00444 void finishQuickVectorField();
00445 void finishElaboratedVectorField();
00446 void buildVectorFieldBodies();
00447 void buildVectorFieldStartArrow();
00448 void buildVectorFieldEndArrow();
00449
00450 void (PoMesh3DVec::*drawVector)(int nod_index);
00451 void (PoMesh3DVec::*finishVectorFieldPtr)();
00452
00453
00454 FieldSensorList m_fieldSensorList ;
00455
00456
00457 SoFieldList m_fieldList ;
00458
00459 SbVec3f m_arrowPoints[2];
00460 float m_vecLength, m_arrowLength;
00461
00462 ArrowColoringType m_bodyColoringType, m_startArrowColoringType, m_endArrowColoringType;
00463 } ;
00464
00465
00466
00467 #endif
00468
00469
00470
00471