Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
PoTimeAxis.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_TIME_AXIS_
25#define _PO_TIME_AXIS_
26
27#include <MeshViz/graph/PoAxis.h>
28#include <MeshViz/graph/PbDateFormatMapping.h>
29#include <MeshViz/graph/PiNumericFormat.h>
30#include <MeshViz/graph/PiDate.h>
31
32
33#include <Inventor/fields/SoSFEnum.h>
34#include <Inventor/fields/SoSFFloat.h>
35#include <Inventor/fields/SoSFString.h>
36#include <Inventor/fields/SoMFString.h>
37
38
40
305class PoTimeAxis : public PoAxis {
306
307 SO_KIT_HEADER(PoTimeAxis) ;
308
309
310 public:
311
333
344
345
346
350 enum Type {
358 Y
359 } ;
360
361 /* Fields */
362
368
374
379
384
389
394
400
407
408 /* Methods */
409
414 { init(TRUE) ; }
415
419 PoTimeAxis(const char *_startDate, const char *_endDate, float _coord,
420 Type _type = X)
421 { init(FALSE, _startDate, _endDate, _coord, _type) ; }
422
426 virtual void rebuild() ;
427
436
442
443 /*----------------------------------------------------------------------------*/
444
445 private:
446
447 static void initClass() ;
448 static void exitClass() ;
449
450 enum Tdate_elem_form {
451 TSECOND,
452 TMINUTE,
453 THOUR,
454 TDAY_NUMBER,
455 TWEEK_DAY,
456 TMONTH_NUMBER,
457 TYEAR_MONTH,
458 TYEAR
459 } ;
460
461 enum Tdate_step {
462 TSTEP_UNKNOWN,
463 TSTEP_SECONDS,
464 TSTEP_MINUTES,
465 TSTEP_HOURS,
466 TSTEP_DAYS,
467 TSTEP_MONTHS,
468 TSTEP_YEARS
469 } ;
470
471 struct Tdate_elem {
472 int form_prefixe; // prefixe du code
473 Tdate_elem_form form; // code calendaire
474 char *append_str; // string commentaire apres le code
475 } ;
476
477
478 struct Tdate_axis_level_rep {
479 Tdate_step step; // unite de pas calendaire du niveau
480 float num_step; // nombre d'unite de pas
481 int ten_power; // puis de 10 pour pas seconde
482 char *append_str; // string commentaire prefixe
483 int num_date_elems; // nb de code cal par graduation
484 Tdate_elem *date_elems; // liste des code calendaire
485 } ;
486
487 struct Tdate_axis_rep {
488 int num_level; // nb de niveaux de l'axe
489 Tdate_axis_level_rep *level_rep; // liste des rep. par niveau
490 } ;
491
492 struct Tdate_interv {
493 float num_units;
494 Tdate_step units;
495 } ;
496
497 struct Tdate_list {
498 int num_dates; // nb d'intervalles de date - 1
499 Tdate_interv *dates; // liste des dates
500 } ;
501
502 private:
503 // Time axis attr
504 struct TimeAxisAttr {
505 PbDateFormatMapping *formatMapping ;
506 PiDate startDate ;
507 PiDate endDate ;
508 PiNumericFormat numericFormat ;
509 Plane plane ;
510 int num_date_limit ;
511 PiDate *date_limit ;
512 int num_rep ;
513 Tdate_axis_rep *date_axis_rep ;
514 } ;
515
516 // Methods
517 // Destructor
518 virtual ~PoTimeAxis() ;
519 virtual SbBool setUpConnections(SbBool onOff, SbBool doItAlways = FALSE) ;
520 virtual void setDefaultOnNonWritingFields() ;
521
522 // Manage the connection with PbBase objects
523 virtual void basicObjectChange(PbBase *basicObj) ;
524
525 // Save all axis attributes which can be modified by MeshViz.
526 virtual void saveAxisAttr() ;
527
528 // Overloaded methods
529 virtual void preRebuild() ;
530 virtual void addElementsAllCaches() ;
531
532 private:
533 // Init method
534 void init(SbBool isDefault, const char *startDate=NULL, const char *endDate=NULL,
535 float coord=0.0, Type type = X) ;
536
537 // Compute axis tranformation
538 void computeTransfo(const SbVec2f &refPoint, SoMatrixTransform *transfo,
539 float &deltaX, float &deltaY) ;
540
541 // Get the date axis representation
542 void getDateAxisRep(const PiDate &date_min, const PiDate &date_max,
543 Tdate_axis_rep &date_rep) ;
544
545 // Copy a date representatiom
546 static void copyDateRep(Tdate_axis_rep &dst_date_rep,
547 const Tdate_axis_rep &src_date_rep) ;
548
549 // Init date step of level 0
550 static void initDateStepOfLevel0(Tdate_axis_rep &date_rep, const PiDate &date_delta) ;
551
552 // Init date element
553 static void initDateElem(Tdate_axis_level_rep &level_rep) ;
554
555 // Init step, the unit step is given
556 static void initDateNumStep(Tdate_axis_level_rep &level_rep, const PiDate &date_delta) ;
557
558 // Free a date axis rep (all fields are free)
559 static void freeDateAxisRep(Tdate_axis_rep &axis_rep) ;
560
561 // Free a list of Tdate_axis_rep
562 static void freeDateAxisRepList(int num_axis_rep, Tdate_axis_rep *axis_rep_list) ;
563
564 // Compute automactic date representation
565 void initAutoRep(const PiDate &date_delta, Tdate_axis_rep &date_rep) ;
566
567 // Choose best date representation from a list of date representation
568 void chooseBestDateRep(int num_rep, const Tdate_axis_rep *rep,
569 const PiDate &date_delta, Tdate_axis_rep &date_rep) ;
570
571 // Get list of graduations
572 void getGradList(const PiDate &date_1, const PiDate &date_2,
573 GradFit grad_fit,
574 const Tdate_axis_level_rep &level_rep,
575 int &num_gradu, char ***gradu_string_list,
576 std::vector<float>& x_gradu_list) ;
577
578 // Get first date graduation
579 void getFirstDateGrad(const PiDate &date_1, const PiDate &date_2,
580 Tdate_step step, float float_step, GradFit
581 grad_fit, PiDate &date_ref) ;
582
583 // Get string associated to a internal date
584 void getStringDate(const PiDate &date, int form_prefixe,
585 Tdate_elem_form form, char *string_date) ;
586
587 // Build date graduations
588 void buildDateGrads(const PiDate &date_1, const PiDate &date_2,
589 const Tdate_axis_rep &date_rep, SoGroup *group) ;
590
591 // Set date axis representation from the two associated fields
592 // gradRep and timesPeriod.
593 void setDateAxisRep() ;
594
595 //--------- All this methods are used for the parser of timesPeriod --------
596 static void parseDateList(char *form, Tdate_list *dl, int *err_ind) ;
597 static void parseDateListNewDate(double num_units, int units) ;
598 static Tdate_list *date_list ;
599 friend int tpdlparse(void);
600 friend int tpdllex(void) ;
601
602 //--------- All this methods are used for the parser of gradRep ------------
603 static void parseAxisRep(char *form, int n_l, Tdate_axis_rep *da_rep,
604 int *err_ind) ;
605 static void parseAxisRepNewLevel(double num_step, int step, char *append_str) ;
606 static void parseAxisRepAddToLevel(int form_prefixe, int form, char *append_str) ;
607 static Tdate_axis_rep *date_axis_rep ;
608 friend int tpaxparse(void) ;
609 friend int tpaxlex(void) ;
610
611 // Computed axis attributes
612 TimeAxisAttr timeAxisAttr ;
613
614 // Date format and mapping
615 PbDateFormatMapping *m_dateFormatMapping, m_defaultDateFormatMapping ;
616
617 // Sensors
618 FieldSensorList fieldSensorList ;
619
620 // List of fields defined in this class
621 SoFieldList fieldList ;
622
623} ;
624
625/*----------------------------------------------------------------------------*/
626
627#endif /* _PO_TIME_AXIS_ */
628
<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> Defines the date format ...
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Abstract class for axis ...
Definition PoAxis.h:58
<a href="IconLegend.html"><img src="extMV.gif" alt="MeshViz" border="0"></a> Class to build a time ax...
Definition PoTimeAxis.h:305
virtual void rebuild()
Forces node-kit rebuilding.
@ GRAD_UNFIT
The first graduation is not in round figures.
Definition PoTimeAxis.h:342
@ GRAD_FIT
The first graduation is in round figures.
Definition PoTimeAxis.h:338
friend int tpaxparse(void)
SoSFEnum gradFit
This flag indicates if the first graduation is in round figures or not.
Definition PoTimeAxis.h:393
friend int tpdlparse(void)
friend int tpaxlex(void)
PoTimeAxis(const char *_startDate, const char *_endDate, float _coord, Type _type=X)
Constructor.
Definition PoTimeAxis.h:419
SoSFEnum type
Axis type.
Definition PoTimeAxis.h:383
SoSFString startDate
Start date of the axis.
Definition PoTimeAxis.h:367
const PbDateFormatMapping * getDateFormatMapping() const
Gets a reference to a PbDateFormatMapping object for the input date format and for the association da...
SoSFString timesPeriod
String containing gradRep.getNum() -1 sub-strings.
Definition PoTimeAxis.h:406
friend int tpdllex(void)
SoSFEnum language
Language of date graduations.
Definition PoTimeAxis.h:388
Language
Language used for date.
Definition PoTimeAxis.h:315
@ ESPANOL
The date graduations are displayed in Spanish.
Definition PoTimeAxis.h:331
@ DEUTSCH
The date graduation are displayed in German.
Definition PoTimeAxis.h:327
@ ENGLISH
The date graduations are displayed in English.
Definition PoTimeAxis.h:319
@ FRANCAIS
The date graduations are displayed in French.
Definition PoTimeAxis.h:323
Type
Axis orientation.
Definition PoTimeAxis.h:350
@ Y
The time axis is a Y-axis.
Definition PoTimeAxis.h:358
@ X
The time axis is a X-axis.
Definition PoTimeAxis.h:354
SoSFString endDate
End date of the axis.
Definition PoTimeAxis.h:373
SoMFString gradRep
List of date representation.
Definition PoTimeAxis.h:399
PoTimeAxis()
Constructor.
Definition PoTimeAxis.h:413
void setDateFormatMapping(PbDateFormatMapping *formatMapping)
Sets a reference to a PbDateFormatMapping object for the input date format and for the association da...
SoSFFloat coord
Abscissa or ordinate of the axis according to the axis type.
Definition PoTimeAxis.h:378
2D vector class.
Definition SbVec.h:76
Maintains a list of pointers to fields.
Definition SoFieldList.h:72
Base class for all group nodes.
Definition SoGroup.h:122
Multiple-value field containing any number of strings.
Definition SoMFString.h:116
Node that specifies a 3D geometric transformation as a matrix.
Field containing an enumerated value.
Definition SoSFEnum.h:89
Field containing a floating-point value.
Definition SoSFFloat.h:78
Field containing a string.
Definition SoSFString.h:117
int SbBool
Boolean type.
Definition SbBase.h:87