How to start working with OCAF

To create a useful OCAF-based application, it is necessary to redefine the following two deferred methods: Formats and ResourcesName

In the Formats method, it is necessary to add the format of the documents to be read by the application and which may have been built in other applications.

For example:

void myApplication::Formats(TColStd_SequenceOfExtendedString& Formats)

{

 Formats.Append(TCollection_ExtendedString ("OCAF-myApplication"));

}

In the ResourcesName method, you only define the name of the resource file. This file contains several definitions for the saving and opening mechanisms associated with each format and calling of the plug-in file.

For example:

Standard_CString myApplication::ResourcesName()

{

 return Standard_CString ("Resources");

}

To obtain the saving and opening mechanisms, it is necessary to set two environment variables: CSF_PluginDefaults, which defines the path of the plug-in file and CSF_ResourcesDefault which defines the resource file:

SetEnvironmentVariable ( "CSF_ResourcesDefaults",myDirectory);

SetEnvironmentVariable ( "CSF_PluginDefaults",myDirectory);

The plugin and the resource files of the application will be located in myDirector. The name of the plugin file must be "Plugin".