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_MESHCONTOURING_
00025 #define _PO_MESHCONTOURING_
00026
00027 #include <MeshViz/3Ddata/PoMesh2D.h>
00028 #include <MeshViz/graph/PbNumericDisplayFormat.h>
00029 #include <MeshViz/graph/PbMiscTextAttr.h>
00030
00031 #include <Inventor/projection/SbProjection.h>
00032
00033 #include <Inventor/fields/SoSFEnum.h>
00034 #include <Inventor/fields/SoSFFloat.h>
00035 #include <Inventor/fields/SoSFUShort.h>
00036 #include <Inventor/fields/SoSFBool.h>
00037 #include <Inventor/fields/SoMFVec2f.h>
00038
00106 class PoMeshContouring : public PoMesh2D {
00107
00108 SO_KIT_HEADER(PoMeshContouring) ;
00109
00110
00111 SO_KIT_CATALOG_ENTRY_HEADER(transform) ;
00112
00113 SO_KIT_CATALOG_ENTRY_HEADER(majorContourLineSep) ;
00114 SO_KIT_CATALOG_ENTRY_HEADER(majorContourLineApp) ;
00115 SO_KIT_CATALOG_ENTRY_HEADER(majorContourLine) ;
00116
00117 SO_KIT_CATALOG_ENTRY_HEADER(minorContourLineSep) ;
00118 SO_KIT_CATALOG_ENTRY_HEADER(minorContourLineApp) ;
00119 SO_KIT_CATALOG_ENTRY_HEADER(minorContourLine) ;
00120
00121 SO_KIT_CATALOG_ENTRY_HEADER(annotBackgroundSep) ;
00122 SO_KIT_CATALOG_ENTRY_HEADER(annotBackgroundApp) ;
00123 SO_KIT_CATALOG_ENTRY_HEADER(annotBackground) ;
00124
00125 SO_KIT_CATALOG_ENTRY_HEADER(annotBackgroundBorderSep) ;
00126 SO_KIT_CATALOG_ENTRY_HEADER(annotBackgroundBorderApp) ;
00127 SO_KIT_CATALOG_ENTRY_HEADER(annotBackgroundBorder) ;
00128
00129 SO_KIT_CATALOG_ENTRY_HEADER(annotTextSep) ;
00130 SO_KIT_CATALOG_ENTRY_HEADER(annotTextApp) ;
00131 SO_KIT_CATALOG_ENTRY_HEADER(annotText) ;
00132
00133
00134 public:
00135
00139 PoMeshContouring() ;
00140
00144 virtual void rebuild() ;
00145
00149 enum AnnotPath {
00153 TANGENTIAL_PATH,
00157 HORIZONTAL_PATH,
00161 VERTICAL_PATH
00162 } ;
00163
00164
00165
00169 enum AnnotCrossStatus {
00173 CROSS_CONTOUR,
00177 CROSS_MINOR_CONTOUR,
00181 DONT_CROSS_CONTOUR
00182 } ;
00183
00184
00185
00191 SoSFUShort majorPeriod ;
00192
00197 SoSFUShort firstMajor ;
00198
00203 SoSFBool annotIsVisible ;
00204
00213 SoSFEnum annotPath ;
00214
00226 SoSFEnum annotCrossStatus ;
00227
00231 SoSFBool annotIsBackground ;
00232
00237 SoSFBool annotIsContourClip ;
00238
00248 SoSFFloat annotGap ;
00249
00256 SoMFVec2f annotClippingPolygon ;
00257
00268 SoSFFloat annotFontSize ;
00269
00276 SoSFFloat annotFontFactor;
00277
00283 void setFormat(PbNumericDisplayFormat *format) ;
00284
00288 const PbNumericDisplayFormat *getFormat() const;
00289
00295 void setMiscTextAttr(PbMiscTextAttr *textAttr) ;
00296
00300 const PbMiscTextAttr* getMiscTextAttr() const;
00301
00302
00303 private:
00304 struct Parallelogram3 { Ppoint3 points[5] ; } ;
00305
00306 static void initClass() ;
00307 static void exitClass() ;
00308
00309 private:
00310
00311
00312
00313 virtual ~PoMeshContouring() ;
00314 virtual void basicObjectChange(PbBase *basicObj) ;
00315 virtual void setDefaultOnNonWritingFields();
00316 virtual void addElementsAllCaches() ;
00317 virtual void preRebuild();
00318 virtual SbBool setUpConnections(SbBool onOff, SbBool doItAlways = FALSE) ;
00319
00320 const PbMiscTextAttr *m_miscTextAttr;
00321 const PbNumericDisplayFormat *m_format;
00322
00323
00324 SbProjection *m_projection, m_defaultProjection;
00325
00329 const SbProjection* getProjection() const ;
00330
00331
00332 private:
00333 struct StoreAnnotSpace {
00334 Parallelogram3 space ;
00335 float isovalue ;
00336 Plimit bbox ;
00337 } ;
00338
00339
00340 FieldSensorList m_fieldSensorList ;
00341
00342 SoMFVec2f m_annotClippingPolygon ;
00343
00344
00345 SoFieldList m_fieldList ;
00346
00347 PbMiscTextAttr *m_miscTextAttrSet, m_defaultMiscTextAttr ;
00348 PbNumericDisplayFormat *m_formatSet, m_defaultFormat ;
00349
00350 void getMeshLimit(Ppoint_list_list3 &limit);
00351 void freeMeshLimit(Ppoint_list_list3 &limit);
00352
00353
00354
00355
00356
00357
00358 SbBool isAvailableAnnotArea(const StoreAnnotSpace *occuped_annot_space,
00359 int nb_annot, const Plimit *annot_space) ;
00360
00361
00362 void calculateAnnotBox(const Ppoint3 *p_center, const Ppoint3 *pt_inter_circle1,
00363 const Ppoint3 *pt_inter_circle2, float annot_width,
00364 float annot_height, Ppoint *annot_space,
00365 Ppoint *annot_space_with_margin) ;
00366
00367
00368 void drawAnnotation(const char *annot_str, const Ppoint3 *annot_pos,
00369 const Ppoint3 *annot_space, SoCoordinate3 *backgroundCoords,
00370 SoCoordinate3 *backgroundBorderCoords) ;
00371
00372
00373 SbBool isIntersAnnotContourLines(const Tisoline_list *contourLinesList,
00374 const Ppoint_list3 *currentContourLine,
00375 const Plimit *annotBBox,
00376 const Ppoint *annot_space, float isovalue) ;
00377
00378
00379 void searchUpperLowerIsoval(const Tisoline_list *contourLineList, SbBool isMinThreshold,
00380 SbBool isMaxThreshold) ;
00381
00382
00383 void clipContourLinesByAnnot(SbBool isMajor, SbBool is3DContourLines,
00384 const Tisoline_list *contourLineList,
00385 const StoreAnnotSpace *occuped_annot_space,
00386 int nb_annot) ;
00387
00388
00389 SbBool annotWithinClipPolygon(const Ppoint *annot_space, const Plimit *annotBBox,
00390 const Plimit *clipPolygBBox) ;
00391
00392
00393 void computeContourLineAnnot(const Tisoline_list *majorContourLineList,
00394 const Tisoline_list *minorContourLineList,
00395 const Tisoline_list *allContourLineList,
00396 const Ppoint_list_list3 *mesh_contour,
00397 SbBool is3DContourLines, SbBool work_in_wc_flag) ;
00398
00399
00400 void drawContourLines(Tisoline_list *contourLinesList,
00401 const Ppoint_list_list3 *meshLimit) ;
00402 } ;
00403
00404
00405
00406 #endif
00407
00408