0027860: Visualization - clean up Transformation Persistence API
[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}