Back to index

salome-gui  6.5.0
Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends
DDS_DicItem Class Reference

This class provides an information about datum (phisical characteristic parameter). More...

#include <DDS_DicItem.h>

List of all members.

Classes

struct  UnitData

Public Types

enum  Type {
  String, Float, Integer, List,
  Unknown
}
 Enum describes type of datum value. More...
enum  Data { MinValue = 0x01, MaxValue = 0x02, DefaultValue = 0x04 }
 Enum describes the flags for existance of domain data. More...
typedef TCollection_AsciiString UnitSystem

Public Member Functions

 DDS_DicItem ()
 Constructor.
Standard_EXPORT
TCollection_AsciiString 
GetId () const
 Get the identifier of parameter.
Standard_EXPORT DDS_DicItem::Type GetType () const
 Get the type of parameter.
Standard_EXPORT
TCollection_ExtendedString 
GetLabel () const
 Get the label of the parameter.
Standard_EXPORT
TCollection_ExtendedString 
GetFilter () const
 Get the filter (regular expression) for the parameter values.
Standard_EXPORT
TCollection_ExtendedString 
GetRequired () const
 Get the Required attribute of the parameter.
Standard_EXPORT DDS_MsgType GetWarningLevel () const
 Get the wrong value warning level of the parameter.
Standard_EXPORT
TCollection_ExtendedString 
GetLongDescription () const
 Get the long description of the parameter.
Standard_EXPORT
TCollection_ExtendedString 
GetShortDescription () const
 Get the short description of the parameter.
Standard_EXPORT
TCollection_AsciiString 
GetComponent () const
 Get the name of the component (parameter owner).
Standard_EXPORT
TCollection_AsciiString 
GetUnits () const
 Get the parameter measure units for active units system.
Standard_EXPORT
TCollection_AsciiString 
GetUnits (const UnitSystem &) const
 Get the parameter measure units for specified units system theSystem.
Standard_EXPORT
TCollection_ExtendedString 
GetDefaultValue () const
 Get the default value of the parameter for active units system.
Standard_EXPORT
TCollection_ExtendedString 
GetDefaultValue (const UnitSystem &) const
 Get the default value of the parameter for specified units system theSystem.
Standard_EXPORT Standard_Real GetMinValue () const
 Get the minimum value of the parameter for active units system.
Standard_EXPORT Standard_Real GetMinValue (const UnitSystem &) const
 Get the minimum value of the parameter for the specified units system theSystem.
Standard_EXPORT Standard_Real GetMaxValue () const
 Get the maximum value of the parameter for active units system.
Standard_EXPORT Standard_Real GetMaxValue (const UnitSystem &) const
 Get the maximum value of the parameter for specified units system theSystem.
Standard_EXPORT Standard_Integer GetPrecision () const
 Get the precision (number of digits after decimal point) of the parameter for active units system.
Standard_EXPORT Standard_Integer GetPrecision (const UnitSystem &) const
 Get the precision (number of digits after decimal point) of the parameter for specified units system theSystem.
Standard_EXPORT
TCollection_AsciiString 
GetFormat (const Standard_Boolean=Standard_True) const
 Get the format string of the parameter for active units system.
Standard_EXPORT
TCollection_AsciiString 
GetFormat (const UnitSystem &, const Standard_Boolean=Standard_True) const
 Get the format string of the parameter for specified units system theSystem.
Standard_EXPORT
TCollection_ExtendedString 
GetNameOfValues () const
 Get the name of a list referenced by the parameter.
Standard_EXPORT Standard_Boolean GetListOfValues (Handle(TColStd_HArray1OfExtendedString)&, Handle(TColStd_HArray1OfInteger)&) const
 Get item names and item identifiers of a list referenced by the parameter.
Standard_EXPORT Standard_Boolean GetListOfValues (Handle(TColStd_HArray1OfExtendedString)&, Handle(TColStd_HArray1OfInteger)&, Handle(TColStd_HArray1OfExtendedString)&) const
 Get item names, item identifiers and item icons of a list referenced by the parameter.
Standard_EXPORT Standard_Boolean GetSpecialValues (TColStd_MapOfReal &) const
 Get special values of the parameter.
Standard_EXPORT Standard_Real GetMinZoom () const
 Get minimum value of lateral zooming.
Standard_EXPORT Standard_Real GetMaxZoom () const
 Get maximum value of lateral zooming.
Standard_EXPORT Standard_Real GetZoomOrder () const
 Get order of lateral zooming.
Standard_EXPORT Standard_Real ToSI (const Standard_Real) const
 Convert value theVal to the default SI units according to the active units system.
Standard_EXPORT Standard_Real FromSI (const Standard_Real) const
 Convert value theVal from the default SI units according to the active units system.
Standard_EXPORT Standard_Real ToSI (const Standard_Real, const UnitSystem &) const
 Convert value to the default SI units according to the units system theUnitsSystem.
Standard_EXPORT Standard_Real FromSI (const Standard_Real, const UnitSystem &) const
 Convert value from the default SI units according to the units system theUnitsSystem.
Standard_EXPORT Standard_Boolean HasData (const Standard_Integer) const
 Check data existence.
Standard_EXPORT
TCollection_ExtendedString 
GetOption (const TCollection_AsciiString &) const
 Get option for specified name name.
Standard_EXPORT Standard_Boolean GetOptionNames (TColStd_SequenceOfAsciiString &) const
 Get names of all existing options.

Private Types

typedef NCollection_DataMap
< TCollection_AsciiString,
TCollection_ExtendedString > 
OptionsMap

Private Member Functions

 DDS_DicItem (const DDS_DicItem &)
 Copy constructor (put in private section to prevent object copying).
void operator= (const DDS_DicItem &)
 Assignment operator (put in private section to prevent object copying).
void FillDataMap (TCollection_AsciiString, const LDOM_Element &, const LDOM_Element &, const LDOM_Element &, const TColStd_SequenceOfAsciiString &)
 Parse record from XML file and retrieve information relevant for the dictionary item.
void PrepareFormats (const TCollection_AsciiString &)
 Prepare formats for all units systems.
void GetDefaultFormat ()
 Restore default formats for all the units systems.
UnitSystem GetActiveUnitSystem () const
 Get the active units system.
void GetStringFormat (const TCollection_AsciiString &, const TCollection_AsciiString &, const TCollection_AsciiString &, const TCollection_AsciiString &, TCollection_AsciiString &)
 Get format for the string.
void GetIntegerFormat (const TCollection_AsciiString &, const TCollection_AsciiString &, const TCollection_AsciiString &, const TCollection_AsciiString &, const Standard_Character, TCollection_AsciiString &)
 Get format for the integer.
void GetFloatFormat (const TCollection_AsciiString &, const TCollection_AsciiString &, const TCollection_AsciiString &, const TCollection_AsciiString &, const Standard_Character, TCollection_AsciiString &)
 Returns format for the float.
void Split (const TCollection_AsciiString &, Handle(TColStd_HArray1OfExtendedString)&)
 Split the string theStr separated by spaces.
UnitDataGetUnitData (const UnitSystem &) const
 Get units structure for specified units system sys.
 Handle (TColStd_HArray1OfExtendedString) myListRef
 Handle (TColStd_HArray1OfInteger) myListRefID
 Handle (TColStd_HArray1OfExtendedString) myListRefIcons
 Handle (Standard_Transient) myComponent

