6 #include <MMgt_TShared.hxx>
8 #include <TCollection_AsciiString.hxx>
10 #include <TColStd_HArray1OfInteger.hxx>
11 #include <TColStd_HArray1OfExtendedString.hxx>
13 #include <NCollection_DataMap.hxx>
14 #include <NCollection_DefineIndexedDataMap.hxx>
18 class TColStd_MapOfReal;
19 class TColStd_SequenceOfInteger;
20 class TColStd_SequenceOfAsciiString;
21 class TColStd_SequenceOfExtendedString;
23 // Class, containing all information about one parameter:
25 // obligative: label, type, short description, required
26 // optional : format, units,
27 // min value, max value, default value.
29 class DDS_DicItem : public MMgt_TShared
32 enum Type { String, Float, Integer, List, Unknown };
33 enum Data { MinValue = 0x01, MaxValue = 0x02, DefaultValue = 0x04 };
35 // This struct is intended for map of Format, Units, Precision and Scale
39 Standard_Real myScale;
40 TCollection_AsciiString myUnits;
41 TCollection_AsciiString myFormat;
42 Standard_Integer myPrecision;
45 typedef TCollection_AsciiString UnitSystem;
50 Standard_EXPORT TCollection_AsciiString GetId() const;
51 // to access Type of the parameter
53 Standard_EXPORT DDS_DicItem::Type GetType() const;
54 // to access Type of the parameter
56 Standard_EXPORT TCollection_ExtendedString GetLabel() const;
57 // to access Label (name) of the parameter
59 Standard_EXPORT TCollection_ExtendedString GetFilter() const;
60 // to access filter (regexp) for the parameter values
62 Standard_EXPORT TCollection_ExtendedString GetRequired() const;
63 // to access Required of the parameter
65 Standard_EXPORT DDS_MsgType GetWarningLevel() const;
66 // to access wrong value warning level of the parameter
68 Standard_EXPORT TCollection_ExtendedString GetLongDescription() const;
69 // to access Long Description of the parameter
71 Standard_EXPORT TCollection_ExtendedString GetShortDescription() const;
72 // to access Short Description of the parameter
74 Standard_EXPORT TCollection_AsciiString GetComponent() const;
76 Standard_EXPORT TCollection_AsciiString GetUnits() const;
77 Standard_EXPORT TCollection_AsciiString GetUnits( const UnitSystem& ) const;
78 // returns units for indicated unit systems
80 Standard_EXPORT TCollection_ExtendedString GetDefaultValue() const;
81 Standard_EXPORT TCollection_ExtendedString GetDefaultValue( const UnitSystem& ) const;
82 // to access Default Value of the parameter
84 Standard_EXPORT Standard_Real GetMinValue() const;
85 Standard_EXPORT Standard_Real GetMinValue( const UnitSystem& ) const;
86 // get Min Value of the parameter, either in specified unit system or in internal units (basic SI)
88 Standard_EXPORT Standard_Real GetMaxValue() const;
89 Standard_EXPORT Standard_Real GetMaxValue( const UnitSystem& ) const;
90 // get Max Value of the parameter, either in specified unit system or in internal units (basic SI)
92 Standard_EXPORT Standard_Integer GetPrecision() const;
93 Standard_EXPORT Standard_Integer GetPrecision( const UnitSystem& ) const;
94 // returns precision for indicated unit systems
96 Standard_EXPORT TCollection_AsciiString GetFormat( const Standard_Boolean = Standard_True ) const;
97 Standard_EXPORT TCollection_AsciiString GetFormat( const UnitSystem&,
98 const Standard_Boolean = Standard_True ) const;
99 // returns format for indicated unit systems
101 Standard_EXPORT TCollection_ExtendedString GetNameOfValues() const;
102 // to access valueList:name of the parameter.
103 // This string is void if the list is not defined - then use other properties:
104 // Type, DefaultValue, MaxValue, MinValue
106 Standard_EXPORT Standard_Boolean GetListOfValues( Handle(TColStd_HArray1OfExtendedString)&,
107 Handle(TColStd_HArray1OfInteger)& ) const;
108 // to access valueList of the parameter
109 // This sequence is empty if the list not defined - then use other properties:
110 // Type, DefaultValue, MaxValue, MinValue
112 Standard_EXPORT Standard_Boolean GetListOfValues( Handle(TColStd_HArray1OfExtendedString)&,
113 Handle(TColStd_HArray1OfInteger)&,
114 Handle(TColStd_HArray1OfExtendedString)& ) const;
115 // to access valueList of the parameter
116 // This sequence is empty if the list not defined - then use other properties:
117 // Type, DefaultValue, MaxValue, MinValue
119 Standard_EXPORT Standard_Boolean GetSpecialValues( TColStd_MapOfReal& ) const;
120 // get values from specVal
122 Standard_EXPORT Standard_Real GetMinZoom() const;
123 // get Min Value of lateral zooming
125 Standard_EXPORT Standard_Real GetMaxZoom() const;
126 // get Max Value of lateral zooming
128 Standard_EXPORT Standard_Real GetZoomOrder() const;
129 // get Order of lateral zooming
131 Standard_EXPORT Standard_Real ToSI( const Standard_Real ) const;
132 Standard_EXPORT Standard_Real FromSI( const Standard_Real ) const;
134 Standard_EXPORT Standard_Real ToSI( const Standard_Real, const UnitSystem& ) const;
135 Standard_EXPORT Standard_Real FromSI( const Standard_Real, const UnitSystem& ) const;
136 // convert value to and from default SI units according to current units
138 Standard_EXPORT Standard_Boolean HasData( const Standard_Integer ) const;
141 DDS_DicItem( const DDS_DicItem& );
144 void operator=( const DDS_DicItem& );
145 // Assignment operator
147 void FillDataMap( TCollection_AsciiString, const LDOM_Element&,
148 const LDOM_Element&, const LDOM_Element&,
149 const TColStd_SequenceOfAsciiString& );
150 // prepares formants for each unit systems
153 void PrepareFormats( const TCollection_AsciiString& );
154 // prepares three formats for each unit systems
156 void GetDefaultFormat();
157 // returns three default formants for each unit systems
159 UnitSystem GetActiveUnitSystem() const;
161 void GetStringFormat( const TCollection_AsciiString&,
162 const TCollection_AsciiString&,
163 const TCollection_AsciiString&,
164 const TCollection_AsciiString&,
165 TCollection_AsciiString& );
166 // returns format for the string
168 void GetIntegerFormat( const TCollection_AsciiString&,
169 const TCollection_AsciiString&,
170 const TCollection_AsciiString&,
171 const TCollection_AsciiString&,
172 const Standard_Character,
173 TCollection_AsciiString& );
174 // returns format for the integer
176 void GetFloatFormat( const TCollection_AsciiString&,
177 const TCollection_AsciiString&,
178 const TCollection_AsciiString&,
179 const TCollection_AsciiString&,
180 const Standard_Character,
181 TCollection_AsciiString& );
182 // returns format for the float
184 void Split( const TCollection_AsciiString&,
185 Handle(TColStd_HArray1OfExtendedString)& );
187 UnitData* GetUnitData( const UnitSystem& ) const;
190 TCollection_AsciiString myId;
191 TCollection_ExtendedString myLabel;
192 TCollection_ExtendedString myFilter;
193 TCollection_ExtendedString myRequired;
195 Standard_Integer myType;
196 Standard_Integer myWarnLevel;
198 TCollection_ExtendedString myLongDescr;
199 TCollection_ExtendedString myShortDescr;
203 Standard_Real myDefValue;
204 TCollection_ExtendedString myDefString;
206 Standard_Integer myData;
209 TCollection_ExtendedString myListName;
211 Handle(TColStd_HArray1OfExtendedString) myListRef;
212 Handle(TColStd_HArray1OfInteger) myListRefID;
213 Handle(TColStd_HArray1OfExtendedString) myListRefIcons;
216 Standard_Real myMinZoom;
217 Standard_Real myMaxZoom;
218 Standard_Real myZoomOrder;
220 Handle(Standard_Transient) myComponent;
223 NCollection_DataMap<UnitSystem, UnitData> myUnitData;
225 friend class DDS_DicGroup;
228 // Declaration of CASCADE RTTI
229 DEFINE_STANDARD_RTTI(DDS_DicItem)
232 // Definition of HANDLE object using Standard_DefineHandle.hxx
233 DEFINE_STANDARD_HANDLE(DDS_DicItem, MMgt_TShared)
235 // Container class XMLTools_IndexedDataMapOfDicItems (map of handles)
236 DEFINE_BASECOLLECTION(DDS_BaseCollectionOfDicItems, Handle(DDS_DicItem))
237 DEFINE_INDEXEDDATAMAP(DDS_IndexedDataMapOfDicItems, DDS_BaseCollectionOfDicItems,
238 TCollection_AsciiString, Handle(DDS_DicItem))