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_MESH2DVEC_
00025 #define _PO_MESH2DVEC_
00026
00027 #include <Inventor/SbLinear.h>
00028 #include <MeshViz/3Ddata/PoMesh2D.h>
00029
00030 class PiArrow;
00031 class PbCartesianGrid2D;
00032 class PbGrid2D;
00033 class PbIndexedMesh2D;
00034 class PbMesh2D;
00035 class PbParalCartesianGrid2D;
00036 class PbRegularCartesianGrid2D;
00037 class PbPolarGrid2D;
00038
00097 class PoMesh2DVec : public PoMesh2D {
00098
00099 SO_KIT_HEADER(PoMesh2DVec) ;
00100
00101
00102 SO_KIT_CATALOG_ENTRY_HEADER(bodySep);
00103 SO_KIT_CATALOG_ENTRY_HEADER(bodyApp);
00104 SO_KIT_CATALOG_ENTRY_HEADER(bodyGroup);
00105
00106 SO_KIT_CATALOG_ENTRY_HEADER(startArrowSep);
00107 SO_KIT_CATALOG_ENTRY_HEADER(startArrowApp);
00108 SO_KIT_CATALOG_ENTRY_HEADER(startArrowGroup);
00109
00110 SO_KIT_CATALOG_ENTRY_HEADER(endArrowSep);
00111 SO_KIT_CATALOG_ENTRY_HEADER(endArrowApp);
00112 SO_KIT_CATALOG_ENTRY_HEADER(endArrowGroup);
00113
00114
00115 public:
00116
00120 PoMesh2DVec() ;
00121
00125 virtual void rebuild() ;
00126
00130 enum EliminationStatus {
00131 NONE,
00132 TOO_SMALL,
00133 TOO_LONG,
00134 TOO_SMALL_OR_LONG
00135 } ;
00136
00137
00138
00142 enum BodyShape {
00143 NO_BODY,
00144 LINE,
00145 CYLINDER
00146 } ;
00147
00148
00149
00153 enum BodyLengthType {
00154 CONSTANT_LENGTH,
00155 RELATIVE_LENGTH
00156 } ;
00157
00158
00159
00163 enum BodyRadiusType {
00164 CONSTANT_RADIUS,
00165 RELATIVE_RADIUS
00166 } ;
00167
00168
00169
00173 enum ArrowShape {
00174 NO_SHAPE,
00175 POINT,
00176 CHEVRON,
00177 TRIANGLE,
00178 RECTANGLE,
00179 CONE,
00180 BOX,
00181 SPHERE,
00182 INDIRECT_CHEVRON,
00183 INDIRECT_TRIANGLE,
00184 INDIRECT_CONE
00185 } ;
00186
00187
00188
00192 enum ArrowHeightType {
00193 CONSTANT_HEIGHT,
00194 RELATIVE_HEIGHT
00195 } ;
00196
00197
00198
00202 enum ArrowColoringType {
00203 CONSTANT_COLOR,
00204 MODULE_MAPPING_COLOR,
00205 SCALAR_MAPPING_COLOR
00206 } ;
00207
00208
00209
00210
00211
00216 SoSFInt32 density;
00217
00226 SoSFEnum eliminationStatus;
00227
00232 SoSFFloat minLength;
00233
00238 SoSFFloat maxLength;
00239
00240
00241
00242
00243
00248 SoSFEnum bodyShape;
00249
00255 SoSFEnum bodyLengthType;
00256
00260 SoSFFloat bodyLengthFactor;
00261
00270 SoSFEnum bodyRadiusType;
00271
00275 SoSFFloat bodyRadiusFactor;
00276
00294 SoSFEnum bodyColoringType;
00295
00296
00297
00298
00299
00304 SoSFEnum startArrowShape;
00305
00313 SoSFEnum startArrowHeightType;
00314
00318 SoSFFloat startArrowHeightFactor;
00319
00323 SoSFFloat startArrowRadiusFactor;
00324
00341 SoSFEnum startArrowColoringType;
00342
00343
00344
00345
00346
00351 SoSFEnum endArrowShape;
00352
00360 SoSFEnum endArrowHeightType;
00361
00365 SoSFFloat endArrowHeightFactor;
00366
00370 SoSFFloat endArrowRadiusFactor;
00371
00388 SoSFEnum endArrowColoringType;
00389
00390
00391 private:
00392 static void initClass() ;
00393 static void exitClass() ;
00394
00395 void indexedMesh2DVec(PbIndexedMesh2D *mesh) ;
00396 void cartGrid2DVec(PbCartesianGrid2D *mesh) ;
00397 void paralCartGrid2DVec(PbParalCartesianGrid2D *mesh) ;
00398 void regularCartGrid2DVec(PbRegularCartesianGrid2D *mesh) ;
00399 void polarGrid2DVec(PbPolarGrid2D *mesh) ;
00400
00401 private:
00402 virtual ~PoMesh2DVec() ;
00403
00404
00405
00406 virtual SbBool setUpConnections(SbBool onOff, SbBool doItAlways = FALSE) ;
00407 virtual void setDefaultOnNonWritingFields();
00408 virtual void addElementsAllCaches() ;
00409 virtual void preRebuild();
00410
00411 void addVector(const SbVec3f &orig, const SbVec3f &vec);
00412 void startVectorField();
00413 void finishVectorField();
00414
00415 SoGroup *m_bodyGroupNode, *m_startArrowGroupNode, *m_endArrowGroupNode;
00416
00417 PiArrow *m_arrow;
00418 const float *m_scalarDataSet;
00419 int m_vecIndexToDraw, m_vecIndex;
00420
00421 int m_allocVecPoints, m_allocModuleColr, m_allocScalarColr,
00422 m_allocModuleTransparencies, m_allocScalarTransparencies,
00423 m_numVecP, m_numVec;
00424 float (*m_vecPoints)[3];
00425 float (*m_moduleColr)[3];
00426 float (*m_scalarColr)[3];
00427 float *m_moduleTransparencies, *m_scalarTransparencies;
00428
00429
00430 private:
00431
00432 void drawVectorLine(int nod_index);
00433
00434 void drawVectorLineScalarColr(int nod_index);
00435 void drawVectorLineScalarTranspColr(int nod_index);
00436
00437 void drawVectorLineModuleColr(int nod_index);
00438 void drawVectorLineModuleTranspColr(int nod_index);
00439
00440 void drawVectorLineScalarModuleColr(int nod_index);
00441 void drawVectorLineScalarModuleTranspColr(int nod_index);
00442
00443 void drawVectorElaborated(int nod_index);
00444
00445 void finishQuickVectorField();
00446 void finishElaboratedVectorField();
00447 void buildVectorFieldBodies();
00448 void buildVectorFieldStartArrow();
00449 void buildVectorFieldEndArrow();
00450
00451 void (PoMesh2DVec::*drawVector)(int nod_index);
00452 void (PoMesh2DVec::*finishVectorFieldPtr)();
00453
00454
00455 FieldSensorList m_fieldSensorList ;
00456
00457
00458 SoFieldList m_fieldList ;
00459
00460 SbVec3f m_arrowPoints[2];
00461 float m_vecLength, m_arrowLength;
00462
00463 ArrowColoringType m_bodyColoringType, m_startArrowColoringType, m_endArrowColoringType;
00464 } ;
00465
00466
00467
00468 #endif
00469
00470
00471
00472