cee::exp::ExportVTFx Class Reference

Export current view and model setting as VTFx file. More...

Public Types

enum  ExportType { DISPLAY_MODEL_ONLY, FULL_DATA_MODEL }
 Type of export to perform. More...
 
enum  OverlayPosition { TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT }
 Overlay position in exported VTFx. More...
 

Public Member Functions

 ExportVTFx (ExportType type, ug::UnstructGridModel *model)
 Creates an export object prepared to export the given model. More...
 
 ExportVTFx (ExportType type, ug::UnstructGridModel *model, bool forceIdenticalDatabase)
 Creates an export object prepared to export the given model. This constructor gives the opportunity to optimize the export operations when the database remains the same in between calls to appendCase(). More...
 
void addProperties (const PropertySetCollection &properties)
 Properties to export. More...
 
void addResources (const ImageResources &resources)
 Adds image resources to a VTFx file export. More...
 
void clearPropertiesAndResources ()
 Clears any added properties and resources. More...
 
size_t addPlotData (const Str &plotName, const std::vector< Str > &variableNames, const std::vector< std::vector< double > > &variableValues)
 Adds a plot to be exported to VTFx. More...
 
void setVendorNameAndApplication (const Str &vendorName, const Str &vendorApplication)
 Sets the name of the vendor and application from which it is exported from. More...
 
void setSnapshotImage (Image *snapshotImage)
 Sets a snapshot image for the exported model file. More...
 
void setCaseName (const Str &name)
 Sets the case name. More...
 
void setCaseDescription (const Str &description)
 Sets the case description. More...
 
void setCustomLogo (Image *logoImage, OverlayPosition position)
 Sets a custom logo to be shown at the given position in the view. More...
 
void setVisiblePartsOnly (bool on)
 When this flag is on, only visible parts will be exported in the VTFx file. The default is on. More...
 
void setStartAnimation (bool on)
 When this flag is on and an animation is stored in the VTFx file, it will start automatically when the file is opened. The default is on. More...
 
void setCompressionLevel (unsigned int compressionLevel)
 Sets the level of compression of the VTFx file. Values range from 0 to 9. A value of 0 means no compression, values greater than 0 indicate increasing compression performance and hence larger processing time. The default is 6. More...
 
void setPassword (const Str &password)
 Sets the password used for file encryption. An empty password means no encryption, which is the default. More...
 
void setCreateSignature (bool on)
 When this flag is on, a digital signature is added to the VTFx file. The default is off. More...
 
void setExportRelativeValues (bool on)
 When this flag is on, the true values of results are hidden by storing relative values ranging from 0 to 1. The default is off. More...
 
void setWriteAsciiDataFiles (bool on)
 When this flag is on, the files in the database are written in Ascii format. The default is off. More...
 
void setRelativeDisplacements (bool on)
 When this flag is on, displacements will be considered as relative. More...
 
void setExportOnlyVisibleElements (bool on)
 If FULL_DATA_MODEL is selected, enabling this option will only export visible elements (not filtered by set, scalar value etc). More...
 
bool addUserTextFile (const Str &filename, const Str &content)
 Adds a the string in content as a file into the VTFx archive. More...
 
bool saveCase (const Str &fileName)
 Exports current view as an VTFx model file. More...
 
bool appendCase (const Str &fileName)
 Exports current view as an VTFx model file. More...
 
void close ()
 Closes the exporter, writing any pending blocks to the archive. More...
 
bool saveCase (ug::VTFxMemoryFile *vtfxMemoryFile)
 Exports current view as a memory file. More...
 
bool appendCase (ug::VTFxMemoryFile *vtfxMemoryFile)
 Exports current view as an VTFx model memory file. More...
 

Detailed Description

Export current view and model setting as VTFx file.

The VTF and VTFx file formats are Ceetron's own formats tailored specifically to carry structural mechanics and fluid dynamics data in a very compact form.

By utilizing XML and zip compression, the VTFx format expands the functionality and usefulness of the well established VTF format by adding features for security, adaptability and the ability to carry multiple cases in one file - without compromising on the file size.

VTFx files can be viewed in several products from Ceetron. For instance the free viewers, Ceetron 3D Viewer and Ceetron 3D Plugin for Microsoft Office.

Example:

// Add properties
{
cee::exp::PropertyBuilderVTFx propBuilder(propColl.get(), resources.get());
propBuilder.addFromModel(*model);
propBuilder.addFromView(*view);
exporter.addProperties(*propColl);
exporter.addResources(*resources);
}
// Thumbnail image
{
PtrRef<cee::vis::Image> thumbNailImg = new cee::Image;
view->renderToImage(640, 480, thumbNailImg.get());
exporter.setSnapshotImage(thumbNailImg.get());
}
exporter.setVendorNameAndApplication("MyCompany", "MyApp");
exporter.saveCase(myFilename);
See also
VTFxFileBrowser

Member Enumeration Documentation

Type of export to perform.

Enumerator
DISPLAY_MODEL_ONLY 

Only exports the visible triangles/points/lines as well as any cutting plane or isosurfaces as precomputed items. This gives the smallest file size. Note that it is not possible to move cutting planes or to recompute isosurfaces when loading this file.

FULL_DATA_MODEL 

The full element model (with all internal elements for volume models) is exported to the VTFx file.

Overlay position in exported VTFx.

Enumerator
TOP_LEFT 

Top left corner.

TOP_RIGHT 

Top right corner.

BOTTOM_LEFT 

Bottom left corner.

BOTTOM_RIGHT 

Bottom rigth corner.

Constructor & Destructor Documentation

