0031431: Visualization, PrsMgr_PresentableObject - simplify HLR computing interface
[occt.git] / src / Graphic3d / Graphic3d_TransformPers.cxx
CommitLineData
778cd667 1// Copyright (c) 2016 OPEN CASCADE SAS
2//
3// This file is part of Open CASCADE Technology software library.
4//
5// This library is free software; you can redistribute it and/or modify it under
6// the terms of the GNU Lesser General Public License version 2.1 as published
7// by the Free Software Foundation, with special exception defined in the file
8// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9// distribution for complete text of the license and disclaimer of any warranty.
10//
11// Alternatively, this file may be used under the terms of Open CASCADE
12// commercial license or contractual agreement.
13
14#include <Graphic3d_TransformPers.hxx>
15
16IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_TransformPers, Standard_Transient)
17
18// =======================================================================
19// function : FromDeprecatedParams
20// purpose :
21// =======================================================================
22Handle(Graphic3d_TransformPers) Graphic3d_TransformPers::FromDeprecatedParams (Graphic3d_TransModeFlags theFlag,
23 const gp_Pnt& thePoint)
24{
25 Handle(Graphic3d_TransformPers) aTrsfPers;
26 if (Graphic3d_TransformPers::IsZoomOrRotate (theFlag))
27 {
28 aTrsfPers = new Graphic3d_TransformPers (theFlag, thePoint);
29 }
30 else if (Graphic3d_TransformPers::IsTrihedronOr2d (theFlag))
31 {
32 Standard_Integer aCorner = Aspect_TOTP_CENTER;
33 const Graphic3d_Vec2i anOffset (Standard_Integer(thePoint.Z()), Standard_Integer(thePoint.Z()));
34 if (thePoint.X() > 0.0)
35 {
36 aCorner |= Aspect_TOTP_RIGHT;
37 }
38 else if (thePoint.X() < 0.0)
39 {
40 aCorner |= Aspect_TOTP_LEFT;
41 }
42 if (thePoint.Y() > 0.0)
43 {
44 aCorner |= Aspect_TOTP_TOP;
45 }
46 else if (thePoint.Y() < 0.0)
47 {
48 aCorner |= Aspect_TOTP_BOTTOM;
49 }
50 aTrsfPers = new Graphic3d_TransformPers (theFlag, Aspect_TypeOfTriedronPosition(aCorner), anOffset);
51 }
52 return aTrsfPers;
53}
bc73b006 54
55// =======================================================================
56// function : DumpJson
57// purpose :
58// =======================================================================
59void Graphic3d_TransformPers::PersParams3d::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
60{
61 gp_Pnt anAttachPoint (PntX, PntY, PntZ);
62 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &anAttachPoint)
63}
64
65// =======================================================================
66// function : DumpJson
67// purpose :
68// =======================================================================
69void Graphic3d_TransformPers::PersParams2d::DumpJson (Standard_OStream& theOStream, Standard_Integer) const
70{
71 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, OffsetX)
72 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, OffsetY)
73 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, Corner)
74}
75
76// =======================================================================
77// function : DumpJson
78// purpose :
79// =======================================================================
80void Graphic3d_TransformPers::DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth) const
81{
82 OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
83
84 OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMode)
85
86 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myParams.Params3d)
87 OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, &myParams.Params2d)
88}