Private Attributes

TCollection_AsciiString myId
TCollection_ExtendedString myLabel
TCollection_ExtendedString myFilter
TCollection_ExtendedString myRequired
Standard_Integer myType
Standard_Integer myWarnLevel
TCollection_ExtendedString myLongDescr
TCollection_ExtendedString myShortDescr
Standard_Real myMax
Standard_Real myMin
Standard_Real myDefValue
TCollection_ExtendedString myDefString
Standard_Integer myData
TCollection_ExtendedString myListName
Standard_Real myMinZoom
Standard_Real myMaxZoom
Standard_Real myZoomOrder
OptionsMap myOptions
NCollection_DataMap
< UnitSystem, UnitData
myUnitData

Friends

class DDS_DicGroup

Detailed Description

This class provides an information about datum (phisical characteristic parameter).

Definition at line 51 of file DDS_DicItem.h.


Class Documentation

struct DDS_DicItem::UnitData

Definition at line 73 of file DDS_DicItem.h.

Class Members
TCollection_AsciiString myFormat
Standard_Integer myPrecision
Standard_Real myScale
TCollection_AsciiString myUnits
Standard_Real myZero

Member Typedef Documentation

typedef NCollection_DataMap<TCollection_AsciiString, TCollection_ExtendedString> DDS_DicItem::OptionsMap [private]

Definition at line 171 of file DDS_DicItem.h.

typedef TCollection_AsciiString DDS_DicItem::UnitSystem

Definition at line 82 of file DDS_DicItem.h.


Member Enumeration Documentation

Enum describes the flags for existance of domain data.

Enumerator:
MinValue 

Flag of minimum value definition existence.

MaxValue 

Flag of maximum value definition existence.

DefaultValue 

Flag of default value definition existence.

Definition at line 65 of file DDS_DicItem.h.

  {
    MinValue = 0x01,    
    MaxValue = 0x02,    
    DefaultValue = 0x04 
  };

Enum describes type of datum value.

Enumerator:
String 

String type of value.

Float 

Real (double) numeric type of value.

Integer 

Integer (int) numeric type of value.

List 

List type of enumerable value.

Unknown 

Unknown or undefined type of value.

Definition at line 55 of file DDS_DicItem.h.


Constructor & Destructor Documentation

Constructor.

Creates the instance of empty dictionary item.

Definition at line 52 of file DDS_DicItem.cxx.

: myType( 0 ),
  myMax( 0 ),
  myMin( 0 ),
  myDefValue( 0 ),
  myMinZoom( 0.1 ),
  myMaxZoom( 10 ),
  myZoomOrder( 2 )
{
}
DDS_DicItem::DDS_DicItem ( const DDS_DicItem ) [private]

Copy constructor (put in private section to prevent object copying).

Definition at line 66 of file DDS_DicItem.cxx.

{
}

Member Function Documentation

void DDS_DicItem::FillDataMap ( TCollection_AsciiString  theID,
const LDOM_Element &  theDatum,
const LDOM_Element &  theCompElement,
const LDOM_Element &  theDocElement,
const TColStd_SequenceOfAsciiString &  theSystems 
) [private]

Parse record from XML file and retrieve information relevant for the dictionary item.

Parameters:
theIDitem identifier
theDatumdatum XML node
theCompElementcomponent XML node
theDocElementdocument XML node
theSystemsunits system names

Definition at line 587 of file DDS_DicItem.cxx.

