Hide menu
Loading...
Searching...
No Matches
cadex::ModelPrs_OffscreenViewPort Class Reference

Defines a viewport without any visible window (frame). More...

#include <cadex/ModelPrs_OffscreenViewPort.hxx>

Inheritance diagram for cadex::ModelPrs_OffscreenViewPort:
cadex::Base_PublicObject

Public Types

typedef cadex::internal::ModelPrs_OffscreenViewPortImpl ImplType
 

Public Member Functions

 ModelPrs_OffscreenViewPort ()
 Constructor.
 
bool AttachToScene (const ModelPrs_Scene &theScene)
 Attaches to ModelPrs_Scene.
 
void Resize (unsigned int theWidth, unsigned int theHeight)
 Resizes ViewPort.
 
bool GrabToImage (const Base_UTF16String &thePath) const
 Grab to image in specified thePath.
 
ModelData_PixMap GrabToPixMap () const
 Grab to pixmap.
 
void FitAll ()
 Fit content to ViewPort size.
 
void FitBox (const ModelData_Box &theBox)
 Fit content to box.
 
void RotateToAngle (ModelPrs_AxisType theType, double theAngle)
 Rotate to angle around specified Axis.
 
const ModelPrs_BackgroundStyleBackgroundStyle () const
 Returns a background style.
 
void SetBackgroundStyle (const ModelPrs_BackgroundStyle &theStyle)
 Sets a background style.
 
const ModelPrs_ViewCubeStyleViewCubeStyle () const
 Sets a view cube style.
 
void SetViewCubeStyle (const ModelPrs_ViewCubeStyle &theStyle)
 Returns a view cube style.
 
const ModelData_Box2dViewCubeGeometry () const
 Returns a view cube geometry.
 
void SetViewCubeGeometry (const ModelData_Box2d &theBox)
 Sets a view cube geometry.
 
bool ViewCubeEnabled () const
 Return a view cube enabled state.
 
void SetViewCubeEnabled (bool theEnabled)
 Sets a visibility of view cube.
 
ModelPrs_CameraProjectionType CameraProjectionType () const
 Returns a camera projection type.
 
void SetCameraProjectionType (ModelPrs_CameraProjectionType theProjectionType)
 Sets a camera projection type.
 
void SetCameraPositionType (ModelPrs_CameraPositionType thePositionType)
 Sets a camera position type.
 
void SetCameraView (const ModelData_Point &thePosition, const ModelData_Point &theTarget, const ModelData_Direction &theUp)
 Sets a custom camera position.
 
ModelPrs_Exploder Exploder ()
 Returns object to manage model explosion.
 
- Public Member Functions inherited from cadex::Base_PublicObject
void Nullify ()
 Resets reference to implementation object.
 
bool IsNull () const
 Returns true if the object is nullified.
 
 operator bool () const
 Casts the object to the bool type.
 
internal::Base_HandledObject * Impl () const
 Return a handle to backend (reserved for internal use).
 

Additional Inherited Members

- Protected Member Functions inherited from cadex::Base_PublicObject
 Base_PublicObject (const internal::Base_HandledObject *theObject)
 Constructor (reserved for internal use).
 
template<typename T >
T * GetOrCreateImpl ()
 Reserved for internal use.
 

Detailed Description

Defines a viewport without any visible window (frame).

Warning
This class is a part of Visualization Toolkit add-on, which is licensed separately from the base CAD Exchanger SDK.

The off-screen component encapsulates an unvisible viewport which is used to display objects in 3D space.

See also
Viewport

The following code snippet demonstrates how to use this for image generations:

aScene.AddRoot (aNode);
aViewport.Resize (800, 600);
aViewport.AttachToScene (aScene);
aScene.Update();
aScene.Wait();
aViewPort.GrabToImage ("model.png");
Defines a viewport without any visible window (frame).
Definition: ModelPrs_OffscreenViewPort.hxx:50
void Resize(unsigned int theWidth, unsigned int theHeight)
Resizes ViewPort.
Definition: ModelPrs_OffscreenViewPort.cxx:264
bool AttachToScene(const ModelPrs_Scene &theScene)
Attaches to ModelPrs_Scene.
Definition: ModelPrs_OffscreenViewPort.cxx:257
Provides CAD Exchanger visualization structure.
Definition: ModelPrs_Scene.hxx:39
void AddRoot(ModelPrs_SceneNode &theNode)
Adds a root scene node.
Definition: ModelPrs_Scene.cxx:138
void Wait()
Waiting until all changes are applied by Update method.
Definition: ModelPrs_Scene.cxx:207
void Update(const Base_ProgressStatus &theProgressStatus=Base_ProgressStatus())
Applies changes of attached Scene Nodes.
Definition: ModelPrs_Scene.cxx:188

An off-screen viewport contains a shared pointer to its internal implementation, so simple copying an object will just copy a shared pointer. Therefore any modification of the copied object will propagate to original object.

See also
Using pimpl pattern
Examples
MTKConverter/Program.cs, MTKConverter/main.cxx, visualization/offscreen/Program.cs, and visualization/offscreen/main.cxx.

Member Function Documentation

◆ AttachToScene()

bool cadex::ModelPrs_OffscreenViewPort::AttachToScene ( const ModelPrs_Scene theScene)

Attaches to ModelPrs_Scene.

Scene will notifies attached ViewPort about changes and it will do redraw.

Examples
MTKConverter/Program.cs, MTKConverter/main.cxx, visualization/offscreen/Program.cs, and visualization/offscreen/main.cxx.

◆ BackgroundStyle()

const ModelPrs_BackgroundStyle & cadex::ModelPrs_OffscreenViewPort::BackgroundStyle ( ) const

Returns a background style.

See also
SetBackgroundStyle

◆ CameraProjectionType()

ModelPrs_CameraProjectionType cadex::ModelPrs_OffscreenViewPort::CameraProjectionType ( ) const

Returns a camera projection type.

See also
SetCameraProjectionType

◆ GrabToImage()

bool cadex::ModelPrs_OffscreenViewPort::GrabToImage ( const Base_UTF16String thePath) const

Grab to image in specified thePath.

Requires to provide a full path to output file including extension:

...
aViewPort.GrabToImage ("test.png");
bool GrabToImage(const Base_UTF16String &thePath) const
Grab to image in specified thePath.
Definition: ModelPrs_OffscreenViewPort.cxx:285

The file name extension must be one of .png, .jpg, .bmp, .gif. The image size will equal to ViewPort size. This image size manages by Resize():

aViewPort.Resize (800, 600);
See also
Resize()
Examples
MTKConverter/Program.cs, MTKConverter/main.cxx, visualization/offscreen/Program.cs, and visualization/offscreen/main.cxx.

◆ GrabToPixMap()

ModelData_PixMap cadex::ModelPrs_OffscreenViewPort::GrabToPixMap ( ) const

Grab to pixmap.

The buffer size will equal ViewPort's size (width * height).

See also
Resize()

◆ Resize()

void cadex::ModelPrs_OffscreenViewPort::Resize ( unsigned int  theWidth,
unsigned int  theHeight 
)

Resizes ViewPort.

Both values must be more then zero.

Examples
MTKConverter/Program.cs, MTKConverter/main.cxx, visualization/offscreen/Program.cs, and visualization/offscreen/main.cxx.

◆ SetBackgroundStyle()

void cadex::ModelPrs_OffscreenViewPort::SetBackgroundStyle ( const ModelPrs_BackgroundStyle theStyle)

◆ SetCameraProjectionType()

void cadex::ModelPrs_OffscreenViewPort::SetCameraProjectionType ( ModelPrs_CameraProjectionType  theProjectionType)

◆ SetViewCubeStyle()

void cadex::ModelPrs_OffscreenViewPort::SetViewCubeStyle ( const ModelPrs_ViewCubeStyle theStyle)

Returns a view cube style.

See also
ViewCubeStyle

◆ ViewCubeStyle()

const ModelPrs_ViewCubeStyle & cadex::ModelPrs_OffscreenViewPort::ViewCubeStyle ( ) const

Sets a view cube style.

See also
SetViewCubeStyle