Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:39

0001 // Copyright (c) 1993-1999 Matra Datavision
0002 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0003 //
0004 // This file is part of Open CASCADE Technology software library.
0005 //
0006 // This library is free software; you can redistribute it and/or modify it under
0007 // the terms of the GNU Lesser General Public License version 2.1 as published
0008 // by the Free Software Foundation, with special exception defined in the file
0009 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0010 // distribution for complete text of the license and disclaimer of any warranty.
0011 //
0012 // Alternatively, this file may be used under the terms of Open CASCADE
0013 // commercial license or contractual agreement.
0014 
0015 #ifndef _Prs3d_DimensionAspect_HeaderFile
0016 #define _Prs3d_DimensionAspect_HeaderFile
0017 
0018 #include <Prs3d_ArrowAspect.hxx>
0019 #include <Prs3d_DimensionArrowOrientation.hxx>
0020 #include <Prs3d_DimensionTextHorizontalPosition.hxx>
0021 #include <Prs3d_DimensionTextVerticalPosition.hxx>
0022 #include <Prs3d_LineAspect.hxx>
0023 #include <Prs3d_TextAspect.hxx>
0024 #include <TCollection_AsciiString.hxx>
0025 
0026 //! defines the attributes when drawing a Length Presentation.
0027 class Prs3d_DimensionAspect : public Prs3d_BasicAspect
0028 {
0029   DEFINE_STANDARD_RTTIEXT(Prs3d_DimensionAspect, Prs3d_BasicAspect)
0030 public:
0031 
0032   //! Constructs an empty framework to define the display of dimensions.
0033   Standard_EXPORT Prs3d_DimensionAspect();
0034   
0035   //! Returns the settings for the display of lines used in presentation of dimensions.
0036   const Handle(Prs3d_LineAspect)& LineAspect() const { return myLineAspect; }
0037 
0038   //! Sets the display attributes of lines used in presentation of dimensions.
0039   void SetLineAspect (const Handle(Prs3d_LineAspect)& theAspect) { myLineAspect = theAspect; }
0040 
0041   //! Returns the settings for the display of text used in presentation of dimensions.
0042   const Handle(Prs3d_TextAspect)& TextAspect() const { return myTextAspect; }
0043 
0044   //! Sets the display attributes of text used in presentation of dimensions.
0045   void SetTextAspect (const Handle(Prs3d_TextAspect)& theAspect) { myTextAspect = theAspect; }
0046 
0047   //! Check if text for dimension label is 3d.
0048   Standard_Boolean IsText3d() const { return myIsText3d; }
0049 
0050   //! Sets type of text.
0051   void MakeText3d (const Standard_Boolean isText3d) { myIsText3d = isText3d; }
0052 
0053   //! Check if 3d text for dimension label is shaded.
0054   Standard_Boolean IsTextShaded() const { return myIsTextShaded; }
0055 
0056   //! Turns on/off text shading for 3d text.
0057   void MakeTextShaded (const Standard_Boolean theIsTextShaded) { myIsTextShaded = theIsTextShaded; }
0058 
0059   //! Gets type of arrows.
0060   Standard_Boolean IsArrows3d() const { return myIsArrows3d; }
0061 
0062   //! Sets type of arrows.
0063   void MakeArrows3d (const Standard_Boolean theIsArrows3d) { myIsArrows3d = theIsArrows3d; }
0064 
0065   //! Shows if Units are to be displayed along with dimension value.
0066   Standard_Boolean IsUnitsDisplayed() const { return myToDisplayUnits; }
0067   
0068   //! Specifies whether the units string should be displayed
0069   //! along with value label or not.
0070   void MakeUnitsDisplayed (const Standard_Boolean theIsDisplayed) { myToDisplayUnits = theIsDisplayed; }
0071   
0072   //! Sets orientation of arrows (external or internal).
0073   //! By default orientation is chosen automatically according to situation and text label size.
0074   void SetArrowOrientation (const Prs3d_DimensionArrowOrientation theArrowOrient) { myArrowOrientation = theArrowOrient; }
0075 
0076   //! Gets orientation of arrows (external or internal).
0077   Prs3d_DimensionArrowOrientation ArrowOrientation() const { return myArrowOrientation; }
0078 
0079   //! Sets vertical text alignment for text label.
0080   void SetTextVerticalPosition (const Prs3d_DimensionTextVerticalPosition thePosition) { myTextVPosition = thePosition; }
0081 
0082   //! Gets vertical text alignment for text label.
0083   Prs3d_DimensionTextVerticalPosition TextVerticalPosition() const { return myTextVPosition; }
0084 
0085   //! Sets horizontal text alignment for text label.
0086   void SetTextHorizontalPosition (const Prs3d_DimensionTextHorizontalPosition thePosition) { myTextHPosition = thePosition; }
0087 
0088   //! Gets horizontal text alignment for text label.
0089   Prs3d_DimensionTextHorizontalPosition TextHorizontalPosition() const { return myTextHPosition; }
0090 
0091   //! Returns the settings for displaying arrows.
0092   const Handle(Prs3d_ArrowAspect)& ArrowAspect() const { return myArrowAspect; }
0093 
0094   //! Sets the display attributes of arrows used in presentation of dimensions.
0095   void SetArrowAspect (const Handle(Prs3d_ArrowAspect)& theAspect) { myArrowAspect = theAspect; }
0096 
0097   //! Sets the same color for all parts of dimension: lines, arrows and text.
0098   Standard_EXPORT void SetCommonColor (const Quantity_Color& theColor);
0099   
0100   //! Sets extension size.
0101   void SetExtensionSize (const Standard_Real theSize) { myExtensionSize = theSize; }
0102 
0103   //! Returns extension size.
0104   Standard_Real ExtensionSize() const { return myExtensionSize; }
0105 
0106   //! Set size for arrow tail (extension without text).
0107   void SetArrowTailSize (const Standard_Real theSize) { myArrowTailSize = theSize; }
0108 
0109   //! Returns arrow tail size.
0110   Standard_Real ArrowTailSize() const { return myArrowTailSize; }
0111   
0112   //! Sets "sprintf"-syntax format for formatting dimension value labels.
0113   void SetValueStringFormat (const TCollection_AsciiString& theFormat) { myValueStringFormat = theFormat; }
0114 
0115   //! Returns format.
0116   const TCollection_AsciiString& ValueStringFormat() const { return myValueStringFormat; }
0117 
0118   //! Dumps the content of me into the stream
0119   Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
0120 
0121 protected:
0122 
0123   Handle(Prs3d_LineAspect)  myLineAspect;
0124   Handle(Prs3d_TextAspect)  myTextAspect;
0125   Handle(Prs3d_ArrowAspect) myArrowAspect;
0126   TCollection_AsciiString   myValueStringFormat;
0127   Standard_Real             myExtensionSize;
0128   Standard_Real             myArrowTailSize;
0129   Prs3d_DimensionArrowOrientation       myArrowOrientation;
0130   Prs3d_DimensionTextHorizontalPosition myTextHPosition;
0131   Prs3d_DimensionTextVerticalPosition   myTextVPosition;
0132   Standard_Boolean myToDisplayUnits;
0133   Standard_Boolean myIsText3d;
0134   Standard_Boolean myIsTextShaded;
0135   Standard_Boolean myIsArrows3d;
0136 
0137 };
0138 
0139 DEFINE_STANDARD_HANDLE(Prs3d_DimensionAspect, Prs3d_BasicAspect)
0140 
0141 #endif // _Prs3d_DimensionAspect_HeaderFile