0031313: Foundation Classes - Dump improvement for classes
[occt.git] / src / Prs3d / Prs3d_ArrowAspect.cxx
old mode 100755 (executable)
new mode 100644 (file)
index 32bd939..130d868
@@ -1,62 +1,81 @@
-#define IMP120100      //GG 01/01/00 Add SetColor() methods
+// Copyright (c) 1995-1999 Matra Datavision
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// 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.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
 
-#include <Prs3d_ArrowAspect.ixx>
-
-Prs3d_ArrowAspect::Prs3d_ArrowAspect () 
-     : myAngle(PI/180.*10), myLength(1.) {
-#ifdef IMP120100
-  myArrowAspect = 
-       new Graphic3d_AspectLine3d (
-               Quantity_Color(Quantity_NOC_WHITE), Aspect_TOL_SOLID, 1.0);
-#endif
-}
+#include <Prs3d_ArrowAspect.hxx>
 
+#include <Prs3d_InvalidAngle.hxx>
+#include <Standard_Dump.hxx>
 
-Prs3d_ArrowAspect::Prs3d_ArrowAspect (const Quantity_PlaneAngle anAngle,
-                                     const Quantity_Length aLength) 
-     : myAngle(anAngle), myLength(aLength) {
-#ifdef IMP120100
-  myArrowAspect = 
-       new Graphic3d_AspectLine3d (
-               Quantity_Color(Quantity_NOC_WHITE), Aspect_TOL_SOLID, 1.0);
-#endif
-}
+IMPLEMENT_STANDARD_RTTIEXT(Prs3d_ArrowAspect, Prs3d_BasicAspect)
 
-void Prs3d_ArrowAspect::SetAngle ( const Quantity_PlaneAngle anAngle) {
-  Prs3d_InvalidAngle_Raise_if ( anAngle <= 0.  ||
-                              anAngle >= PI /2. , "");
-  myAngle = anAngle;
-}
-Quantity_PlaneAngle Prs3d_ArrowAspect::Angle () const
+// =======================================================================
+// function : Prs3d_ArrowAspect
+// purpose  :
+// =======================================================================
+Prs3d_ArrowAspect::Prs3d_ArrowAspect()
+: myArrowAspect (new Graphic3d_AspectLine3d (Quantity_Color(Quantity_NOC_WHITE), Aspect_TOL_SOLID, 1.0)),
+  myAngle (M_PI / 180.0 * 10.0),
+  myLength(1.0)
 {
-return myAngle;
+  //
 }
 
-void Prs3d_ArrowAspect::SetLength ( const Quantity_Length aLength)
-{
-  myLength = aLength;
-}
-Quantity_Length Prs3d_ArrowAspect::Length () const
+// =======================================================================
+// function : Prs3d_ArrowAspect
+// purpose  :
+// =======================================================================
+Prs3d_ArrowAspect::Prs3d_ArrowAspect (const Standard_Real theAngle,
+                                      const Standard_Real theLength)
+: myArrowAspect (new Graphic3d_AspectLine3d (Quantity_Color(Quantity_NOC_WHITE), Aspect_TOL_SOLID, 1.0)),
+  myAngle (theAngle),
+  myLength(theLength)
 {
-return myLength;
+  //
 }
 
-void Prs3d_ArrowAspect::Print (Standard_OStream& s) const {
-
-  s << "ArrowAspect: Length: " << myLength << " Angle: " << myAngle;
-
+// =======================================================================
+// function : Prs3d_ArrowAspect
+// purpose  :
+// =======================================================================
+Prs3d_ArrowAspect::Prs3d_ArrowAspect (const Handle(Graphic3d_AspectLine3d)& theAspect)
+: myArrowAspect (theAspect),
+  myAngle (M_PI / 180.0 * 10.0),
+  myLength(1.0)
+{
+  //
 }
 
-#ifdef IMP120100
-void Prs3d_ArrowAspect::SetColor(const Quantity_Color &aColor) {
-  myArrowAspect->SetColor(aColor);
+// =======================================================================
+// function : SetAngle
+// purpose  :
+// =======================================================================
+void Prs3d_ArrowAspect::SetAngle (const Standard_Real theAngle)
+{
+  Prs3d_InvalidAngle_Raise_if (theAngle <= 0.0
+                            || theAngle >= M_PI / 2.0, "Prs3d_ArrowAspect::SetAngle() - angle out of range");
+  myAngle = theAngle;
 }
 
-void Prs3d_ArrowAspect::SetColor(const Quantity_NameOfColor aColor) {
-  SetColor(Quantity_Color(aColor));
-}
+// =======================================================================
+// function : DumpJson
+// purpose  :
+// =======================================================================
+void Prs3d_ArrowAspect::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
+{
+  OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
 
-Handle(Graphic3d_AspectLine3d) Prs3d_ArrowAspect::Aspect() const {
-  return myArrowAspect;
+  OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, myArrowAspect.get())
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myAngle)
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myLength)
 }
-#endif