{
  TCollection_AsciiString aLabel    = theDatum.getAttribute( DDS_Dictionary::KeyWord( "DATUM_LABEL" ) );
  TCollection_AsciiString aFormat   = theDatum.getAttribute( DDS_Dictionary::KeyWord( "DATUM_FORMAT" ) );
  TCollection_AsciiString aFilter   = theDatum.getAttribute( DDS_Dictionary::KeyWord( "DATUM_FILTER" ) );
  TCollection_AsciiString aRequired = theDatum.getAttribute( DDS_Dictionary::KeyWord( "DATUM_REQUIRED" ) );

  TCollection_AsciiString aBaseKeyWord = DDS_Dictionary::KeyWord( "DATUM_UNITS" );

  for ( Standard_Integer j = 1; j <= theSystems.Length(); j++ )
  {
    UnitSystem anUnitSystem = theSystems.Value( j );
    if ( !anUnitSystem.Length() )
      continue;

    TCollection_AsciiString aUnitKeyword = anUnitSystem + aBaseKeyWord;

    if ( !myUnitData.IsBound( anUnitSystem ) )
      myUnitData.Bind( anUnitSystem, UnitData() );

    UnitData& anUnitData = myUnitData.ChangeFind( anUnitSystem );
    anUnitData.myUnits = theDatum.getAttribute( LDOMString( aUnitKeyword.ToCString() ) );
  }

  if ( theSystems.Length() && myUnitData.IsBound( theSystems.First() ) &&
       !myUnitData.Find( theSystems.First() ).myUnits.Length() )
  {
    TCollection_AsciiString units = theDatum.getAttribute( LDOMString( aBaseKeyWord.ToCString() ) );
    if ( units.Length() )
      myUnitData.ChangeFind( theSystems.First() ).myUnits = units;
  }

  TCollection_AsciiString units;
  for ( NCollection_DataMap<UnitSystem, UnitData>::Iterator iter( myUnitData ); iter.More() && units.IsEmpty(); iter.Next() )
    units = iter.Value().myUnits;

  for ( NCollection_DataMap<UnitSystem, UnitData>::Iterator itr( myUnitData ); itr.More(); itr.Next() )
  {
    UnitData& dataUnits = itr.ChangeValue();
    if ( dataUnits.myUnits.IsEmpty() )
      dataUnits.myUnits = units;
  }
  
  // 2. Elements ( domain, description )
  Standard_Real aRealMinV = 0;
  Standard_Real aRealMaxV = 0;
  Standard_Real aRealDefV = 0;

  TCollection_AsciiString aType;

  DDS_MsgType aWrongValue = DDS_MT_NONE;
  DDS_DicItem::Type aEnumType = DDS_DicItem::Unknown;

  TCollection_AsciiString aMinV;
  TCollection_AsciiString aMaxV;
  TCollection_AsciiString aDefV;
  TCollection_AsciiString aListName;

  TCollection_AsciiString aLongD;
  TCollection_AsciiString aShortD;

  TColStd_SequenceOfInteger aSeqOfValueID;
  TColStd_SequenceOfExtendedString aSeqOfValue;
  TColStd_SequenceOfExtendedString aSeqOfValueIconName;

  // Presentation
  Standard_Real aMinZoom   = 0;
  Standard_Real aMaxZoom   = 0;
  Standard_Real aZoomOrder = 0;

  // Datum::Reports tags (if any)
  LDOM_Element aWLev = theDatum.GetChildByTagName( DDS_Dictionary::KeyWord( "WARNING_LEVEL" ) );
  if ( !aWLev.isNull() )
  {
    TCollection_AsciiString aWrongValWL = aWLev.getAttribute( DDS_Dictionary::KeyWord( "WRONG_VALUE" ) );
    if ( aWrongValWL.IsEqual( "Info" ) )
      aWrongValue = DDS_MT_INFO;
    else if ( aWrongValWL.IsEqual( "Warning" ) )
      aWrongValue = DDS_MT_WARNING;
    else if ( aWrongValWL.IsEqual( "Alarm" ) )
      aWrongValue = DDS_MT_ALARM;
    else if ( aWrongValWL.IsEqual( "Error" ) )
      aWrongValue = DDS_MT_ERROR;
  }

  // Datum::Presentation
  LDOM_Element aPrs = theDatum.GetChildByTagName( DDS_Dictionary::KeyWord( "PRS" ) );
  if ( !aPrs.isNull() )
  {
    LDOM_Element aLateralZoom = aPrs.GetChildByTagName( DDS_Dictionary::KeyWord( "LATERAL_ZOOM" ) );
    if ( !aLateralZoom.isNull() )
    {
      TCollection_AsciiString aMinZoomStr   = aLateralZoom.getAttribute( DDS_Dictionary::KeyWord( "LZ_MINV" ) );
      TCollection_AsciiString aMaxZoomStr   = aLateralZoom.getAttribute( DDS_Dictionary::KeyWord( "LZ_MAXV" ) );
      TCollection_AsciiString aZoomOrderStr = aLateralZoom.getAttribute( DDS_Dictionary::KeyWord( "LZ_ORDER" ) );
      
      aMinZoomStr.RemoveAll( ' ' );
      if ( aMinZoomStr.IsRealValue() )
        aMinZoom = aMinZoomStr.RealValue();

      aMaxZoomStr.RemoveAll( ' ' );
      if ( aMaxZoomStr.IsRealValue() )
        aMaxZoom = aMaxZoomStr.RealValue();

      aZoomOrderStr.RemoveAll( ' ' );
      if ( aZoomOrderStr.IsRealValue() )
        aZoomOrder = aZoomOrderStr.RealValue();
    }
  }

  // Quantity::Domain record as the only child of that tag name
  LDOM_Element aDomain = theDatum.GetChildByTagName( DDS_Dictionary::KeyWord( "DY_DOMAIN" ) );
  if ( !aDomain.isNull() )
  {
    LDOM_Element aValueDescr = aDomain.GetChildByTagName( DDS_Dictionary::KeyWord( "VALUE_DESCR" ) );
    if ( !aValueDescr.isNull() )
    {
      // read: valueDescr? (type?,min?,max?,default?)
      aType = aValueDescr.getAttribute( DDS_Dictionary::KeyWord( "VD_TYPE" ) );
      if ( aType.IsEqual( "String" ) )
        aEnumType = String;
      else if ( aType.IsEqual( "Float" ) )
        aEnumType = Float;
      else if ( aType.IsEqual( "Integer" ) )
        aEnumType = Integer;

      if ( !aValueDescr.getAttributeNode( DDS_Dictionary::KeyWord( "VD_MINV" ) ).isNull() )
        myData |= MinValue;
      aMinV = aValueDescr.getAttribute( DDS_Dictionary::KeyWord( "VD_MINV" ) );
      aMinV.RemoveAll( ' ' );
      if ( aMinV.IsRealValue() )
        aRealMinV = aMinV.RealValue();
      if ( !aValueDescr.getAttributeNode( DDS_Dictionary::KeyWord( "VD_MAXV" ) ).isNull() )
        myData |= MaxValue;
      aMaxV = aValueDescr.getAttribute( DDS_Dictionary::KeyWord( "VD_MAXV" ) );
      aMaxV.RemoveAll( ' ' );
      if ( aMaxV.IsRealValue() )
        aRealMaxV = aMaxV.RealValue();
      aDefV = aValueDescr.getAttribute( DDS_Dictionary::KeyWord( "VD_DEFV" ) );
      if ( !aValueDescr.getAttributeNode( DDS_Dictionary::KeyWord( "VD_DEFV" ) ).isNull() )
        myData |= DefaultValue;

      aDefV.RemoveAll( ' ' );
      if ( aDefV.IsRealValue() )
        aRealDefV = aDefV.RealValue();

      TCollection_AsciiString aSpecVal = aValueDescr.getAttribute( DDS_Dictionary::KeyWord( "VD_SPEC" ) );
      Split( aSpecVal, myListRef );
    }
    else
    {
      //  read: listRef? (list?)
      LDOM_Element aListRef = aDomain.GetChildByTagName( DDS_Dictionary::KeyWord( "VALUE_LIST_REF" ) );
      if ( !aListRef.isNull() )
      {
        aType = "List";
        aEnumType = List;                       
        LDOMString aListId = aListRef.getAttribute( DDS_Dictionary::KeyWord( "VLR_LIST" ) );
        aDefV = aListRef.getAttribute( DDS_Dictionary::KeyWord( "VD_DEFV" ) );
        aDefV.RemoveAll( ' ' );
        LDOM_Element foundListItem;
        for ( LDOM_Element aListItem = theCompElement.GetChildByTagName( DDS_Dictionary::KeyWord( "VALUE_LIST" ) );
              aListItem != NULL && foundListItem == NULL; aListItem = aListItem.GetSiblingByTagName() )
        {
          if ( aListItem.getAttribute( DDS_Dictionary::KeyWord( "VALUE_LIST_ID" ) ).equals( aListId ) )
            foundListItem = aListItem;

        }
        for ( LDOM_Element aLstItem = theDocElement.GetChildByTagName( DDS_Dictionary::KeyWord( "VALUE_LIST" ) );
              aLstItem != NULL && foundListItem == NULL; aLstItem = aLstItem.GetSiblingByTagName() )
        {
          if ( aLstItem.getAttribute( DDS_Dictionary::KeyWord( "VALUE_LIST_ID" ) ).equals( aListId ) )
            foundListItem = aLstItem;
        }

        if ( foundListItem != NULL )
        {
          //  The appropriate list of values is found: store the list name
          aListName = foundListItem.getAttribute( DDS_Dictionary::KeyWord( "VALUE_LIST_NAME" ) );
          //  Iteration through the list of values
          LDOM_Element aListItemValue = foundListItem.GetChildByTagName( DDS_Dictionary::KeyWord( "VALUE_LIST_VALUE" ) );
          while ( aListItemValue != NULL )
          {
            // read value ID
            TCollection_AsciiString aListValueID = aListItemValue.getAttribute( DDS_Dictionary::KeyWord( "VALUE_LIST_VALUEID" ) );
            if ( aListValueID.IsIntegerValue() )
            {
              //  Read the text in the element "value"
              //LDOM_Text aListItemTxt = (const LDOM_Text&)aListItemValue.getFirstChild();
              LDOM_Node aNode = aListItemValue.getFirstChild();
              const LDOM_Text& aText = (const LDOM_Text&) aNode;
              LDOM_Text aListItemTxt(aText);
              if ( !aListItemTxt.isNull() )
              {
                // adding ID and text value to sequence
                aSeqOfValueID.Append( aListValueID.IntegerValue() );
                aSeqOfValue.Append( aListItemTxt.getData() );
                // adding icon file name (optional) to sequence
                TCollection_ExtendedString aListValueIcon = aListItemValue.getAttribute( DDS_Dictionary::KeyWord( "VALUE_LIST_VALUEICON" ) );
                aSeqOfValueIconName.Append( aListValueIcon );
              }
              aListItemValue = aListItemValue.GetSiblingByTagName();
            }
          }
        }
      }
    }
  }

  // Quantity::Description record as the only child of that tag name
  LDOM_Element aDescr = theDatum.GetChildByTagName( DDS_Dictionary::KeyWord( "DESCR" ) );
  if ( !aDescr.isNull() )
  {
    // short description (#PCDATA)*
    LDOM_Element aShDescr = aDescr.GetChildByTagName( DDS_Dictionary::KeyWord( "SHORT_D" ) );
    if ( !aShDescr.isNull() )
    {
      // text is always a sub-node of element, containing it
      //LDOM_Text aShDescrTxt = (const LDOM_Text&)aShDescr.getFirstChild();
      LDOM_Node aNode = aShDescr.getFirstChild();
      const LDOM_Text& aText = (const LDOM_Text&) aNode;
      LDOM_Text aShDescrTxt(aText);
      if ( !aShDescrTxt.isNull() )
        aShortD = aShDescrTxt.getData();
    }

    // long description (#PCDATA)*
    LDOM_Element aLDescr = aDescr.GetChildByTagName( DDS_Dictionary::KeyWord( "LONG_D" ) );
    if ( !aLDescr.isNull() )
    {
      // text is always a sub-node of element, containing it
      //LDOM_Text aLDescrTxt = (const LDOM_Text&)aLDescr.getFirstChild();
      LDOM_Node aNode = aLDescr.getFirstChild();
      const LDOM_Text& aText = (const LDOM_Text&) aNode;
      LDOM_Text aLDescrTxt(aText);
      if ( !aLDescrTxt.isNull() )
        aLongD = aLDescrTxt.getData();
    }
  }

  // Quantity::Options
  LDOM_Element anOpt = theDatum.GetChildByTagName( DDS_Dictionary::KeyWord( "OPTIONS" ) );
  if ( !anOpt.isNull() )
  {
    LDOM_NodeList anOptions = anOpt.GetAttributesList();//anOpt.getElementsByTagName( DDS_Dictionary::KeyWord( "OPTION" ) );
    for ( Standard_Integer oi = 0; oi < anOptions.getLength(); oi++ )
    {
      LDOM_Node node = anOptions.item( oi );
      LDOM_Node::NodeType t = node.getNodeType();

      TCollection_AsciiString name;
      TCollection_ExtendedString value;

      if( t==LDOM_Node::ELEMENT_NODE )
      {
        const LDOM_Element& elem = ( const LDOM_Element& )node;
        name = elem.getAttribute( DDS_Dictionary::KeyWord( "OPTION_NAME" ) );
        
        const LDOM_Node aNode = elem.getFirstChild();
        LDOM_Text anOptTxt( (const LDOM_Text&)(aNode) );
        if ( !anOptTxt.isNull() )
          value = anOptTxt.getData();
      }
      else if( t==LDOM_Node::ATTRIBUTE_NODE )
      {
        const LDOM_Attr& attr = ( const LDOM_Attr& )node;
        name = ( Standard_CString )attr.getName().GetString();
        LDOMString v = attr.getValue();
        if( v.Type()==LDOMBasicString::LDOM_Integer )
        {
                Standard_Integer ival;
                v.GetInteger( ival );
                value = TCollection_ExtendedString( ival );
        }
        else
                value = ( Standard_CString )v.GetString();
      }
      else
        continue;

      if ( !name.IsEmpty() && value.Length() && !myOptions.IsBound( name ) )
        myOptions.Bind( name, value );
    }
  }

  NCollection_DataMap<UnitSystem, Handle(Units_Dimensions)> aDimMap;

  for ( NCollection_DataMap<UnitSystem, UnitData>::Iterator it( myUnitData ); it.More(); it.Next() )
  {
    UnitData& anUnitData = it.ChangeValue();

    // check units
    anUnitData.myZero  = 0.;
    anUnitData.myScale = 1.;
    try {
      Standard_CString aUnitDataStr;
      aUnitDataStr = (Standard_CString)anUnitData.myUnits.ToCString();
      if ( anUnitData.myUnits.ToCString()[0] && strcmp( anUnitData.myUnits.ToCString(), "%" ) )
      {
        Handle(Units_Dimensions) aDim;
        anUnitData.myZero  = UnitsAPI::AnyToSI( 0.0, aUnitDataStr, aDim );
        anUnitData.myScale = UnitsAPI::AnyToSI( 1.0, aUnitDataStr, aDim ) - anUnitData.myZero;
        UnitsAPI::AnyFromSI( 1.0, aUnitDataStr );
        if ( !aDimMap.IsBound( it.Key() ) )
          aDimMap.Bind( it.Key(), aDim );
      }
      else if ( anUnitData.myUnits.ToCString()[0] ) // treat '%' as unit with scale 100
        anUnitData.myScale = 0.01;
    }
          catch( Standard_Failure ) {
      anUnitData.myUnits.Clear();
    }

    Handle(Units_Dimensions) aPrev;
    Standard_Boolean aStatus = Standard_True;
    for ( NCollection_DataMap<UnitSystem, Handle(Units_Dimensions)>::Iterator itr( aDimMap );
          itr.More() && aStatus; itr.Next() )
    {
      if ( itr.Value().IsNull() )
        continue;

      if ( aPrev.IsNull() )
        aPrev = itr.Value();

      aStatus = aPrev->IsEqual( itr.Value() );
    }

    if ( !aStatus )
      printf( "Error in DataDictionary: Different dimensions for %s item", theID.ToCString() );
  }

  myId                = theID;
  myType              = aEnumType;
  myWarnLevel         = aWrongValue;
  myLabel             = aLabel.ToCString();
  myFilter            = aFilter.ToCString();
  myLongDescr         = aLongD.ToCString();
  myShortDescr        = aShortD.ToCString();
  myMin               = aRealMinV;
  myMax               = aRealMaxV;
  myDefValue          = aRealDefV;
  myDefString         = aDefV.ToCString();
  myRequired          = aRequired.ToCString();
  myListName          = aListName.ToCString();
  myMinZoom           = aMinZoom;
  myMaxZoom           = aMaxZoom;
  myZoomOrder         = aZoomOrder;

  // prepare formats
  PrepareFormats( aFormat );

  const Standard_Integer aLength = aSeqOfValue.Length();
  if ( aLength > 0 )
  {
    myListRef      = new TColStd_HArray1OfExtendedString( 1, aLength );
    myListRefID    = new TColStd_HArray1OfInteger( 1, aLength );
    myListRefIcons = new TColStd_HArray1OfExtendedString( 1, aLength );
    for ( Standard_Integer i = aLength; i > 0; i-- )
    {
      myListRef->ChangeValue( i ) = aSeqOfValue.Value( i );
      myListRefID->ChangeValue( i ) = aSeqOfValueID.Value( i );
      myListRefIcons->ChangeValue( i ) = aSeqOfValueIconName.Value( i );
    }
  }

  if ( myType == List && myDefString == "" && !myListRef.IsNull() && myListRef->Length() > 0 )
    myDefString = myListRef->Value( myListRef->Lower() );
}

