// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
+#include <DrawTrSurf_Polygon3D.hxx>
#include <Draw_Color.hxx>
#include <Draw_Display.hxx>
-#include <Draw_Drawable3D.hxx>
#include <Draw_MarkerShape.hxx>
-#include <DrawTrSurf_Polygon3D.hxx>
#include <Poly.hxx>
#include <Poly_Polygon3D.hxx>
-#include <Standard_Type.hxx>
-IMPLEMENT_STANDARD_RTTIEXT(DrawTrSurf_Polygon3D,Draw_Drawable3D)
+IMPLEMENT_STANDARD_RTTIEXT(DrawTrSurf_Polygon3D, Draw_Drawable3D)
//=======================================================================
//function : DrawTrSurf_Polygon3D
-//purpose :
-//=======================================================================
-DrawTrSurf_Polygon3D::DrawTrSurf_Polygon3D(const Handle(Poly_Polygon3D)& P):
- myPolygon3D(P),
- myNodes(Standard_False)
-{
-
-}
-
-//=======================================================================
-//function : Polygon3D
-//purpose :
-//=======================================================================
-
-Handle(Poly_Polygon3D) DrawTrSurf_Polygon3D::Polygon3D() const
-{
- return myPolygon3D;
-}
-
-//=======================================================================
-//function : ShowNodes
-//purpose :
-//=======================================================================
-
-void DrawTrSurf_Polygon3D::ShowNodes(const Standard_Boolean B)
-{
- myNodes = B;
-}
-
-//=======================================================================
-//function : ShowNodes
-//purpose :
+//purpose :
//=======================================================================
-
-Standard_Boolean DrawTrSurf_Polygon3D::ShowNodes() const
+DrawTrSurf_Polygon3D::DrawTrSurf_Polygon3D (const Handle(Poly_Polygon3D)& P)
+: myPolygon3D(P),
+ myNodes(Standard_False)
{
- return myNodes;
+ //
}
//=======================================================================
//function : DrawOn
-//purpose :
+//purpose :
//=======================================================================
-
void DrawTrSurf_Polygon3D::DrawOn(Draw_Display& dis) const
{
dis.SetColor(Draw_jaune);
-
- const TColgp_Array1OfPnt& Points = myPolygon3D->Nodes();
- for (Standard_Integer i = Points.Lower(); i <= Points.Upper()-1; i++) {
+ const TColgp_Array1OfPnt& Points = myPolygon3D->Nodes();
+ for (Standard_Integer i = Points.Lower(); i <= Points.Upper()-1; i++)
+ {
dis.Draw(Points(i), Points(i+1));
}
-
- if (myNodes) {
- for (Standard_Integer i = Points.Lower(); i <= Points.Upper(); i++) {
+ if (myNodes)
+ {
+ for (Standard_Integer i = Points.Lower(); i <= Points.Upper(); i++)
+ {
dis.DrawMarker(Points(i), Draw_X);
}
}
-
}
//=======================================================================
//function : Copy
-//purpose :
+//purpose :
//=======================================================================
-
-Handle(Draw_Drawable3D) DrawTrSurf_Polygon3D::Copy() const
+Handle(Draw_Drawable3D) DrawTrSurf_Polygon3D::Copy() const
{
return new DrawTrSurf_Polygon3D(myPolygon3D);
}
//=======================================================================
//function : Dump
-//purpose :
+//purpose :
//=======================================================================
-
-void DrawTrSurf_Polygon3D::Dump(Standard_OStream& S) const
+void DrawTrSurf_Polygon3D::Dump (Standard_OStream& S) const
{
Poly::Dump(myPolygon3D, S);
}
//=======================================================================
-//function : Whatis
-//purpose :
+//function : Save
+//purpose :
//=======================================================================
+void DrawTrSurf_Polygon3D::Save (Standard_OStream& theStream) const
+{
+#if !defined(_MSC_VER) && !defined(__sgi) && !defined(IRIX)
+ std::ios::fmtflags aFlags = theStream.flags();
+ theStream.setf (std::ios::scientific,std::ios::floatfield);
+ theStream.precision (15);
+#else
+ long aForm = theStream.setf (std::ios::scientific);
+ std::streamsize aPrec = theStream.precision (15);
+#endif
+ Poly::Write (myPolygon3D, theStream);
+#if !defined(_MSC_VER) && !defined(__sgi) && !defined(IRIX)
+ theStream.setf (aFlags);
+#else
+ theStream.setf (aForm);
+ theStream.precision (aPrec);
+#endif
+}
-void DrawTrSurf_Polygon3D::Whatis(Draw_Interpretor& I) const
+//=======================================================================
+//function : Restore
+//purpose :
+//=======================================================================
+Handle(Draw_Drawable3D) DrawTrSurf_Polygon3D::Restore (Standard_IStream& theStream)
{
- I << "polygon3D";
+ return new DrawTrSurf_Polygon3D (Poly::ReadPolygon3D (theStream));
}
+//=======================================================================
+//function : Whatis
+//purpose :
+//=======================================================================
+void DrawTrSurf_Polygon3D::Whatis (Draw_Interpretor& I) const
+{
+ I << "polygon3D";
+}