Open Inventor Release 2024.2.1
 
Loading...
Searching...
No Matches
PoMeshContouring.h
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2014 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : VSG (MMM YYYY)
22**=======================================================================*/
23
24#ifndef _PO_MESHCONTOURING_
25#define _PO_MESHCONTOURING_
26
27#include <MeshViz/3Ddata/PoMesh2D.h>
28#include <MeshViz/graph/PbNumericDisplayFormat.h>
29#include <MeshViz/graph/PbMiscTextAttr.h>
30
31#include <Inventor/projection/SbProjection.h>
32
33#include <Inventor/fields/SoSFEnum.h>
34#include <Inventor/fields/SoSFFloat.h>
35#include <Inventor/fields/SoSFUShort.h>
36#include <Inventor/fields/SoSFBool.h>
37#include <Inventor/fields/SoMFVec2f.h>
38
106
107 SO_KIT_HEADER(PoMeshContouring) ;
108
109 /* Define fields for new parts */
110 SO_KIT_CATALOG_ENTRY_HEADER(transform) ;
111
112 SO_KIT_CATALOG_ENTRY_HEADER(majorContourLineSep) ;
113 SO_KIT_CATALOG_ENTRY_HEADER(majorContourLineApp) ;
114 SO_KIT_CATALOG_ENTRY_HEADER(majorContourLine) ;
115
116 SO_KIT_CATALOG_ENTRY_HEADER(minorContourLineSep) ;
117 SO_KIT_CATALOG_ENTRY_HEADER(minorContourLineApp) ;
118 SO_KIT_CATALOG_ENTRY_HEADER(minorContourLine) ;
119
120 SO_KIT_CATALOG_ENTRY_HEADER(annotBackgroundSep) ;
121 SO_KIT_CATALOG_ENTRY_HEADER(annotBackgroundApp) ;
122 SO_KIT_CATALOG_ENTRY_HEADER(annotBackground) ;
123
124 SO_KIT_CATALOG_ENTRY_HEADER(annotBackgroundBorderSep) ;
125 SO_KIT_CATALOG_ENTRY_HEADER(annotBackgroundBorderApp) ;
126 SO_KIT_CATALOG_ENTRY_HEADER(annotBackgroundBorder) ;
127
128 SO_KIT_CATALOG_ENTRY_HEADER(annotTextSep) ;
129 SO_KIT_CATALOG_ENTRY_HEADER(annotTextApp) ;
130 SO_KIT_CATALOG_ENTRY_HEADER(annotText) ;
131
132
133 public:
134
139
143 virtual void rebuild() ;
144
162
163
164
182
183
184
191
197
203
213
226
231
237
248
256
268
276
283
288
295
300
301 /*----------------------------------------------------------------------------*/
302 private:
303 struct Parallelogram3 { Ppoint3 points[5] ; } ;
304
305 static void initClass() ;
306 static void exitClass() ;
307
308 private:
309 // Methods
310
311 // Destructor
312 virtual ~PoMeshContouring() ;
313 virtual void basicObjectChange(PbBase *basicObj) ;
314 virtual void setDefaultOnNonWritingFields();
315 virtual void addElementsAllCaches() ;
316 virtual void preRebuild();
317 virtual SbBool setUpConnections(SbBool onOff, SbBool doItAlways = FALSE) ;
318
319 const PbMiscTextAttr *m_miscTextAttr;
320 const PbNumericDisplayFormat *m_format;
321
322 // Projection to apply
323 SbProjection *m_projection, m_defaultProjection;
324
328 const SbProjection* getProjection() const ;
329
330 /*----------------------------------------------------------------------------*/
331 private:
332 struct StoreAnnotSpace {
333 Parallelogram3 space ; // Coords of the annotation
334 float isovalue ; // Value of the annotation
335 Plimit bbox ; // Bounding box of the annotation
336 } ;
337
338 // Sensors
339 FieldSensorList m_fieldSensorList ;
340
341 SoMFVec2f m_annotClippingPolygon ;
342
343 // List of fields defined in this class
344 SoFieldList m_fieldList ;
345
346 PbMiscTextAttr *m_miscTextAttrSet, m_defaultMiscTextAttr ;
347 PbNumericDisplayFormat *m_formatSet, m_defaultFormat ;
348
349 void getMeshLimit(Ppoint_list_list3 &limit);
350 void freeMeshLimit(Ppoint_list_list3 &limit);
351
352 //**************************************************************************
353 //* All following methods are used to build annotations of contour lines *
354 //**************************************************************************
355
356 // Determine if the place (annot_space) of the annotation is available.
357 SbBool isAvailableAnnotArea(const StoreAnnotSpace *occuped_annot_space,
358 int nb_annot, const Plimit *annot_space) ;
359
360 // Compute the coordinates of the parallelogram of an annotation
361 void calculateAnnotBox(const Ppoint3 *p_center, const Ppoint3 *pt_inter_circle1,
362 const Ppoint3 *pt_inter_circle2, float annot_width,
363 float annot_height, Ppoint *annot_space,
364 Ppoint *annot_space_with_margin) ;
365
366 // Generate shapes to draw the annotations
367 void drawAnnotation(const char *annot_str, const Ppoint3 *annot_pos,
368 const Ppoint3 *annot_space, SoCoordinate3 *backgroundCoords,
369 SoCoordinate3 *backgroundBorderCoords) ;
370
371 // Determine if an annotation intersects other contour lines
372 SbBool isIntersAnnotContourLines(const Tisoline_list *contourLinesList,
373 const Ppoint_list3 *currentContourLine,
374 const Plimit *annotBBox,
375 const Ppoint *annot_space, float isovalue) ;
376
377 // Determine undefined values inferior and superior.
378 void searchUpperLowerIsoval(const Tisoline_list *contourLineList, SbBool isMinThreshold,
379 SbBool isMaxThreshold) ;
380
381 // Clip contour lines by annotations
382 void clipContourLinesByAnnot(SbBool isMajor, SbBool is3DContourLines,
383 const Tisoline_list *contourLineList,
384 const StoreAnnotSpace *occuped_annot_space,
385 int nb_annot) ;
386
387 // Determine if an annotation is within polygon of annotation
388 SbBool annotWithinClipPolygon(const Ppoint *annot_space, const Plimit *annotBBox,
389 const Plimit *clipPolygBBox) ;
390
391 // Main method to generate the annotations of contour lines
392 void computeContourLineAnnot(const Tisoline_list *majorContourLineList,
393 const Tisoline_list *minorContourLineList,
394 const Tisoline_list *allContourLineList,
395 const Ppoint_list_list3 *mesh_contour,
396 SbBool is3DContourLines, SbBool work_in_wc_flag) ;
397
398 // Draw contour lines
399 void drawContourLines(Tisoline_list *contourLinesList,
400 const Ppoint_list_list3 *meshLimit) ;
401} ;
402
403/*----------------------------------------------------------------------------*/
404
405#endif /* _PO_MESHCONTOURING_ */
406
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Abstract class for all b...
Definition PbBase.h:49
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Class to define a numeri...
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Class to define a numeri...
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Base class for all surfa...
Definition PoMesh2D.h:53
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Class to build contour l...
AnnotCrossStatus
Controls the annotations of contour lines.
@ DONT_CROSS_CONTOUR
Annotations do not cross any contour lines.
@ CROSS_MINOR_CONTOUR
Annotations may cross only minor contour lines (but not major contour lines).
@ CROSS_CONTOUR
Annotations may cross contour lines.
SoSFFloat annotFontSize
Font size of annotations of contour lines.
const PbNumericDisplayFormat * getFormat() const
Gets the reference to a PbNumericDisplayFormat.
SoSFBool annotIsContourClip
Defines if the contour lines are clipped by the annotations.
SoSFUShort firstMajor
Defines the first major contour lines.
void setMiscTextAttr(PbMiscTextAttr *textAttr)
Sets a reference to PbMiscTextAttr object for miscellaneous text attributes of annotations of contour...
SoSFEnum annotCrossStatus
Controls the annotations and contour lines crossing.
const PbMiscTextAttr * getMiscTextAttr() const
Gets a reference to PbMiscTextAttr object.
PoMeshContouring()
Constructor.
SoSFFloat annotFontFactor
Font size factor of annotations of contour lines.
SoSFUShort majorPeriod
Defines the major and the minor contour lines.
virtual void rebuild()
Forces node-kit rebuilding.
AnnotPath
Type of annotations path.
@ TANGENTIAL_PATH
Annotations are tangential to the contour lines.
@ HORIZONTAL_PATH
Annotations are horizontal.
@ VERTICAL_PATH
Annotations are vertical.
SoSFBool annotIsVisible
Contour lines annotations visibility.
SoMFVec2f annotClippingPolygon
This is a polygon where no annotations are present outside it.
SoSFFloat annotGap
Curvilinear distance between two annotations of a same contour line.
SoSFEnum annotPath
Annotations path.
void setFormat(PbNumericDisplayFormat *format)
Sets a reference to a PbNumericDisplayFormat object for the numerical display format for annotations ...
SoSFBool annotIsBackground
Defines if the annotations are framed by a background.
Base class for coordinate projection classes.
Coordinate point node.
Maintains a list of pointers to fields.
Definition SoFieldList.h:72
Multiple-value field containing any number of two-dimensional vectors.
Definition SoMFVec2f.h:89
Field containing a single Boolean value.
Definition SoSFBool.h:79
Field containing an enumerated value.
Definition SoSFEnum.h:89
Field containing a floating-point value.
Definition SoSFFloat.h:78
Field containing an unsigned short integer.
Definition SoSFUShort.h:79
int SbBool
Boolean type.
Definition SbBase.h:87