Here is the call graph for this function:

Standard_Real DDS_DicItem::FromSI ( const Standard_Real  theVal) const

Convert value theVal from the default SI units according to the active units system.

Parameters:
theValvalue being converted
Returns:
value converted from SI

Definition at line 499 of file DDS_DicItem.cxx.

{
  return FromSI( theVal, GetActiveUnitSystem() );
}

Here is the call graph for this function:

Here is the caller graph for this function:

Standard_Real DDS_DicItem::FromSI ( const Standard_Real  theVal,
const UnitSystem theUnitsSystem 
) const

Convert value from the default SI units according to the units system theUnitsSystem.

Parameters:
theValvalue being converted
theUnitsSystemunits system
Returns:
value converted from the specified units system

Definition at line 527 of file DDS_DicItem.cxx.

{
  Standard_Real aRes = theVal;
  UnitData* anUnitData = GetUnitData( theUnitsSystem );
  if ( anUnitData )
    aRes = ( aRes - anUnitData->myZero ) / anUnitData->myScale;
  return aRes;
}

Here is the call graph for this function:

Get the active units system.

Returns:
active units system

Definition at line 1286 of file DDS_DicItem.cxx.

{
  UnitSystem aSystem;
  Handle(DDS_DicGroup) aComponent = Handle(DDS_DicGroup)::DownCast(myComponent);
  if ( !aComponent.IsNull() )
    aSystem = aComponent->GetActiveUnitSystem();
  return aSystem;
}