cee::exp::ExportVTFx::ExportVTFx ( ExportType  type,
ug::UnstructGridModel model 
)

Creates an export object prepared to export the given model.

Parameters
typeThe type of export to perform. DISPLAY_MODEL_ONLY: Only exports the visible triangles/points/lines as well as any cutting plane or isosurfaces as precomputed items. This gives the smallest file size. Note that it is not possible to move cutting planes or to recompute isosurfaces when loading this file. FULL_DATA_MODEL: The full element model (with all internal elements for volume models) is exported to the VTFx file.
modelThe model to export. Whatever is currently shown in the model (as specified in the model spec) will be exported.
cee::exp::ExportVTFx::ExportVTFx ( ExportType  type,
ug::UnstructGridModel model,
bool  forceIdenticalDatabase 
)

Creates an export object prepared to export the given model. This constructor gives the opportunity to optimize the export operations when the database remains the same in between calls to appendCase().

This is the case if the display model has the same geometry and it is generated for the same states for all cases.

The option must not be used if the file already contains cases generated from different models.

Parameters
typeThe type of export to perform. DISPLAY_MODEL_ONLY: Only exports the visible triangles/points/lines as well as any cutting plane or isosurfaces as precomputed items. This gives the smallest file size. Note that it is not possible to move cutting planes or to recompute isosurfaces when loading this file. FULL_DATA_MODEL: The full element model (with all internal elements for volume models) is exported to the VTFx file.
modelThe model to export. Whatever is currently shown in the model (as specified in the model spec) will be exported.
forceIdenticalDatabaseEnables or disables writing optimizations made possible for exports involving a single model

Member Function Documentation

size_t cee::exp::ExportVTFx::addPlotData ( const Str plotName,
const std::vector< Str > &  variableNames,
const std::vector< std::vector< double > > &  variableValues 
)

Adds a plot to be exported to VTFx.

void cee::exp::ExportVTFx::addProperties ( const PropertySetCollection properties)

Properties to export.

Related settings like camera setup, background color and to produce a thumbnail/snapshot image in the VTFx file.

void cee::exp::ExportVTFx::addResources ( const ImageResources resources)

Adds image resources to a VTFx file export.

bool cee::exp::ExportVTFx::addUserTextFile ( const Str filename,
const Str content 
)

Adds a the string in content as a file into the VTFx archive.

The name of the file is filename. The file will be stored in the "UserData" VTFx directory.

Previously added files with the same name will be overwritten.

Returns false if an error occurred.

bool cee::exp::ExportVTFx::appendCase ( const Str fileName)

Exports current view as an VTFx model file.

The current view will be added as a case to an existing VTFx model file.

Returns true on success.

bool cee::exp::ExportVTFx::appendCase ( ug::VTFxMemoryFile vtfxMemoryFile)

Exports current view as an VTFx model memory file.

The current view will be added as a case to an existing VTFx model memory file.

Returns true on success.

void cee::exp::ExportVTFx::clearPropertiesAndResources ( )

Clears any added properties and resources.

void cee::exp::ExportVTFx::close ( )

Closes the exporter, writing any pending blocks to the archive.

bool cee::exp::ExportVTFx::saveCase ( const Str fileName)

Exports current view as an VTFx model file.

Returns true on success.

bool cee::exp::ExportVTFx::saveCase ( ug::VTFxMemoryFile vtfxMemoryFile)

Exports current view as a memory file.

Returns true on success.

void cee::exp::ExportVTFx::setCaseDescription ( const Str description)

Sets the case description.

void cee::exp::ExportVTFx::setCaseName ( const Str name)

Sets the case name.

void cee::exp::ExportVTFx::setCompressionLevel ( unsigned int  compressionLevel)

Sets the level of compression of the VTFx file. Values range from 0 to 9. A value of 0 means no compression, values greater than 0 indicate increasing compression performance and hence larger processing time. The default is 6.

void cee::exp::ExportVTFx::setCreateSignature ( bool  on)

When this flag is on, a digital signature is added to the VTFx file. The default is off.

void cee::exp::ExportVTFx::setCustomLogo ( Image logoImage,
OverlayPosition  position 
)

Sets a custom logo to be shown at the given position in the view.

The logo will be showed in the Ceetron 3D Viewer.

void cee::exp::ExportVTFx::setExportOnlyVisibleElements ( bool  on)

If FULL_DATA_MODEL is selected, enabling this option will only export visible elements (not filtered by set, scalar value etc).

void cee::exp::ExportVTFx::setExportRelativeValues ( bool  on)

When this flag is on, the true values of results are hidden by storing relative values ranging from 0 to 1. The default is off.

void cee::exp::ExportVTFx::setPassword ( const Str password)

Sets the password used for file encryption. An empty password means no encryption, which is the default.

void cee::exp::ExportVTFx::setRelativeDisplacements ( bool  on)

When this flag is on, displacements will be considered as relative.

void cee::exp::ExportVTFx::setSnapshotImage ( Image snapshotImage)

Sets a snapshot image for the exported model file.

void cee::exp::ExportVTFx::setStartAnimation ( bool  on)

When this flag is on and an animation is stored in the VTFx file, it will start automatically when the file is opened. The default is on.

void cee::exp::ExportVTFx::setVendorNameAndApplication ( const Str vendorName,
const Str vendorApplication 
)

Sets the name of the vendor and application from which it is exported from.

void cee::exp::ExportVTFx::setVisiblePartsOnly ( bool  on)

When this flag is on, only visible parts will be exported in the VTFx file. The default is on.

void cee::exp::ExportVTFx::setWriteAsciiDataFiles ( bool  on)

When this flag is on, the files in the database are written in Ascii format. The default is off.