OpenVSP API Documentation 3.51.3
Loading...
Searching...
No Matches
Background3D Functions

This group of functions is used to work with 3D background images. Click here to return to the main page. More...

Functions

std::string vsp::AddBackground3D ()
int vsp::GetNumBackground3Ds ()
std::vector< std::string > vsp::GetAllBackground3Ds ()
void vsp::ShowAllBackground3Ds ()
void vsp::HideAllBackground3Ds ()
void vsp::DelAllBackground3Ds ()
void vsp::DelBackground3D (const std::string &id)
std::vector< std::string > vsp::GetAllBackground3DRelativePaths ()
std::vector< std::string > vsp::GetAllBackground3DAbsolutePaths ()
std::string vsp::GetBackground3DRelativePath (const std::string &id)
std::string vsp::GetBackground3DAbsolutePath (const std::string &id)
void vsp::SetBackground3DRelativePath (const std::string &id, const std::string &fname)
void vsp::SetBackground3DAbsolutePath (const std::string &id, const std::string &fname)

Detailed Description

Function Documentation

◆ AddBackground3D()

std::string vsp::AddBackground3D ( )
extern

Add a Background3D to model

int nbg = GetNumBackground3Ds();
// Add Background3D
string bg_id = AddBackground3D();
if ( GetNumBackground3Ds() != nbg + 1 )
{
Print( "ERROR: AddBackground3D" );
__failure++;
}
DelBackground3D( bg_id );
std::string AddBackground3D()
int GetNumBackground3Ds()
void DelBackground3D(const std::string &id)
Returns
string ID for added Background3D

◆ DelAllBackground3Ds()

void vsp::DelAllBackground3Ds ( )
extern

Delete all Background3Ds in model

// Add Background3D
int nbg = GetNumBackground3Ds();
if ( nbg != 0 )
{
Print( "ERROR: DelAllBackground3Ds" );
__failure++;
}
void DelAllBackground3Ds()

◆ DelBackground3D()

void vsp::DelBackground3D ( const std::string & id)
extern

Delete specific Background3D frommodel

// Add Background3D
string bg_id = AddBackground3D();
int nbg = GetNumBackground3Ds();
DelBackground3D( bg_id );
if ( GetNumBackground3Ds() != nbg - 1 )
{
Print( "ERROR: DelBackground3D" );
__failure++;
}
Parameters
[in]idstring Background3D ID to delete

◆ GetAllBackground3DAbsolutePaths()

std::vector< std::string > vsp::GetAllBackground3DAbsolutePaths ( )
extern

Get absolute paths to all Background3D images in model.

// Add Background3D
array< string > @bg_file_array = GetAllBackground3DAbsolutePaths();
if ( bg_file_array.length() == 0 )
{
Print( "ERROR: GetAllBackground3DAbsolutePaths returned nothing" );
__failure++;
}
for( int n = 0; n < int( bg_file_array.length() ); n++ )
{
Print( bg_file_array[n] );
}
std::vector< std::string > GetAllBackground3DAbsolutePaths()
Returns
vector<string> Vector of absolute paths to Background3D image files

◆ GetAllBackground3DRelativePaths()

std::vector< std::string > vsp::GetAllBackground3DRelativePaths ( )
extern

Get relative paths to all Background3D images in model. Note that path is relative to the model's \*.vsp3 file. Consequently, if a file has not yet been saved or assigned a file name, the relative path is meaningless.

// Add Background3D
array< string > @bg_file_array = GetAllBackground3DRelativePaths();
if ( bg_file_array.length() == 0 )
{
Print( "ERROR: GetAllBackground3DRelativePaths returned nothing" );
__failure++;
}
for( int n = 0; n < int( bg_file_array.length() ); n++ )
{
Print( bg_file_array[n] );
}
std::vector< std::string > GetAllBackground3DRelativePaths()
Returns
vector<string> Vector of relative paths to Background3D image files

◆ GetAllBackground3Ds()

std::vector< std::string > vsp::GetAllBackground3Ds ( )
extern

Get id's of all Background3Ds in model

int nbg = GetNumBackground3Ds();
// Add Background3D
if ( GetNumBackground3Ds() != nbg + 3 )
{
Print( "ERROR: AddBackground3D" );
__failure++;
}
array< string > @bg_array = GetAllBackground3Ds();
for( int n = 0; n < int( bg_array.length() ); n++ )
{
Print( bg_array[n] );
}
std::vector< std::string > GetAllBackground3Ds()
Returns
vector<string> Vector of Background3D IDs

◆ GetBackground3DAbsolutePath()

std::string vsp::GetBackground3DAbsolutePath ( const std::string & id)
extern