Here is the call graph for this function:

Here is the caller graph for this function:

TCollection_AsciiString DDS_DicItem::GetComponent ( ) const

Get the name of the component (parameter owner).

Returns:
component name

Definition at line 153 of file DDS_DicItem.cxx.

{
  TCollection_AsciiString aCompName;
  Handle(DDS_DicGroup) aComponent = Handle(DDS_DicGroup)::DownCast(myComponent);
  if ( !aComponent.IsNull() )
    aCompName = aComponent->GetName();
  return aCompName;
}

Here is the call graph for this function:

Restore default formats for all the units systems.

Definition at line 961 of file DDS_DicItem.cxx.

{
  for ( NCollection_DataMap<UnitSystem, UnitData>::Iterator it( myUnitData ); it.More(); it.Next() )
  {
    UnitData& anUnitData = it.ChangeValue();

    switch ( myType )
    {
    case Integer:
      anUnitData.myFormat = "%d";
      break;
    case Float:
      anUnitData.myFormat = "%g";
      break;
    case String:
    default:
      anUnitData.myFormat.Clear();
      break;;
    }
  }
}

Here is the caller graph for this function:

TCollection_ExtendedString DDS_DicItem::GetDefaultValue ( ) const

Get the default value of the parameter for active units system.

Default value is returned as string. If type of the value is numerical (Float or Integer) and default value is defined, then the returning value is converted to SI.

Returns:
default value

Definition at line 277 of file DDS_DicItem.cxx.

Here is the call graph for this function:

TCollection_ExtendedString DDS_DicItem::GetDefaultValue ( const UnitSystem theSystem) const

Get the default value of the parameter for specified units system theSystem.

Default value is returned as string. If type of the value is numerical (Float or Integer) and default value is defined, then the returning value is converted to SI.

Parameters:
theSystemunits system
Returns:
default value

Definition at line 293 of file DDS_DicItem.cxx.

{
  if ( !myDefString.Length() )
    return myDefString;

  TCollection_ExtendedString aStr;

  switch ( myType )
  {
  case Float:
  case Integer:
    aStr = FromSI( myDefValue, theSystem );
    break;
  case List:
  case String:
    aStr = myDefString;
    break;
  default:
    break;
  }
  return aStr;
}

Here is the call graph for this function:

TCollection_ExtendedString DDS_DicItem::GetFilter ( ) const

Get the filter (regular expression) for the parameter values.

Returns:
parameter filter

Definition at line 108 of file DDS_DicItem.cxx.

{
  return myFilter;
}
void DDS_DicItem::GetFloatFormat ( const TCollection_AsciiString &  theFlags,
const TCollection_AsciiString &  theWidth,
const TCollection_AsciiString &  thePrecision,
const TCollection_AsciiString &  theTypePrefix,
const Standard_Character  theType,
TCollection_AsciiString &  theFormat 
) [private]

Returns format for the float.

Parameters:
theFlagsformat flags
theWidthfield width
thePrecisionprecision
theTypePrefixtype prefix
theTypefloating point value type
theFormatreturning format string

Definition at line 1064 of file DDS_DicItem.cxx.

{
  Standard_Integer aPrecision = 0;
  if ( !thePrecision.IsEmpty() )
    aPrecision = thePrecision.IntegerValue();
  Standard_Integer aWidth = 0;

  if (!theWidth.IsEmpty() )
    aWidth = theWidth.IntegerValue();

  if (!thePrecision.IsEmpty() && aPrecision < 0 )
  {
    // possible value 0.1 will be 10.0
    aWidth -= aPrecision;
    aPrecision = 0;
  }

  if ( !thePrecision.IsEmpty() && aPrecision > ( aWidth - 2 ) )
  {
    aWidth = aPrecision + 2;
  }

  theFormat = "%";
  theFormat += theFlags;

  if ( !theWidth.IsEmpty() ) 
    theFormat += aWidth;

  if ( !thePrecision.IsEmpty() ) 
  {
    theFormat += ".";
    theFormat += aPrecision;
  }

  theFormat += theTypePrefix;
  theFormat += theType;
}

Here is the caller graph for this function:

TCollection_AsciiString DDS_DicItem::GetFormat ( const Standard_Boolean  theCanonical = Standard_True) const

Get the format string of the parameter for active units system.

If argument theCanonical is true, format string is reduced according to the sprintf() specification (without extra non standard qualifiers).

Parameters:
theCanonical'canonical form' flag
Returns:
format string

Definition at line 325 of file DDS_DicItem.cxx.

{
  return GetFormat( GetActiveUnitSystem(), theCanonical );
}

Here is the call graph for this function:

TCollection_AsciiString DDS_DicItem::GetFormat ( const UnitSystem theSystem,
const Standard_Boolean  theCanonical = Standard_True 
) const

Get the format string of the parameter for specified units system theSystem.

If argument theCanonical is true, format string is reduced according to the sprintf() specification (without extra non standard qualifiers).

Parameters:
theSystemunits system
theCanonical'canonical form' flag
Returns:
format string

Definition at line 341 of file DDS_DicItem.cxx.

{
  TCollection_AsciiString aFormat;
  UnitData* unitData = GetUnitData( theSystem );
  if ( unitData )
    aFormat = unitData->myFormat;

  if ( theCanonical && aFormat.Length() > 1 )
  {
    static TCollection_AsciiString f;
    f = aFormat;
    Standard_Boolean isRemoved = false;
    while ( !isRemoved )
    {
      char ch = f.Value( f.Length() - 1 );
      if ( ( ch != '%' && ch != '.' && !IsDigit( ch ) ) && f.Length() > 1 )
        f.Remove( f.Length() - 1 );
      else
        isRemoved = true;
    }
    aFormat = f;
  }

  return aFormat;
}

