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_LABEL_FIELD_
00025 #define  _PO_LABEL_FIELD_
00026 
00027 #include <MeshViz/graph/PoGraphMaster.h>
00028 
00029 #include <Inventor/fields/SoSFEnum.h>
00030 #include <Inventor/fields/SoSFFloat.h>
00031 #include <Inventor/fields/SoMFFloat.h>
00032 #include <Inventor/fields/SoMFVec2f.h>
00033 #include <Inventor/fields/SoMFString.h>
00034 
00035 class PbNumericDisplayFormat ;
00036 
00037 
00072 class  PoLabelField : public PoGraphMaster {
00073   
00074   SO_KIT_HEADER(PoLabelField) ;
00075   
00076   
00077   SO_KIT_CATALOG_ENTRY_HEADER(transform) ;
00078   SO_KIT_CATALOG_ENTRY_HEADER(labelField) ;
00079 
00080 
00081  public:
00082 
00083   enum Justification {
00087     LEFT,   
00091     RIGHT,  
00095     CENTER  
00096   } ;
00097 
00098   
00099 
00100   enum VerticalJustification {
00104     TOP,    
00108     CAP,    
00112     HALF,   
00116     BASE,   
00120     BOTTOM  
00121   } ;
00122 
00123 
00124 
00128   enum CoordinateType {
00132     COORDINATE_IN_DOMAIN,       
00136     COORDINATE_IN_CURRENT_UNIT  
00137   } ;
00138 
00142   enum ConcatType {
00146     STRING_BEFORE_VALUE, 
00150     VALUE_BEFORE_STRING, 
00154     STRING_ABOVE_VALUE,  
00158     VALUE_ABOVE_STRING   
00159   } ;
00160 
00161 
00162 
00163   
00164 
00168   SoMFVec2f  point ;
00169 
00174   SoMFString string ;
00175 
00182   SoMFFloat  value ;
00183 
00187   SoSFEnum   concatType ;
00188 
00192   SoSFFloat  fontSize ;
00193 
00197   SoSFEnum   justification ;
00198 
00203   SoSFEnum   verticalJustification ;
00204 
00213   SoSFEnum   coordinateType ;
00214 
00215   
00216 
00220   PoLabelField()
00221     { init(TRUE) ; }
00222 
00227   PoLabelField(int numPoints, const SbVec2f *_point, const char **_string, 
00228                const float *_value, float _fontSize, 
00229                ConcatType type = STRING_BEFORE_VALUE, Justification _justification 
00230                = LEFT, VerticalJustification _verticalJustification = BASE)
00231     { init(FALSE, numPoints, _point, _string, _value, _fontSize, type, _justification, 
00232            _verticalJustification) ; } 
00233 
00241   void setFormat(PbNumericDisplayFormat *format) ;
00242 
00247   const PbNumericDisplayFormat *getFormat() const ;
00248 
00252   virtual void rebuild() ;
00253 
00254   
00255  private:
00256   static void initClass() ;
00257     static void exitClass() ;
00258 
00259  private:
00260   
00261   
00262   virtual ~PoLabelField() ;
00263   virtual void   setDefaultOnNonWritingFields() ;
00264   virtual SbBool setUpConnections(SbBool onOff, SbBool doItAlways = FALSE) ;
00265 
00266   
00267   virtual void basicObjectChange(PbBase *basicObj) ;
00268 
00269   
00270   virtual void addElementsAllCaches() ;
00271   virtual void preRebuild() ;
00272   
00273  private:
00274   
00275   void init(SbBool isDefault, int numPoints=0, const SbVec2f *_point=NULL, 
00276             const char **_string=NULL, 
00277             const float *_value=NULL, float _fontSize=1.0, 
00278             ConcatType type = STRING_BEFORE_VALUE, Justification _justification 
00279             = LEFT, VerticalJustification _verticalJustification = BASE) ;
00280 
00281   
00282   PbNumericDisplayFormat *m_numericDisplayFormat, *m_defaultNumericDisplayFormat ;
00283 
00284   
00285   FieldSensorList m_fieldSensorList ;
00286   
00287   
00288   SoFieldList     m_fieldList ;
00289 
00290 } ;
00291 
00292 
00293 
00294 #endif 
00295 
00296