DgnPlatform/ValueFormat.h
Go to the documentation of this file.
1 /*--------------------------------------------------------------------------------------+
2 |
3 | Supplied under applicable software license agreement.
4 |
5 | Copyright (c) 2018 Bentley Systems, Incorporated. All rights reserved.
6 |
7 +---------------------------------------------------------------------------------------*/
8 #pragma once
9 #include "DgnFileIO/ModelInfo.h"
11 #include <Bentley/ValueFormat.h>
12 #include <Bentley/DateTime.h>
13 
14 DGNPLATFORM_TYPEDEFS(AngleFormatter);
15 DGNPLATFORM_TYPEDEFS(DirectionFormatter);
16 DGNPLATFORM_TYPEDEFS(DistanceFormatter);
17 DGNPLATFORM_TYPEDEFS(PointFormatter);
18 DGNPLATFORM_TYPEDEFS(AreaFormatter);
19 DGNPLATFORM_TYPEDEFS(VolumeFormatter);
20 DGNPLATFORM_TYPEDEFS(DateTimeFormatter);
21 
23 
31 
32 //=======================================================================================
52 //=======================================================================================
54 {
55 private:
56  virtual void MakeClassAbstract() = 0;
57 public:
58 
60  public: DGNPLATFORM_EXPORT AngleMode GetAngleMode () const;
61 
63  public: DGNPLATFORM_EXPORT AnglePrecision GetAnglePrecision () const;
64 
66  public: DGNPLATFORM_EXPORT WChar GetDecimalSeparator () const;
67 
70  public: DGNPLATFORM_EXPORT bool GetLeadingZero () const;
71 
74  public: DGNPLATFORM_EXPORT bool GetTrailingZeros () const;
75 
78  public: DGNPLATFORM_EXPORT bool GetAllowNegative () const;
79 
81  public: DGNPLATFORM_EXPORT void SetAngleMode (AngleMode newVal);
82 
84  public: DGNPLATFORM_EXPORT void SetAnglePrecision (AnglePrecision newVal);
85 
87  public: DGNPLATFORM_EXPORT void SetDecimalSeparator (WChar newVal);
88 
92  public: DGNPLATFORM_EXPORT void SetLeadingZero (bool newVal);
93 
97  public: DGNPLATFORM_EXPORT void SetTrailingZeros (bool newVal);
98 
101  public: DGNPLATFORM_EXPORT void SetAllowNegative (bool newVal);
102 
104 public: static DGNPLATFORM_EXPORT AngleFormatterPtr Create();
105 
108 public: static DGNPLATFORM_EXPORT AngleFormatterPtr Create (DgnModelCR model);
109 
111  public: DGNPLATFORM_EXPORT AngleFormatterPtr Clone () const;
112 
115  public: DGNPLATFORM_EXPORT WString ToString (double value) const;
116 
119  public: DGNPLATFORM_EXPORT WString ToStringFromRadians (double value) const;
120 
121 
122 }; // AngleFormatter
123 
124 //=======================================================================================
162 //=======================================================================================
164 {
165 private:
166  virtual void MakeClassAbstract() = 0;
167 public:
168 
171  public: DGNPLATFORM_EXPORT AngleFormatterR GetAngleFormatter ();
172 
174  public: DGNPLATFORM_EXPORT DirectionMode GetDirectionMode () const;
175 
177  public: DGNPLATFORM_EXPORT bool GetAddTrueNorth () const;
178 
181  public: DGNPLATFORM_EXPORT double GetTrueNorthValue () const;
182 
184  public: DGNPLATFORM_EXPORT double GetBaseDirection () const;
185 
189  public: DGNPLATFORM_EXPORT bool GetClockwise () const;
190 
193  public: DGNPLATFORM_EXPORT bool GetBearingSpaces () const;
194 
198  public: DGNPLATFORM_EXPORT void SetAngleFormatter (AngleFormatterCR);
199 
201  public: DGNPLATFORM_EXPORT void SetDirectionMode (DirectionMode newVal);
202 
204  public: DGNPLATFORM_EXPORT void SetAddTrueNorth (bool newVal);
205 
208  public: DGNPLATFORM_EXPORT void SetTrueNorthValue (double newVal);
209 
216  public: DGNPLATFORM_EXPORT void SetBaseDirection (double newVal);
217 
220  public: DGNPLATFORM_EXPORT void SetClockwise (bool newVal);
221 
224  public: DGNPLATFORM_EXPORT void SetBearingSpaces (bool newVal);
225 
227 public: static DGNPLATFORM_EXPORT DirectionFormatterPtr Create();
228 
231 public: static DGNPLATFORM_EXPORT DirectionFormatterPtr Create (DgnModelCR model);
232 
234 public: DGNPLATFORM_EXPORT DirectionFormatterPtr Clone () const;
235 
238  public: DGNPLATFORM_EXPORT WString ToString (double value) const;
239 
242  public: DGNPLATFORM_EXPORT WString ToStringFromRadians (double value) const;
243 
244 }; // DirectionFormatter
245 
246 //=======================================================================================
268 // @remark Required library : DgnPlatform<ApiNumber>.lib i.e. DgnPlatform5.lib
269 // @bsiclass Bentley Systems
270 //=======================================================================================
272 {
273 private:
274  virtual void MakeClassAbstract() = 0;
275 public:
276 
278  public: DGNPLATFORM_EXPORT DgnUnitFormat GetUnitFormat () const;
279 
281  public: DGNPLATFORM_EXPORT UnitDefinitionCR GetMasterUnit () const;
282 
284  public: DGNPLATFORM_EXPORT UnitDefinitionCR GetSubUnit () const;
285 
287  public: DGNPLATFORM_EXPORT UnitDefinitionCR GetStorageUnit () const;
288 
290  public: DGNPLATFORM_EXPORT double GetUorPerStorageUnit () const;
291 
293  public: DGNPLATFORM_EXPORT double GetScaleFactor () const;
294 
296  public: DGNPLATFORM_EXPORT bool GetUnitLabelFlag () const;
297 
299  public: DGNPLATFORM_EXPORT bool GetSuppressZeroMasterUnits () const;
300 
302  public: DGNPLATFORM_EXPORT bool GetSuppressZeroSubUnits () const;
303 
305  public: DGNPLATFORM_EXPORT bool GetIsDgnCoordReadOutCapable () const;
306 
308  public: DGNPLATFORM_EXPORT double GetMinimumResolution () const;
309 
311  public: DGNPLATFORM_EXPORT void SetUnitFormat (DgnUnitFormat newVal);
312 
314  public: DGNPLATFORM_EXPORT StatusInt SetWorkingUnits (UnitDefinitionCR newMasterUnit, UnitDefinitionCP newSubUnit);
315 
317  public: DGNPLATFORM_EXPORT void SetStorageUnit (UnitDefinitionCR newStorageUnit, double uorPerStorage);
318 
320  public: DGNPLATFORM_EXPORT void SetStorageUnit (UnitDefinitionCR newVal);
321 
323  public: DGNPLATFORM_EXPORT void SetUorPerStorageUnit (double newVal);
324 
326  public: DGNPLATFORM_EXPORT void SetScaleFactor (double newVal);
327 
329  public: DGNPLATFORM_EXPORT void SetUnitLabelFlag (bool newVal);
330 
332  public: DGNPLATFORM_EXPORT void SetSuppressZeroMasterUnits (bool newVal);
333 
335  public: DGNPLATFORM_EXPORT void SetSuppressZeroSubUnits (bool newVal);
336 
338  public: DGNPLATFORM_EXPORT void SetIsDgnCoordReadOutCapable (bool newVal);
339 
341 public: static DGNPLATFORM_EXPORT DistanceFormatterPtr Create ();
342 
345 public: static DGNPLATFORM_EXPORT DistanceFormatterPtr Create (DgnModelCR model);
346 
350 public: static DGNPLATFORM_EXPORT DistanceFormatterPtr Create (ViewportR vp);
351 
353  public: DGNPLATFORM_EXPORT DistanceFormatterPtr Clone () const;
354 
357  public: DGNPLATFORM_EXPORT WString ToString (double uors) const;
358 
359 }; // DistanceFormatter
360 
361 //=======================================================================================
369 // @remark Required library : DgnPlatform<ApiNumber>.lib i.e. DgnPlatform5.lib
370 // @bsiclass Bentley Systems
371 //=======================================================================================
373 {
374 private:
375  virtual void MakeClassAbstract() = 0;
376 public:
377 
380  public: DGNPLATFORM_EXPORT DistanceFormatterR GetDistanceFormatter ();
381 
384  public: DGNPLATFORM_EXPORT IAuxCoordSysR GetAuxCoordSys ();
385 
387  public: DGNPLATFORM_EXPORT bool GetIs3d () const;
388 
392  public: DGNPLATFORM_EXPORT void SetDistanceFormatter (DistanceFormatterCR);
393 
397  public: DGNPLATFORM_EXPORT void SetAuxCoordSys (IAuxCoordSysCR);
398 
400  public: DGNPLATFORM_EXPORT void SetIs3d (bool newVal);
401 
403 public: static DGNPLATFORM_EXPORT PointFormatterPtr Create ();
404 
408 public: static DGNPLATFORM_EXPORT PointFormatterPtr Create (DgnModelCR model, bool addGlobalOrigin);
409 
413 public: static DGNPLATFORM_EXPORT PointFormatterPtr Create (ViewportR vp);
414 
417 public: static DGNPLATFORM_EXPORT PointFormatterPtr Create (DistanceFormatterCR distanceFormatter);
418 
420  public: DGNPLATFORM_EXPORT PointFormatterPtr Clone () const;
421 
424  public: DGNPLATFORM_EXPORT WString ToString (DPoint3dCR point) const;
425 
426 }; // PointFormatter
427 
428 //=======================================================================================
431 // @remark Required library : DgnPlatform<ApiNumber>.lib i.e. DgnPlatform5.lib
432 // @bsiclass Bentley Systems
433 //=======================================================================================
435 {
436 private:
438 
440  public: DGNPLATFORM_EXPORT UnitDefinitionCR GetMasterUnit () const;
441 
443  public: DGNPLATFORM_EXPORT UnitDefinitionCR GetStorageUnit () const;
444 
446  public: DGNPLATFORM_EXPORT double GetUorPerStorageUnit () const;
447 
449  public: DGNPLATFORM_EXPORT double GetScaleFactor () const;
450 
452  public: DGNPLATFORM_EXPORT bool GetShowUnitLabel () const;
453 
455  public: DGNPLATFORM_EXPORT bool GetLabelDecoratorAsSuffix () const;
456 
458  public: DGNPLATFORM_EXPORT StatusInt SetMasterUnit (UnitDefinitionCR newUnit);
459 
461  public: DGNPLATFORM_EXPORT void SetStorageUnit (UnitDefinitionCR newStorageUnit, double uorPerStorage);
462 
464  public: DGNPLATFORM_EXPORT void SetStorageUnit (UnitDefinitionCR newVal);
465 
467  public: DGNPLATFORM_EXPORT void SetUorPerStorageUnit (double newVal);
468 
470  public: DGNPLATFORM_EXPORT void SetScaleFactor (double newVal);
471 
473  public: DGNPLATFORM_EXPORT void SetShowUnitLabel (bool newVal);
474 
476  public: DGNPLATFORM_EXPORT void SetLabelDecoratorAsSuffix (bool newVal);
477 };
478 
479 //=======================================================================================
487 // @remark Required library : DgnPlatform<ApiNumber>.lib i.e. DgnPlatform5.lib
488 // @bsiclass Bentley Systems
489 //=======================================================================================
491 {
492 private:
493  virtual void MakeClassAbstract() = 0;
494 public:
495 
497 public: static DGNPLATFORM_EXPORT AreaFormatterPtr Create ();
498 
501 public: static DGNPLATFORM_EXPORT AreaFormatterPtr Create (DgnModelCR model);
502 
506 public: static DGNPLATFORM_EXPORT AreaFormatterPtr Create (ViewportR vp);
507 
509  public: DGNPLATFORM_EXPORT AreaFormatterPtr Clone () const;
510 
513  public: DGNPLATFORM_EXPORT WString ToString (double uors) const;
514 
515 }; // AreaFormatter
516 
517 //=======================================================================================
525 // @remark Required library : DgnPlatform<ApiNumber>.lib i.e. DgnPlatform5.lib
526 // @bsiclass Bentley Systems
527 //=======================================================================================
529 {
530 private:
531  virtual void MakeClassAbstract() = 0;
532 public:
533 
535 public: static DGNPLATFORM_EXPORT VolumeFormatterPtr Create ();
536 
539 public: static DGNPLATFORM_EXPORT VolumeFormatterPtr Create (DgnModelCR model);
540 
544 public: static DGNPLATFORM_EXPORT VolumeFormatterPtr Create (ViewportR vp);
545 
547 public: DGNPLATFORM_EXPORT VolumeFormatterPtr Clone () const;
548 
551 public: DGNPLATFORM_EXPORT WString ToString (double uors) const;
552 
553 }; // VolumeFormatter
554 
555 //=======================================================================================
568 // @remark Required library : DgnPlatform<ApiNumber>.lib i.e. DgnPlatform5.lib
569 // @bsiclass Bentley Systems
570 //=======================================================================================
572  {
573 private:
574  virtual void MakeClassAbstract() = 0;
575 public:
577  DGNPLATFORM_EXPORT WChar GetDecimalSeparator() const;
579  DGNPLATFORM_EXPORT WChar GetTimeSeparator() const;
581  DGNPLATFORM_EXPORT WChar GetDateSeparator() const;
583  DGNPLATFORM_EXPORT UInt8 GetFractionalSecondPrecision() const;
585  DGNPLATFORM_EXPORT bool GetTrailingZeros() const;
586 
588  DGNPLATFORM_EXPORT void SetDecimalSeparator (WChar separator);
590  DGNPLATFORM_EXPORT void SetTimeSeparator (WChar separator);
592  DGNPLATFORM_EXPORT void SetDateSeparator (WChar separator);
594  DGNPLATFORM_EXPORT void SetFractionalSecondPrecision (UInt8 precision);
596  DGNPLATFORM_EXPORT void SetTrailingZeros (bool show);
597 
599  DGNPLATFORM_EXPORT void AppendFormatPart (DateTimeFormatPart part);
601  DGNPLATFORM_EXPORT void ClearFormatParts();
603  DGNPLATFORM_EXPORT void Reset();
604 
611  DGNPLATFORM_EXPORT WString ToString(DateTimeCR dateTime) const;
612  }; // DateTimeFormatter
613 
615 
Used to construct a string from a DPoint3d value.
Definition: DgnPlatform/ValueFormat.h:372
AnglePrecision
Used by AngleFormatter to specify the maximum number of decimals for angle formatting.
Definition: DgnPlatform.r.h:887
DateTimeFormatPart
Used by DateTimeFormatter to specify the sequence in which various elements of the date and time shou...
Definition: DgnPlatform.r.h:959
#define END_BENTLEY_DGNPLATFORM_NAMESPACE
Definition: DgnPlatformBaseType.r.h:69
DGNPLATFORM_TYPEDEFS(AngleFormatter)
struct DgnPlatform::DgnModel const & DgnModelCR
Definition: DgnPlatform.h:220
Provides Bentley specific date/time functions (Bentley/BeAssert.h).
Used to construct a string from a time point value.
Definition: DgnPlatform/ValueFormat.h:571
wchar_t WChar
Definition: Bentley.h:223
NEED_DOCUMENTATION.
Definition: Bentley/ValueFormat.h:29
RefCountedPtr< PointFormatter > PointFormatterPtr
Definition: DgnPlatform/ValueFormat.h:27
Used to construct a string from a numerical area value.
Definition: DgnPlatform/ValueFormat.h:490
uint8_t UInt8
Definition: Bentley.r.h:116
DateTime const & DateTimeCR
Definition: DateTime.h:443
#define DGNPLATFORM_EXPORT
Definition: DgnPlatform/ExportMacros.h:58
DgnUnitFormat
Definition: DgnPlatform.r.h:900
RefCountedPtr< DateTimeFormatter > DateTimeFormatterPtr
Definition: DgnPlatform/ValueFormat.h:30
Used to construct a string from a numerical angle value.
Definition: DgnPlatform/ValueFormat.h:53
Used to construct a string from a numerical distance value.
Definition: DgnPlatform/ValueFormat.h:271
#define CLRPUBLIC
Definition: DgnPlatform/ExportMacros.h:12
A shared pointer template for reference-counted objects.
Definition: RefCounted.h:119
DirectionMode
Used by DirectionFormatter to specify the mode for direction formatting.
Definition: DgnPlatform.r.h:916
Used to construct a string from a numerical direction value.
Definition: DgnPlatform/ValueFormat.h:163
Definition: DgnPlatform/ValueFormat.h:434
#define BEGIN_BENTLEY_DGNPLATFORM_NAMESPACE
Definition: DgnPlatformBaseType.r.h:68
RefCountedPtr< DirectionFormatter > DirectionFormatterPtr
Definition: DgnPlatform/ValueFormat.h:25
int StatusInt
Definition: Bentley.h:222
Concrete class that can be used to implement the reference-counting pattern.
Definition: RefCounted.h:109
AngleMode
Used by AngleFormatter to specify the mode for angle formatting.
Definition: DgnPlatform.r.h:873
An IAuxCoordSys is an object that holds the data which describes an auxiliary coordinate system...
Definition: IAuxCoordSys.h:189
Used to construct a string from a numerical area value.
Definition: DgnPlatform/ValueFormat.h:528
RefCountedPtr< DistanceFormatter > DistanceFormatterPtr
Definition: DgnPlatform/ValueFormat.h:26
struct DPoint3d const & DPoint3dCR
Definition: msgeomstructs_typedefs.h:79
RefCountedPtr< VolumeFormatter > VolumeFormatterPtr
Definition: DgnPlatform/ValueFormat.h:29
struct DgnPlatform::IAuxCoordSys const & IAuxCoordSysCR
Definition: DgnPlatform.h:277
RefCountedPtr< AngleFormatter > AngleFormatterPtr
Definition: DgnPlatform/ValueFormat.h:24
RefCountedPtr< AreaFormatter > AreaFormatterPtr
Definition: DgnPlatform/ValueFormat.h:28
A string class that has many of the same capabilities as std::string, plus additional functions such ...
Definition: WString.h:51
Definition: DgnViewport.h:186

Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.