Here is the call graph for this function:

TCollection_AsciiString DDS_DicItem::GetId ( ) const

Get the identifier of parameter.

Returns:
parameter ID

Definition at line 81 of file DDS_DicItem.cxx.

{
  return myId;
}
void DDS_DicItem::GetIntegerFormat ( const TCollection_AsciiString &  theFlags,
const TCollection_AsciiString &  theWidth,
const TCollection_AsciiString &  thePrecision,
const TCollection_AsciiString &  theTypePrefix,
const Standard_Character  theType,
TCollection_AsciiString &  theFormat 
) [private]

Get format for the integer.

Parameters:
theFlagsformat flags
theWidthfield width
thePrecisionprecision
theTypePrefixtype prefix
theTypeinteger value type
theFormatreturning format string

Definition at line 1020 of file DDS_DicItem.cxx.

{
  Standard_Integer aPrecision = 0;
  if ( !thePrecision.IsEmpty() )
    aPrecision = thePrecision.IntegerValue();
  Standard_Integer aWidth = 0;

  if ( !theWidth.IsEmpty() )
    aWidth = theWidth.IntegerValue();

  if ( !thePrecision.IsEmpty() && aPrecision < 0 )
  {
    // possible value 0.1 will be 10.0
    aWidth -= aPrecision;
    aPrecision = 0;
  }

  if ( !thePrecision.IsEmpty() && aPrecision > ( aWidth - 2 ) )
    aWidth = aPrecision + 2;

  theFormat = "%";

  theFormat += theFlags;
  if ( !theWidth.IsEmpty() )
    theFormat += aWidth;

  theFormat += theTypePrefix;
  theFormat += theType;
}

Here is the caller graph for this function:

TCollection_ExtendedString DDS_DicItem::GetLabel ( ) const

Get the label of the parameter.

Returns:
parameter label

Definition at line 99 of file DDS_DicItem.cxx.

{
  return myLabel;
}
Standard_Boolean DDS_DicItem::GetListOfValues ( Handle(TColStd_HArray1OfExtendedString)&  theStrings,
Handle(TColStd_HArray1OfInteger)&  theIntegers 
) const

Get item names and item identifiers of a list referenced by the parameter.

These sequences are empty if the list reference is not defined. In this case, other properties (Type, DefaultValue, MaxValue, MinValue) should be used.

Parameters:
theStringsreturning items names
theIntegersreturning items identifiers
Returns:
true if returning lists are not empty
See also:
GetNameOfValues()

Definition at line 396 of file DDS_DicItem.cxx.

{
  theStrings  = myListRef;
  theIntegers = myListRefID;
  return !theIntegers.IsNull() && !theStrings.IsNull();
}
Standard_Boolean DDS_DicItem::GetListOfValues ( Handle(TColStd_HArray1OfExtendedString)&  theStrings,
Handle(TColStd_HArray1OfInteger)&  theIntegers,
Handle(TColStd_HArray1OfExtendedString)&  theIcons 
) const

Get item names, item identifiers and item icons of a list referenced by the parameter.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. These sequences are empty if the list reference is not defined. In this case, other properties (Type, DefaultValue, MaxValue, MinValue) should be used.

Parameters:
theStringsreturning items names
theIntegersreturning items identifiers
theIconsreturning items icons
Returns:
true if returning lists are not empty
See also:
GetNameOfValues()

Definition at line 420 of file DDS_DicItem.cxx.

{
  theStrings  = myListRef;
  theIntegers = myListRefID;
  theIcons    = myListRefIcons;
  return !theIntegers.IsNull() && !theStrings.IsNull() && !theIcons.IsNull();
}
TCollection_ExtendedString DDS_DicItem::GetLongDescription ( ) const

Get the long description of the parameter.

Returns:
long description

Definition at line 135 of file DDS_DicItem.cxx.

{
  return myLongDescr;
}
Standard_Real DDS_DicItem::GetMaxValue ( ) const

Get the maximum value of the parameter for active units system.

Returned value converted to SI.

Returns:
maximum value

Definition at line 221 of file DDS_DicItem.cxx.

Here is the call graph for this function:

Standard_Real DDS_DicItem::GetMaxValue ( const UnitSystem theUnitsSystem) const

Get the maximum value of the parameter for specified units system theSystem.

Returned value converted to SI.

Parameters:
theUnitsSystemunits system
Returns:
maximum value

Definition at line 235 of file DDS_DicItem.cxx.

{
  return FromSI( myMax, theUnitsSystem );
}

Here is the call graph for this function:

Standard_Real DDS_DicItem::GetMaxZoom ( ) const

Get maximum value of lateral zooming.

Returns:
lateral zooming maximum value

Definition at line 468 of file DDS_DicItem.cxx.

{
  return myMaxZoom;
}
Standard_Real DDS_DicItem::GetMinValue ( ) const

Get the minimum value of the parameter for active units system.

Returned value is converted to SI.

Returns:
minimum value

Definition at line 195 of file DDS_DicItem.cxx.

Here is the call graph for this function:

Standard_Real DDS_DicItem::GetMinValue ( const UnitSystem theUnitsSystem) const

Get the minimum value of the parameter for the specified units system theSystem.

Returned value is converted to SI.

Parameters:
theUnitsSystemunits system
Returns:
minimum value

Definition at line 209 of file DDS_DicItem.cxx.

{
  return FromSI( myMin, theUnitsSystem );
}

Here is the call graph for this function:

Standard_Real DDS_DicItem::GetMinZoom ( ) const

Get minimum value of lateral zooming.

Returns:
lateral zooming minimum value

Definition at line 459 of file DDS_DicItem.cxx.

{
  return myMinZoom;
}
TCollection_ExtendedString DDS_DicItem::GetNameOfValues ( ) const

Get the name of a list referenced by the parameter.

This string is empty if the list reference is not defined. In this case, other properties (Type, DefaultValue, MaxValue, MinValue) should be used.

Returns:
referenced list name
See also:
GetListOfValues()

Definition at line 378 of file DDS_DicItem.cxx.

{
  return myListName;
}
TCollection_ExtendedString DDS_DicItem::GetOption ( const TCollection_AsciiString &  name) const

Get option for specified name name.

If option is not found, empty string is returned.

Parameters:
nameoption name
Returns:
option value

Definition at line 554 of file DDS_DicItem.cxx.

{
  TCollection_ExtendedString res;
  if ( myOptions.IsBound( name ) )
    res = myOptions.Find( name );
  return res;
}
Standard_Boolean DDS_DicItem::GetOptionNames ( TColStd_SequenceOfAsciiString &  names) const

Get names of all existing options.

Parameters:
namesreturning list of options
Returns:
true if list is not empty

Definition at line 567 of file DDS_DicItem.cxx.

{
  names.Clear();

  for ( OptionsMap::Iterator it( myOptions ); it.More(); it.Next() )
    names.Append( it.Key() );

  return !names.IsEmpty();
}
Standard_Integer DDS_DicItem::GetPrecision ( ) const

Get the precision (number of digits after decimal point) of the parameter for active units system.

Returns:
parameter precision

Definition at line 245 of file DDS_DicItem.cxx.

Here is the call graph for this function:

