1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-06-30 12:14:08 +03:00
occt/src/Graphic3d/Graphic3d_TransformPers.cxx
kgv 778cd66786 0027860: Visualization - clean up Transformation Persistence API
Graphic3d_Camera::TransformMatrices redundant NCollection_Handle usage
has been replaced with validity flags.

Graphic3d_TransModeFlags now defined as enumeration, not integer bit flags.
Graphic3d_TMF_PanPers and Graphic3d_TMF_FullPers have been removed.
Graphic3d_TMF_ZoomRotatePers has been introduced.

Graphic3d_TransformPers is now inherits Standard_Transient.
Graphic3d_TransformPers now defines dedicated constructors
for 3D persistence (zoom / rotate) and 2D persistence (2d / trihedron).
2D persistence now supports dedicated values for X and Y offsets.
The corner is now specified by enumeration Aspect_TypeOfTriedronPosition
instead of indirect interpretation of anchor point values.
Fixed handling of Graphic3d_TMF_ZoomRotatePers (combination of Graphic3d_TMF_RotatePers + Graphic3d_TMF_ZoomPers).

PrsMgr_PresentableObject, Graphic3d_CStructure now hold
Handle(Graphic3d_TransformPers) instead of a value.
Method ::SetTransformPersistence(), ::TransformPersistence()
now works with Handle(Graphic3d_TransformPers).
Old methods have been marked deprecated.
2016-09-30 09:43:12 +03:00

54 lines
2.0 KiB
C++

// Copyright (c) 2016 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 <Graphic3d_TransformPers.hxx>
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_TransformPers, Standard_Transient)
// =======================================================================
// function : FromDeprecatedParams
// purpose :
// =======================================================================
Handle(Graphic3d_TransformPers) Graphic3d_TransformPers::FromDeprecatedParams (Graphic3d_TransModeFlags theFlag,
const gp_Pnt& thePoint)
{
Handle(Graphic3d_TransformPers) aTrsfPers;
if (Graphic3d_TransformPers::IsZoomOrRotate (theFlag))
{
aTrsfPers = new Graphic3d_TransformPers (theFlag, thePoint);
}
else if (Graphic3d_TransformPers::IsTrihedronOr2d (theFlag))
{
Standard_Integer aCorner = Aspect_TOTP_CENTER;
const Graphic3d_Vec2i anOffset (Standard_Integer(thePoint.Z()), Standard_Integer(thePoint.Z()));
if (thePoint.X() > 0.0)
{
aCorner |= Aspect_TOTP_RIGHT;
}
else if (thePoint.X() < 0.0)
{
aCorner |= Aspect_TOTP_LEFT;
}
if (thePoint.Y() > 0.0)
{
aCorner |= Aspect_TOTP_TOP;
}
else if (thePoint.Y() < 0.0)
{
aCorner |= Aspect_TOTP_BOTTOM;
}
aTrsfPers = new Graphic3d_TransformPers (theFlag, Aspect_TypeOfTriedronPosition(aCorner), anOffset);
}
return aTrsfPers;
}