Get absolute path to specified Background3D's image.

// Add Background3D
string bg_id = AddBackground3D();
SetBackground3DAbsolutePath( bg_id, "/user/me/vsp_work/front.png" );
string bg_file = GetBackground3DAbsolutePath( bg_id );
if ( bg_file.length() == 0 )
{
Print( "ERROR: GetBackground3DAbsolutePath returned nothing" );
__failure++;
}
Print( bg_file );
std::string GetBackground3DAbsolutePath(const std::string &id)
void SetBackground3DAbsolutePath(const std::string &id, const std::string &fname)
Parameters
[in]idstring Background3D ID
Returns
string Absolute path to Background3D image file

◆ GetBackground3DRelativePath()

std::string vsp::GetBackground3DRelativePath ( const std::string & id)
extern

Get relative path to specified Background3D's image. Note that path is relative to the model's \*.vsp3 file. Consequently, if a file has not yet been saved or assigned a file name, the relative path is meaningless.

// Add Background3D
string bg_id = AddBackground3D();
SetBackground3DRelativePath( bg_id, "front.png" );
string bg_file = GetBackground3DRelativePath( bg_id );
if ( bg_file.length() == 0 )
{
Print( "ERROR: GetBackground3DRelativePath returned nothing" );
__failure++;
}
Print( bg_file );
void SetBackground3DRelativePath(const std::string &id, const std::string &fname)
std::string GetBackground3DRelativePath(const std::string &id)
Parameters
[in]idstring Background3D ID
Returns
string Relative path to Background3D image file

◆ GetNumBackground3Ds()

int vsp::GetNumBackground3Ds ( )
extern

Get Number of Background3D's in a model

int nbg = GetNumBackground3Ds();
// Add Background3D
string bg_id = AddBackground3D();
if ( GetNumBackground3Ds() != nbg + 1 )
{
Print( "ERROR: AddBackground3D" );
__failure++;
}
DelBackground3D( bg_id );
Returns
int Number of Background3D's in model

◆ HideAllBackground3Ds()

void vsp::HideAllBackground3Ds ( )
extern

Hide all Background3Ds in model

// Add Background3D
if ( GetNumBackground3Ds() != 3 || GetAllBackground3Ds().size() != 3 )
{
Print( "ERROR: the three Background3Ds were not all added" );
__failure++;
}
if ( GetNumBackground3Ds() != 0 || GetAllBackground3Ds().size() != 0 )
{
Print( "ERROR: DelAllBackground3Ds left something behind" );
__failure++;
}
void HideAllBackground3Ds()

◆ SetBackground3DAbsolutePath()

void vsp::SetBackground3DAbsolutePath ( const std::string & id,
const std::string & fname )
extern

Set absolute path to specified Background3D's image.

// Add Background3D
string bg_id = AddBackground3D();
SetBackground3DAbsolutePath( bg_id, "front.png" );
string bg_file = GetBackground3DAbsolutePath( bg_id );
Print( bg_file );
// A relative name is resolved against the working directory, so the path
// that comes back ends with the name that was set.
if ( bg_file.length() == 0 || bg_file.findLast( "front.png" ) < 0 )
{
Print( "ERROR: SetBackground3DAbsolutePath did not take" );
__failure++;
}
Parameters
[in]idstring Background3D ID
[in]fnamestring Absolute path to Background3D image file

◆ SetBackground3DRelativePath()

void vsp::SetBackground3DRelativePath ( const std::string & id,
const std::string & fname )
extern

Set relative path to specified Background3D's image. Note that path is relative to the model's \*.vsp3 file. Consequently, if a file has not yet been saved or assigned a file name, the relative path is meaningless.

// Add Background3D
string bg_id = AddBackground3D();
SetBackground3DRelativePath( bg_id, "front.png" );
if ( GetBackground3DRelativePath( bg_id ) != "front.png" )
{
Print( "ERROR: SetBackground3DRelativePath did not take" );
__failure++;
}
string bg_file = GetBackground3DRelativePath( bg_id );
Print( bg_file );
Parameters
[in]idstring Background3D ID
[in]fnamestring Relative path to Background3D image file

◆ ShowAllBackground3Ds()

void vsp::ShowAllBackground3Ds ( )
extern

Show all Background3Ds in model

// Add Background3D
if ( GetNumBackground3Ds() != 3 || GetAllBackground3Ds().size() != 3 )
{
Print( "ERROR: the three Background3Ds were not all added" );
__failure++;
}
if ( GetNumBackground3Ds() != 0 || GetAllBackground3Ds().size() != 0 )
{
Print( "ERROR: DelAllBackground3Ds left something behind" );
__failure++;
}
void ShowAllBackground3Ds()