Standard_Integer DDS_DicItem::GetPrecision ( const UnitSystem theSystem) const

Get the precision (number of digits after decimal point) of the parameter for specified units system theSystem.

If specified units system doesn't exist, zero is returned.

Parameters:
theSystemunits system
Returns:
parameter precision

Definition at line 259 of file DDS_DicItem.cxx.

{
  Standard_Integer aRes = 0;
  UnitData* unitData = GetUnitData( theSystem );
  if ( unitData )
    aRes = unitData->myPrecision;
  return aRes;
}

Here is the call graph for this function:

TCollection_ExtendedString DDS_DicItem::GetRequired ( ) const

Get the Required attribute of the parameter.

Returns:
Required attribute

Definition at line 117 of file DDS_DicItem.cxx.

{
  return myRequired;
}
TCollection_ExtendedString DDS_DicItem::GetShortDescription ( ) const

Get the short description of the parameter.

Returns:
short description

Definition at line 144 of file DDS_DicItem.cxx.

{
  return myShortDescr;
}
Standard_Boolean DDS_DicItem::GetSpecialValues ( TColStd_MapOfReal &  theMap) const

Get special values of the parameter.

Parameters:
theMapreturning map of the special values
Returns:
true if returning map is not empty

Definition at line 436 of file DDS_DicItem.cxx.

{
  theMap.Clear();
  if ( !myListRef.IsNull() )
  {
    for ( Standard_Integer i = myListRef->Lower(); i <= myListRef->Upper(); i++ )
    {
      if ( myListRef->Value( i ).IsAscii() )
      {
        TCollection_AsciiString aStr( myListRef->Value( i ) );
        if ( aStr.IsRealValue() )
          theMap.Add( aStr.RealValue() );
      }
    }
  }

  return theMap.Extent() > 0;
}
void DDS_DicItem::GetStringFormat ( const TCollection_AsciiString &  theFlags,
const TCollection_AsciiString &  theWidth,
const TCollection_AsciiString &  thePrecision,
const TCollection_AsciiString &  theTypePrefix,
TCollection_AsciiString &  theFormat 
) [private]

Get format for the string.

Parameters:
theFlagsformat flags
theWidthfield width
thePrecisionprecision
theTypePrefixtype prefix
theFormatreturning format string

Definition at line 991 of file DDS_DicItem.cxx.

{
  theFormat = "%";
  theFormat += theFlags;
  theFormat += theWidth;

  if ( !thePrecision.IsEmpty() ) 
  {
    theFormat += ".";
    theFormat += thePrecision;
  }

  theFormat += theTypePrefix;
  theFormat += "s";
}

Here is the caller graph for this function:

Get the type of parameter.

Returns:
parameter type

Definition at line 90 of file DDS_DicItem.cxx.

DDS_DicItem::UnitData * DDS_DicItem::GetUnitData ( const UnitSystem sys) const [private]

Get units structure for specified units system sys.

Parameters:
sysunits system
Returns:
units system information structure

Definition at line 1272 of file DDS_DicItem.cxx.

{
  UnitData* unit = 0;

  if ( myUnitData.IsBound( sys ) )
    unit = (UnitData*)&myUnitData.Find( sys );

  return unit;
}

Here is the caller graph for this function:

TCollection_AsciiString DDS_DicItem::GetUnits ( ) const

Get the parameter measure units for active units system.

Returns:
parameter units

Definition at line 166 of file DDS_DicItem.cxx.

{
  return GetUnits( GetActiveUnitSystem() );
}

Here is the call graph for this function:

TCollection_AsciiString DDS_DicItem::GetUnits ( const UnitSystem theSystem) const

Get the parameter measure units for specified units system theSystem.

If specified units system doesn't exist, empty string is returned.

Parameters:
theSystemunits system
Returns:
parameter units

Definition at line 179 of file DDS_DicItem.cxx.

{
  TCollection_AsciiString anUnits;
  UnitData* unitData = GetUnitData( theSystem );
  if ( unitData )
    anUnits = unitData->myUnits;
  return anUnits;
}

Here is the call graph for this function:

Get the wrong value warning level of the parameter.

Returns:
warning level

Definition at line 126 of file DDS_DicItem.cxx.

{
  return (DDS_MsgType)myWarnLevel;
}
Standard_Real DDS_DicItem::GetZoomOrder ( ) const

Get order of lateral zooming.

Returns:
lateral zooming order

Definition at line 477 of file DDS_DicItem.cxx.

{
  return myZoomOrder;
}
DDS_DicItem::Handle ( TColStd_HArray1OfExtendedString  ) [private]

Here is the caller graph for this function:

DDS_DicItem::Handle ( TColStd_HArray1OfInteger  ) [private]
DDS_DicItem::Handle ( TColStd_HArray1OfExtendedString  ) [private]
DDS_DicItem::Handle ( Standard_Transient  ) [private]
Standard_Boolean DDS_DicItem::HasData ( const Standard_Integer  flag) const

Check data existence.

Parameters:
flagdata flag
Returns:
true if data specified by flag exists

Definition at line 541 of file DDS_DicItem.cxx.

{
  return ( myData & flag ) == flag;
}
void DDS_DicItem::operator= ( const DDS_DicItem ) [private]

Assignment operator (put in private section to prevent object copying).

Definition at line 73 of file DDS_DicItem.cxx.

{
}
void DDS_DicItem::PrepareFormats ( const TCollection_AsciiString &  theFormat) [private]

Prepare formats for all units systems.

Parameters:
theFormatformat string

Definition at line 1111 of file DDS_DicItem.cxx.

