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
00105 class PoMeshContouring : public PoMesh2D {
00106
00107 SO_KIT_HEADER(PoMeshContouring) ;
00108
00109
00110 SO_KIT_CATALOG_ENTRY_HEADER(transform) ;
00111
00112 SO_KIT_CATALOG_ENTRY_HEADER(majorContourLineSep) ;
00113 SO_KIT_CATALOG_ENTRY_HEADER(majorContourLineApp) ;
00114 SO_KIT_CATALOG_ENTRY_HEADER(majorContourLine) ;
00115
00116 SO_KIT_CATALOG_ENTRY_HEADER(minorContourLineSep) ;
00117 SO_KIT_CATALOG_ENTRY_HEADER(minorContourLineApp) ;
00118 SO_KIT_CATALOG_ENTRY_HEADER(minorContourLine) ;
00119
00120 SO_KIT_CATALOG_ENTRY_HEADER(annotBackgroundSep) ;
00121 SO_KIT_CATALOG_ENTRY_HEADER(annotBackgroundApp) ;
00122 SO_KIT_CATALOG_ENTRY_HEADER(annotBackground) ;
00123
00124 SO_KIT_CATALOG_ENTRY_HEADER(annotBackgroundBorderSep) ;
00125 SO_KIT_CATALOG_ENTRY_HEADER(annotBackgroundBorderApp) ;
00126 SO_KIT_CATALOG_ENTRY_HEADER(annotBackgroundBorder) ;
00127
00128 SO_KIT_CATALOG_ENTRY_HEADER(annotTextSep) ;
00129 SO_KIT_CATALOG_ENTRY_HEADER(annotTextApp) ;
00130 SO_KIT_CATALOG_ENTRY_HEADER(annotText) ;
00131
00132
00133 public:
00134
00138 PoMeshContouring() ;
00139
00143 virtual void rebuild() ;
00144
00148 enum AnnotPath {
00152 TANGENTIAL_PATH,
00156 HORIZONTAL_PATH,
00160 VERTICAL_PATH
00161 } ;
00162
00163
00164
00168 enum AnnotCrossStatus {
00172 CROSS_CONTOUR,
00176 CROSS_MINOR_CONTOUR,
00180 DONT_CROSS_CONTOUR
00181 } ;
00182
00183
00184
00190 SoSFUShort majorPeriod ;
00191
00196 SoSFUShort firstMajor ;
00197
00202 SoSFBool annotIsVisible ;
00203
00212 SoSFEnum annotPath ;
00213
00225 SoSFEnum annotCrossStatus ;
00226
00230 SoSFBool annotIsBackground ;
00231
00236 SoSFBool annotIsContourClip ;
00237
00247 SoSFFloat annotGap ;
00248
00255 SoMFVec2f annotClippingPolygon ;
00256
00267 SoSFFloat annotFontSize ;
00268
00275 SoSFFloat annotFontFactor;
00276
00282 void setFormat(PbNumericDisplayFormat *format) ;
00283
00287 const PbNumericDisplayFormat *getFormat() const;
00288
00294 void setMiscTextAttr(PbMiscTextAttr *textAttr) ;
00295
00299 const PbMiscTextAttr* getMiscTextAttr() const;
00300
00301
00302 private:
00303 struct Parallelogram3 { Ppoint3 points[5] ; } ;
00304
00305 static void initClass() ;
00306 static void exitClass() ;
00307
00308 private:
00309
00310
00311
00312 virtual ~PoMeshContouring() ;
00313 virtual void basicObjectChange(PbBase *basicObj) ;
00314 virtual void setDefaultOnNonWritingFields();
00315 virtual void addElementsAllCaches() ;
00316 virtual void preRebuild();
00317 virtual SbBool setUpConnections(SbBool onOff, SbBool doItAlways = FALSE) ;
00318
00319 const PbMiscTextAttr *m_miscTextAttr;
00320 const PbNumericDisplayFormat *m_format;
00321
00322
00323 SbProjection *m_projection, m_defaultProjection;
00324
00328 const SbProjection* getProjection() const ;
00329
00330
00331 private:
00332 struct StoreAnnotSpace {
00333 Parallelogram3 space ;
00334 float isovalue ;
00335 Plimit bbox ;
00336 } ;
00337
00338
00339 FieldSensorList m_fieldSensorList ;
00340
00341 SoMFVec2f m_annotClippingPolygon ;
00342
00343
00344 SoFieldList m_fieldList ;
00345
00346 PbMiscTextAttr *m_miscTextAttrSet, m_defaultMiscTextAttr ;
00347 PbNumericDisplayFormat *m_formatSet, m_defaultFormat ;
00348
00349 void getMeshLimit(Ppoint_list_list3 &limit);
00350 void freeMeshLimit(Ppoint_list_list3 &limit);
00351
00352
00353
00354
00355
00356
00357 SbBool isAvailableAnnotArea(const StoreAnnotSpace *occuped_annot_space,
00358 int nb_annot, const Plimit *annot_space) ;
00359
00360
00361 void calculateAnnotBox(const Ppoint3 *p_center, const Ppoint3 *pt_inter_circle1,
00362 const Ppoint3 *pt_inter_circle2, float annot_width,
00363 float annot_height, Ppoint *annot_space,
00364 Ppoint *annot_space_with_margin) ;
00365
00366
00367 void drawAnnotation(const char *annot_str, const Ppoint3 *annot_pos,
00368 const Ppoint3 *annot_space, SoCoordinate3 *backgroundCoords,
00369 SoCoordinate3 *backgroundBorderCoords) ;
00370
00371
00372 SbBool isIntersAnnotContourLines(const Tisoline_list *contourLinesList,
00373 const Ppoint_list3 *currentContourLine,
00374 const Plimit *annotBBox,
00375 const Ppoint *annot_space, float isovalue) ;
00376
00377
00378 void searchUpperLowerIsoval(const Tisoline_list *contourLineList, SbBool isMinThreshold,
00379 SbBool isMaxThreshold) ;
00380
00381
00382 void clipContourLinesByAnnot(SbBool isMajor, SbBool is3DContourLines,
00383 const Tisoline_list *contourLineList,
00384 const StoreAnnotSpace *occuped_annot_space,
00385 int nb_annot) ;
00386
00387
00388 SbBool annotWithinClipPolygon(const Ppoint *annot_space, const Plimit *annotBBox,
00389 const Plimit *clipPolygBBox) ;
00390
00391
00392 void computeContourLineAnnot(const Tisoline_list *majorContourLineList,
00393 const Tisoline_list *minorContourLineList,
00394 const Tisoline_list *allContourLineList,
00395 const Ppoint_list_list3 *mesh_contour,
00396 SbBool is3DContourLines, SbBool work_in_wc_flag) ;
00397
00398
00399 void drawContourLines(Tisoline_list *contourLinesList,
00400 const Ppoint_list_list3 *meshLimit) ;
00401 } ;
00402
00403
00404
00405 #endif
00406
00407