0025235: Draw Harness - improve commands vdimension and vdimparam
[occt.git] / src / Prs3d / Prs3d_DimensionAspect.cxx
old mode 100644 (file)
new mode 100755 (executable)
index ab0b04f..ead3dca
@@ -1,20 +1,16 @@
 // Copyright (c) 1998-1999 Matra Datavision
-// Copyright (c) 1999-2013 OPEN CASCADE SAS
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
 //
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
+// This file is part of Open CASCADE Technology software library.
 //
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
 //
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
 
 #include <Prs3d_DimensionAspect.hxx>
 
@@ -48,8 +44,12 @@ Prs3d_DimensionAspect::Prs3d_DimensionAspect()
   myTextAspect->SetVerticalJustification (Graphic3d_VTA_CENTER);
   myArrowAspect = new Prs3d_ArrowAspect;
   myArrowAspect->SetColor (Quantity_NOC_LAWNGREEN);
+  myArrowAspect->SetAngle (M_PI * 12.0 / 180.0);
   myArrowAspect->SetLength (6.0);
-  myExtensionSize = 6.0;
+  myExtensionSize      = 6.0;
+  myArrowTailSize      = 6.0;
+  myValueStringFormat  = "%g";
+  myToDisplayUnits     = Standard_False;
 }
 
 //=======================================================================
@@ -57,7 +57,6 @@ Prs3d_DimensionAspect::Prs3d_DimensionAspect()
 //purpose  : Sets the same color for all parts of dimension:
 //           lines, arrows and text.
 //=======================================================================
-
 void Prs3d_DimensionAspect::SetCommonColor (const Quantity_Color& theColor)
 {
   myLineAspect->SetColor (theColor);
@@ -69,7 +68,6 @@ void Prs3d_DimensionAspect::SetCommonColor (const Quantity_Color& theColor)
 //function : LineAspect
 //purpose  : 
 //=======================================================================
-
 Handle(Prs3d_LineAspect) Prs3d_DimensionAspect::LineAspect () const
 {
   return myLineAspect;
@@ -79,7 +77,6 @@ Handle(Prs3d_LineAspect) Prs3d_DimensionAspect::LineAspect () const
 //function : SetLineAspect
 //purpose  : 
 //=======================================================================
-
 void Prs3d_DimensionAspect::SetLineAspect(const Handle(Prs3d_LineAspect)& theAspect)
 {
   myLineAspect = theAspect;
@@ -89,7 +86,6 @@ void Prs3d_DimensionAspect::SetLineAspect(const Handle(Prs3d_LineAspect)& theAsp
 //function : TextAspect
 //purpose  : 
 //=======================================================================
-
 Handle(Prs3d_TextAspect) Prs3d_DimensionAspect::TextAspect () const
 {
   return myTextAspect;
@@ -99,7 +95,6 @@ Handle(Prs3d_TextAspect) Prs3d_DimensionAspect::TextAspect () const
 //function : SetTextAspect
 //purpose  : 
 //=======================================================================
-
 void Prs3d_DimensionAspect::SetTextAspect (const Handle(Prs3d_TextAspect)& theAspect)
 {
   myTextAspect = theAspect;
@@ -109,12 +104,11 @@ void Prs3d_DimensionAspect::SetTextAspect (const Handle(Prs3d_TextAspect)& theAs
 //function : MakeArrows3D
 //purpose  : 
 //=======================================================================
-
 void Prs3d_DimensionAspect::MakeArrows3d (const Standard_Boolean isArrows3d)
 {
   myIsArrows3d = isArrows3d;
 }
+
 //=======================================================================
 //function : IsArrows3D
 //purpose  : 
@@ -128,12 +122,11 @@ Standard_Boolean Prs3d_DimensionAspect::IsArrows3d () const
 //function : MakeText3D
 //purpose  : 
 //=======================================================================
-
 void Prs3d_DimensionAspect::MakeText3d (const Standard_Boolean isText3d)
 {
   myIsText3d = isText3d;
 }
+
 //=======================================================================
 //function : IsText3D
 //purpose  : 
@@ -143,6 +136,24 @@ Standard_Boolean Prs3d_DimensionAspect::IsText3d () const
   return myIsText3d;
 }
 
+//=======================================================================
+//function : IsUnitsDisplayed
+//purpose  : 
+//======================================================================= 
+Standard_Boolean Prs3d_DimensionAspect::IsUnitsDisplayed () const
+{
+  return myToDisplayUnits;
+}
+
+//=======================================================================
+//function : MakeUnitsDisplayed
+//purpose  : 
+//=======================================================================
+void Prs3d_DimensionAspect::MakeUnitsDisplayed (const Standard_Boolean theIsDisplayed)
+{
+  myToDisplayUnits = theIsDisplayed;
+}
+
 //=======================================================================
 //function : IsTextShaded
 //purpose  : 
@@ -156,7 +167,6 @@ Standard_Boolean Prs3d_DimensionAspect::IsTextShaded () const
 //function : MakeTextShaded
 //purpose  : 
 //=======================================================================
-
 void Prs3d_DimensionAspect::MakeTextShaded (const Standard_Boolean isTextShaded)
 {
   myIsTextShaded = isTextShaded;
@@ -166,7 +176,6 @@ void Prs3d_DimensionAspect::MakeTextShaded (const Standard_Boolean isTextShaded)
 //function : SetArrowOrientation
 //purpose  : 
 //======================================================================= 
-
 void Prs3d_DimensionAspect::SetArrowOrientation (const Prs3d_DimensionArrowOrientation theArrowOrient)
 {
   myArrowOrientation = theArrowOrient;
@@ -176,7 +185,6 @@ void Prs3d_DimensionAspect::SetArrowOrientation (const Prs3d_DimensionArrowOrien
 //function : GetArrowOrientation
 //purpose  : 
 //======================================================================= 
-
 Prs3d_DimensionArrowOrientation Prs3d_DimensionAspect::ArrowOrientation() const
 {
   return myArrowOrientation;
@@ -186,7 +194,6 @@ Prs3d_DimensionArrowOrientation Prs3d_DimensionAspect::ArrowOrientation() const
 //function : SetTextVerticalPosition
 //purpose  :
 //=======================================================================
-
 void Prs3d_DimensionAspect::SetTextVerticalPosition (const Prs3d_DimensionTextVerticalPosition thePosition)
 {
   myTextVPosition = thePosition;
@@ -196,7 +203,6 @@ void Prs3d_DimensionAspect::SetTextVerticalPosition (const Prs3d_DimensionTextVe
 //function : TextVerticalPosition
 //purpose  :
 //======================================================================= 
-
 Prs3d_DimensionTextVerticalPosition Prs3d_DimensionAspect::TextVerticalPosition() const
 {
   return myTextVPosition;
@@ -206,7 +212,6 @@ Prs3d_DimensionTextVerticalPosition Prs3d_DimensionAspect::TextVerticalPosition(
 //function : SetTextHorizontalPosition
 //purpose  : 
 //=======================================================================
-
 void Prs3d_DimensionAspect::SetTextHorizontalPosition (const Prs3d_DimensionTextHorizontalPosition thePosition)
 {
   myTextHPosition = thePosition;
@@ -216,7 +221,6 @@ void Prs3d_DimensionAspect::SetTextHorizontalPosition (const Prs3d_DimensionText
 //function : TextHorizontalPosition
 //purpose  : 
 //======================================================================= 
-
 Prs3d_DimensionTextHorizontalPosition Prs3d_DimensionAspect::TextHorizontalPosition() const
 {
   return myTextHPosition;
@@ -226,7 +230,6 @@ Prs3d_DimensionTextHorizontalPosition Prs3d_DimensionAspect::TextHorizontalPosit
 //function : ArrowAspect
 //purpose  : 
 //=======================================================================
-
 Handle(Prs3d_ArrowAspect) Prs3d_DimensionAspect::ArrowAspect () const
 {
   return myArrowAspect;
@@ -236,7 +239,6 @@ Handle(Prs3d_ArrowAspect) Prs3d_DimensionAspect::ArrowAspect () const
 //function : SetArrowAspect
 //purpose  : 
 //=======================================================================
-
 void Prs3d_DimensionAspect::SetArrowAspect (const Handle(Prs3d_ArrowAspect)& theAspect)
 {
   myArrowAspect = theAspect;
@@ -246,7 +248,6 @@ void Prs3d_DimensionAspect::SetArrowAspect (const Handle(Prs3d_ArrowAspect)& the
 //function : SetExtensioSize
 //purpose  : 
 //=======================================================================
-
 void Prs3d_DimensionAspect::SetExtensionSize (const Standard_Real theSize)
 {
   myExtensionSize = theSize;
@@ -256,8 +257,43 @@ void Prs3d_DimensionAspect::SetExtensionSize (const Standard_Real theSize)
 //function : ExtensionSize
 //purpose  : 
 //=======================================================================
-
 Standard_Real Prs3d_DimensionAspect::ExtensionSize() const
 {
   return myExtensionSize;
 }
+
+//=======================================================================
+//function : SetShortExtensionSize
+//purpose  : 
+//=======================================================================
+void Prs3d_DimensionAspect::SetArrowTailSize (const Standard_Real theSize)
+{
+  myArrowTailSize = theSize;
+}
+
+//=======================================================================
+//function : ShortExtensionSize
+//purpose  : 
+//=======================================================================
+Standard_Real Prs3d_DimensionAspect::ArrowTailSize() const
+{
+  return myArrowTailSize;
+}
+
+//=======================================================================
+//function : SetValueStringFormat
+//purpose  : 
+//=======================================================================
+void Prs3d_DimensionAspect::SetValueStringFormat (const TCollection_AsciiString& theFormat)
+{
+  myValueStringFormat = theFormat;
+}
+
+//=======================================================================
+//function : ValueStringFormat
+//purpose  : 
+//=======================================================================
+TCollection_AsciiString Prs3d_DimensionAspect::ValueStringFormat() const
+{
+  return myValueStringFormat;
+}