{
  for ( NCollection_DataMap<UnitSystem, UnitData>::Iterator it( myUnitData ); it.More(); it.Next() )
  {
    UnitData& anUnitData = it.ChangeValue();

    anUnitData.myFormat = theFormat;
    anUnitData.myPrecision = 0;
  }

  TCollection_AsciiString aPrecisionStr;
  if ( theFormat.IsEmpty() && myType == List )
    return;

  // checking % presenting
  if ( *theFormat.ToCString() != '%' )
  {
    GetDefaultFormat();
    return;
  }

  TCollection_AsciiString aStr = ( theFormat.ToCString() + 1 );
  Standard_Character aType = aStr.Value( aStr.Length() );

  if ( ( aType != 's' && myType == String ) ||
       ( aType != 'd' && myType == Integer ) ||
       ( aType != 'f' && aType != 'g' && aType != 'e' && aType != 'G' && aType != 'E' && myType == Float ) )
  {
    GetDefaultFormat();
    return;
  }

  // removing type character
  aStr.Trunc( aStr.Length() - 1 );

  TCollection_AsciiString aFlags;
  while ( !aStr.IsEmpty() && aStr.Value( 1 ) != '.' && ( aStr.Value( 1 ) < '0' || aStr.Value( 1 ) > '9' ) )
  {
    aFlags = aFlags + aStr.Value( 1 );
    aStr.Remove( 1 );
  }

  Standard_Integer aPos = 1;
  while ( aPos <= aStr.Length() && ( aStr.Value( aPos ) == '.' ||
          ( aStr.Value( aPos ) >= '0' && aStr.Value( aPos ) <= '9' ) ) )
    aPos++;

  TCollection_AsciiString aTypePrefix;
  if ( aPos <= aStr.Length() )
  {
    aTypePrefix = aStr.SubString( aPos, aStr.Length() );
    aStr.Trunc( aPos - 1 );
  }

  Standard_Integer aBasePrecision = 0;

  // taking width and precision
  TCollection_AsciiString aPrecision;

  aPos = aStr.Search( "." );
  if ( aPos >= 0 ) 
  {
    // aPrecision is defined
    aPrecision = aStr.Split( aPos );
    aStr.Remove( aStr.Length() );
    if ( !aPrecision.IsEmpty() )
    {
      if ( !aPrecision.IsIntegerValue() ) 
      { 
        GetDefaultFormat();
        return;
      }
      else
      {
        aPrecisionStr  = aPrecision;
        aBasePrecision = aPrecision.IntegerValue();
      }
    }
  }

  if ( !aStr.IsEmpty() && !aStr.IsIntegerValue() )
  {
    GetDefaultFormat();
    return;
  }

  NCollection_DataMap<UnitSystem, UnitData>::Iterator itr;

  switch ( myType )
  {
  case String:
    for ( itr.Initialize( myUnitData ); itr.More(); itr.Next() )
    {
      if ( aType != 'f' && aType != 'g' && aType != 'e' && aType != 'G' && aType != 'E' )
        GetStringFormat( aFlags, aStr, aPrecisionStr, aTypePrefix, itr.ChangeValue().myFormat );
    }
    break;
  case Float:
  case Integer:
    for ( itr.Initialize( myUnitData ); itr.More(); itr.Next() )
    {
      UnitData& anUnitData = itr.ChangeValue();
      Standard_Integer aAmendment =
        (Standard_Integer)log10( 10.0 / DDS_Dictionary::FromSI( 10.0, anUnitData.myUnits.ToCString() ) );
      anUnitData.myPrecision = aBasePrecision + aAmendment;
      aPrecisionStr = TCollection_AsciiString( anUnitData.myPrecision );

      // create a formats
      if ( myType == Integer )
        GetIntegerFormat( aFlags, aStr, aPrecisionStr, aTypePrefix, aType, anUnitData.myFormat );
      else
        GetFloatFormat( aFlags, aStr, aPrecisionStr, aTypePrefix, aType, anUnitData.myFormat );
    }
    break;
  default:;
    GetDefaultFormat();
    break;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void DDS_DicItem::Split ( const TCollection_AsciiString &  theStr,
Handle(TColStd_HArray1OfExtendedString)&  aRes 
) [private]

Split the string theStr separated by spaces.

Parameters:
theStrsource string
aResreturning substrings array

Definition at line 1236 of file DDS_DicItem.cxx.

{
  aRes.Nullify();

  if ( theStr.Length() > 0 )
  {
    TCollection_AsciiString aStr = theStr;
    TColStd_SequenceOfAsciiString aSeq;
    Standard_Integer anIndex = aStr.SearchFromEnd( (Standard_CString)" " );
    while( anIndex > 1 )
    {
      TCollection_AsciiString tmpStr = aStr.Split( anIndex - 1 );
      tmpStr.RemoveAll( ( Standard_Character )' ' );
      if ( tmpStr.Length() > 0 )
        aSeq.Append( tmpStr );
      anIndex = aStr.SearchFromEnd( (Standard_CString)" " );
    }

    aStr.RemoveAll( ( Standard_Character )' ' );
    if ( aStr.Length() > 0 )
      aSeq.Append( aStr );

    if ( aSeq.Length() > 0 )
    {
      aRes = new TColStd_HArray1OfExtendedString( 1, aSeq.Length() );
      for ( int i = 1, n = aSeq.Length(); i <= n; i++ )
        aRes->ChangeValue( i ) = aSeq( i );
    }
  }
}

Here is the caller graph for this function:

Standard_Real DDS_DicItem::ToSI ( const Standard_Real  theVal) const

Convert value theVal to the default SI units according to the active units system.

Parameters:
theValvalue being converted
Returns:
value converted to SI

Definition at line 488 of file DDS_DicItem.cxx.

{
  return ToSI( theVal, GetActiveUnitSystem() );
}

Here is the call graph for this function:

Standard_Real DDS_DicItem::ToSI ( const Standard_Real  theVal,
const UnitSystem theUnitsSystem 
) const

Convert value to the default SI units according to the units system theUnitsSystem.

Parameters:
theValvalue being converted
theUnitsSystemunits system
Returns:
value converted to the specified units system

Definition at line 511 of file DDS_DicItem.cxx.

{
  Standard_Real aRes = theVal;
  UnitData* anUnitData = GetUnitData( theUnitsSystem );
  if ( anUnitData )
    aRes = anUnitData->myZero + aRes * anUnitData->myScale;
  return aRes;
}

Here is the call graph for this function:


Friends And Related Function Documentation

friend class DDS_DicGroup [friend]

Definition at line 210 of file DDS_DicItem.h.


Member Data Documentation

Standard_Integer DDS_DicItem::myData [private]

Definition at line 190 of file DDS_DicItem.h.

TCollection_ExtendedString DDS_DicItem::myDefString [private]

Definition at line 188 of file DDS_DicItem.h.

Standard_Real DDS_DicItem::myDefValue [private]

Definition at line 187 of file DDS_DicItem.h.

TCollection_ExtendedString DDS_DicItem::myFilter [private]

Definition at line 176 of file DDS_DicItem.h.

TCollection_AsciiString DDS_DicItem::myId [private]

Definition at line 174 of file DDS_DicItem.h.

TCollection_ExtendedString DDS_DicItem::myLabel [private]

Definition at line 175 of file DDS_DicItem.h.

TCollection_ExtendedString DDS_DicItem::myListName [private]

Definition at line 193 of file DDS_DicItem.h.

TCollection_ExtendedString DDS_DicItem::myLongDescr [private]

Definition at line 182 of file DDS_DicItem.h.

Standard_Real DDS_DicItem::myMax [private]

Definition at line 185 of file DDS_DicItem.h.

Standard_Real DDS_DicItem::myMaxZoom [private]

Definition at line 201 of file DDS_DicItem.h.

Standard_Real DDS_DicItem::myMin [private]

Definition at line 186 of file DDS_DicItem.h.

Standard_Real DDS_DicItem::myMinZoom [private]

Definition at line 200 of file DDS_DicItem.h.

Definition at line 206 of file DDS_DicItem.h.

TCollection_ExtendedString DDS_DicItem::myRequired [private]

Definition at line 177 of file DDS_DicItem.h.

TCollection_ExtendedString DDS_DicItem::myShortDescr [private]

Definition at line 183 of file DDS_DicItem.h.

Standard_Integer DDS_DicItem::myType [private]

Definition at line 179 of file DDS_DicItem.h.

NCollection_DataMap<UnitSystem, UnitData> DDS_DicItem::myUnitData [private]

Definition at line 208 of file DDS_DicItem.h.

Standard_Integer DDS_DicItem::myWarnLevel [private]

Definition at line 180 of file DDS_DicItem.h.

Standard_Real DDS_DicItem::myZoomOrder [private]

Definition at line 202 of file DDS_DicItem.h.


The documentation for this class was generated from the following files: