Open CASCADE Technology  7.7.0
Public Member Functions | Static Public Member Functions | Data Fields | Protected Member Functions

DE_Wrapper Class Reference

The main class for working with CAD file exchange. Loads and Saves special CAD transfer property. Consolidates all supported Formats and Vendors. Automatically recognizes CAD format and uses the preferred existed Vendor. Note: If Vendor's format is not binded, the configuration loading doesn't affect on its property. More...

#include <DE_Wrapper.hxx>

Inheritance diagram for DE_Wrapper:
Inheritance graph
[legend]

Public Member Functions

 DE_Wrapper ()
 Initializes all field by default. More...
 
 DE_Wrapper (const Handle< DE_Wrapper > &theWrapper)
 Copies values of all fields. More...
 
Standard_Boolean Read (const TCollection_AsciiString &thePath, Handle< TDocStd_Document > &theDocument, Handle< XSControl_WorkSession > &theWS, const Message_ProgressRange &theProgress=Message_ProgressRange())
 Reads a CAD file, according internal configuration. More...
 
Standard_Boolean Write (const TCollection_AsciiString &thePath, const Handle< TDocStd_Document > &theDocument, Handle< XSControl_WorkSession > &theWS, const Message_ProgressRange &theProgress=Message_ProgressRange())
 Writes a CAD file, according internal configuration. More...
 
Standard_Boolean Read (const TCollection_AsciiString &thePath, Handle< TDocStd_Document > &theDocument, const Message_ProgressRange &theProgress=Message_ProgressRange())
 Reads a CAD file, according internal configuration. More...
 
Standard_Boolean Write (const TCollection_AsciiString &thePath, const Handle< TDocStd_Document > &theDocument, const Message_ProgressRange &theProgress=Message_ProgressRange())
 Writes a CAD file, according internal configuration. More...
 
Standard_Boolean Read (const TCollection_AsciiString &thePath, TopoDS_Shape &theShape, Handle< XSControl_WorkSession > &theWS, const Message_ProgressRange &theProgress=Message_ProgressRange())
 Reads a CAD file, according internal configuration. More...
 
Standard_Boolean Write (const TCollection_AsciiString &thePath, const TopoDS_Shape &theShape, Handle< XSControl_WorkSession > &theWS, const Message_ProgressRange &theProgress=Message_ProgressRange())
 Writes a CAD file, according internal configuration. More...
 
Standard_Boolean Read (const TCollection_AsciiString &thePath, TopoDS_Shape &theShape, const Message_ProgressRange &theProgress=Message_ProgressRange())
 Reads a CAD file, according internal configuration. More...
 
Standard_Boolean Write (const TCollection_AsciiString &thePath, const TopoDS_Shape &theShape, const Message_ProgressRange &theProgress=Message_ProgressRange())
 Writes a CAD file, according internal configuration. More...
 
Standard_Boolean Load (const TCollection_AsciiString &theResource="", const Standard_Boolean theIsRecursive=Standard_True)
 Updates values according the resource file. More...
 
Standard_Boolean Load (const Handle< DE_ConfigurationContext > &theResource, const Standard_Boolean theIsRecursive=Standard_True)
 Updates values according the resource. More...
 
Standard_Boolean Save (const TCollection_AsciiString &theResourcePath, const Standard_Boolean theIsRecursive=Standard_True, const TColStd_ListOfAsciiString &theFormats=TColStd_ListOfAsciiString(), const TColStd_ListOfAsciiString &theVendors=TColStd_ListOfAsciiString())
 Writes configuration to the resource file. More...
 
TCollection_AsciiString Save (const Standard_Boolean theIsRecursive=Standard_True, const TColStd_ListOfAsciiString &theFormats=TColStd_ListOfAsciiString(), const TColStd_ListOfAsciiString &theVendors=TColStd_ListOfAsciiString())
 Writes configuration to the string. More...
 
Standard_Boolean Bind (const Handle< DE_ConfigurationNode > &theNode)
 Creates new node copy and adds to the map. More...
 
Standard_Boolean Find (const TCollection_AsciiString &theFormat, const TCollection_AsciiString &theVendor, Handle< DE_ConfigurationNode > &theNode) const
 Finds a node associated with input format and vendor. More...
 
void ChangePriority (const TCollection_AsciiString &theFormat, const TColStd_ListOfAsciiString &theVendorPriority, const Standard_Boolean theToDisable=Standard_False)
 Changes provider priority to one format if it exists. More...
 
void ChangePriority (const TColStd_ListOfAsciiString &theVendorPriority, const Standard_Boolean theToDisable=Standard_False)
 Changes provider priority to all loaded nodes. More...
 
const DE_ConfigurationFormatMapNodes () const
 Gets format map, contains vendor map with nodes. More...
 
Handle< DE_WrapperCopy () const
 Copies values of all fields. More...
 
- Public Member Functions inherited from Standard_Transient
 Standard_Transient ()
 Empty constructor. More...
 
 Standard_Transient (const Standard_Transient &)
 Copy constructor – does nothing. More...
 
Standard_Transientoperator= (const Standard_Transient &)
 Assignment operator, needed to avoid copying reference counter. More...
 
virtual ~Standard_Transient ()
 Destructor must be virtual. More...
 
virtual void Delete () const
 Memory deallocator for transient classes. More...
 
virtual const opencascade::handle< Standard_Type > & DynamicType () const
 Returns a type descriptor about this object. More...
 
Standard_Boolean IsInstance (const opencascade::handle< Standard_Type > &theType) const
 Returns a true value if this is an instance of Type. More...
 
Standard_Boolean IsInstance (const Standard_CString theTypeName) const
 Returns a true value if this is an instance of TypeName. More...
 
Standard_Boolean IsKind (const opencascade::handle< Standard_Type > &theType) const
 Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism. More...
 
Standard_Boolean IsKind (const Standard_CString theTypeName) const
 Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism. More...
 
Standard_TransientThis () const
 Returns non-const pointer to this object (like const_cast). For protection against creating handle to objects allocated in stack or call from constructor, it will raise exception Standard_ProgramError if reference counter is zero. More...
 
Standard_Integer GetRefCount () const
 Get the reference counter of this object. More...
 
void IncrementRefCounter () const
 Increments the reference counter of this object. More...
 
Standard_Integer DecrementRefCounter () const
 Decrements the reference counter of this object; returns the decremented value. More...
 

Static Public Member Functions

static Handle< DE_WrapperGlobalWrapper ()
 Gets global configuration singleton. More...
 
- Static Public Member Functions inherited from Standard_Transient
static const char * get_type_name ()
 Returns a type descriptor about this object. More...
 
static const opencascade::handle< Standard_Type > & get_type_descriptor ()
 Returns type descriptor of Standard_Transient class. More...
 

Data Fields

DE_ConfigurationNode::DE_SectionGlobal GlobalParameters
 Internal parameters for the all translators. More...
 

Protected Member Functions

void sort (const Handle< DE_ConfigurationContext > &theResource)
 Sorts the vendors according to the priority to work Formats omitted from the resource are not modified Vendors omitted from the format scope are disabled. More...
 
Standard_Boolean findProvider (const TCollection_AsciiString &thePath, const Standard_Boolean theToImport, Handle< DE_Provider > &theProvider) const
 Find available provider from the configuration. If there are several providers, choose the one with the highest priority. More...
 

Additional Inherited Members

- Public Types inherited from Standard_Transient
typedef void base_type
 Returns a type descriptor about this object. More...
 

Detailed Description

The main class for working with CAD file exchange. Loads and Saves special CAD transfer property. Consolidates all supported Formats and Vendors. Automatically recognizes CAD format and uses the preferred existed Vendor. Note: If Vendor's format is not binded, the configuration loading doesn't affect on its property.

Nodes are grouped by Vendor's name and Format's type. The Vendors may have the same supported CAD formats. Use a Vendor's priority for transfer operations.

The algorithm for standalone transfer operation: 1) Work with global wrapper directly or make deep copy and work with it 2) Update the supported vendors and formats 2.1) Create and initialize specialized configuration node of the required format and Vendor. 2.2) Bind the created node to the internal map(::Bind) 3) Configure the transfer property by resource string or file (::Load) 3.1) Configuration can disable or enable some Vendors and formats 3.2) Configuration can change the priority of Vendors 4) Initiate the transfer process by calling "::Write" or "::Read" methods 5) Validate the transfer process output

Constructor & Destructor Documentation

◆ DE_Wrapper() [1/2]

DE_Wrapper::DE_Wrapper ( )

Initializes all field by default.

◆ DE_Wrapper() [2/2]

DE_Wrapper::DE_Wrapper ( const Handle< DE_Wrapper > &  theWrapper)

Copies values of all fields.

Parameters
[in]theWrapperobject to copy

Member Function Documentation

◆ Bind()

Standard_Boolean DE_Wrapper::Bind ( const Handle< DE_ConfigurationNode > &  theNode)

Creates new node copy and adds to the map.

Parameters
[in]theNodeinput node to copy
Returns
Standard_True if binded

◆ ChangePriority() [1/2]

void DE_Wrapper::ChangePriority ( const TCollection_AsciiString theFormat,
const TColStd_ListOfAsciiString theVendorPriority,
const Standard_Boolean  theToDisable = Standard_False 
)

Changes provider priority to one format if it exists.

Parameters
[in]theFormatinput node CAD format
[in]theVendorPrioritypriority of work with vendors
[in]theToDisableflag for disabling nodes that are not included in the priority

◆ ChangePriority() [2/2]

void DE_Wrapper::ChangePriority ( const TColStd_ListOfAsciiString theVendorPriority,
const Standard_Boolean  theToDisable = Standard_False 
)

Changes provider priority to all loaded nodes.

Parameters
[in]theVendorPrioritypriority of work with vendors
[in]theToDisableflag for disabling nodes that are not included in the priority

◆ Copy()

Handle< DE_Wrapper > DE_Wrapper::Copy ( ) const

Copies values of all fields.

Returns
new object with the same field values

◆ Find()

Standard_Boolean DE_Wrapper::Find ( const TCollection_AsciiString theFormat,
const TCollection_AsciiString theVendor,
Handle< DE_ConfigurationNode > &  theNode 
) const

Finds a node associated with input format and vendor.

Parameters
[in]theFormatinput node CAD format
[in]theVendorinput node vendor name
[out]theNodeoutput node
Returns
Standard_True if the node is found

◆ findProvider()

Standard_Boolean DE_Wrapper::findProvider ( const TCollection_AsciiString thePath,
const Standard_Boolean  theToImport,
Handle< DE_Provider > &  theProvider 
) const
protected

Find available provider from the configuration. If there are several providers, choose the one with the highest priority.

Parameters
[in]thePathpath to the CAD file
[in]theToImportflag to finds for import. Standard_True-import, Standard_False-export
[out]theProvidercreated new provider
Returns
Standard_True if provider found and created

◆ GlobalWrapper()

static Handle< DE_Wrapper > DE_Wrapper::GlobalWrapper ( )
static

Gets global configuration singleton.

Returns
point to global configuration

◆ Load() [1/2]

Standard_Boolean DE_Wrapper::Load ( const Handle< DE_ConfigurationContext > &  theResource,
const Standard_Boolean  theIsRecursive = Standard_True 
)

Updates values according the resource.

Parameters
[in]theResourceinput resource to use
[in]theIsRecursiveflag to update all nodes
Returns
true if theResource has loaded correctly

◆ Load() [2/2]

Standard_Boolean DE_Wrapper::Load ( const TCollection_AsciiString theResource = "",
const Standard_Boolean  theIsRecursive = Standard_True 
)

Updates values according the resource file.

Parameters
[in]theResourcefile path to resource or resource value
[in]theIsRecursiveflag to update all nodes
Returns
true if theResource has loaded correctly

◆ Nodes()

const DE_ConfigurationFormatMap& DE_Wrapper::Nodes ( ) const

Gets format map, contains vendor map with nodes.

Returns
internal map of formats

◆ Read() [1/4]

Standard_Boolean DE_Wrapper::Read ( const TCollection_AsciiString thePath,
Handle< TDocStd_Document > &  theDocument,
const Message_ProgressRange theProgress = Message_ProgressRange() 
)

Reads a CAD file, according internal configuration.

Parameters
[in]thePathpath to the import CAD file
[out]theDocumentdocument to save result
theProgress[in]progress indicator
Returns
true if Read operation has ended correctly

◆ Read() [2/4]

Standard_Boolean DE_Wrapper::Read ( const TCollection_AsciiString thePath,
Handle< TDocStd_Document > &  theDocument,
Handle< XSControl_WorkSession > &  theWS,
const Message_ProgressRange theProgress = Message_ProgressRange() 
)

Reads a CAD file, according internal configuration.

Parameters
[in]thePathpath to the import CAD file
[out]theDocumentdocument to save result
[in]theWScurrent work session
theProgress[in]progress indicator
Returns
true if Read operation has ended correctly

◆ Read() [3/4]

Standard_Boolean DE_Wrapper::Read ( const TCollection_AsciiString thePath,
TopoDS_Shape theShape,
const Message_ProgressRange theProgress = Message_ProgressRange() 
)

Reads a CAD file, according internal configuration.

Parameters
[in]thePathpath to the import CAD file
[out]theShapeshape to save result
theProgress[in]progress indicator
Returns
true if Read operation has ended correctly

◆ Read() [4/4]

Standard_Boolean DE_Wrapper::Read ( const TCollection_AsciiString thePath,
TopoDS_Shape theShape,
Handle< XSControl_WorkSession > &  theWS,
const Message_ProgressRange theProgress = Message_ProgressRange() 
)

Reads a CAD file, according internal configuration.

Parameters
[in]thePathpath to the import CAD file
[out]theShapeshape to save result
[in]theWScurrent work session
theProgress[in]progress indicator
Returns
true if Read operation has ended correctly

◆ Save() [1/2]

TCollection_AsciiString DE_Wrapper::Save ( const Standard_Boolean  theIsRecursive = Standard_True,
const TColStd_ListOfAsciiString theFormats = TColStd_ListOfAsciiString(),
const TColStd_ListOfAsciiString theVendors = TColStd_ListOfAsciiString() 
)

Writes configuration to the string.

Parameters
[in]theIsRecursiveflag to write values of all nodes
[in]theFormatslist of formats to save. If empty, saves all available
[in]theVendorslist of providers to save. If empty, saves all available
Returns
result resource string

◆ Save() [2/2]

Standard_Boolean DE_Wrapper::Save ( const TCollection_AsciiString theResourcePath,
const Standard_Boolean  theIsRecursive = Standard_True,
const TColStd_ListOfAsciiString theFormats = TColStd_ListOfAsciiString(),
const TColStd_ListOfAsciiString theVendors = TColStd_ListOfAsciiString() 
)

Writes configuration to the resource file.

Parameters
[in]theResourcePathfile path to resource
[in]theIsRecursiveflag to write values of all nodes
[in]theFormatslist of formats to save. If empty, saves all available
[in]theVendorslist of providers to save. If empty, saves all available
Returns
true if the Configuration has saved correctly

◆ sort()

void DE_Wrapper::sort ( const Handle< DE_ConfigurationContext > &  theResource)
protected

Sorts the vendors according to the priority to work Formats omitted from the resource are not modified Vendors omitted from the format scope are disabled.

Parameters
[in]theResourceresource to get priority

◆ Write() [1/4]

Standard_Boolean DE_Wrapper::Write ( const TCollection_AsciiString thePath,
const Handle< TDocStd_Document > &  theDocument,
const Message_ProgressRange theProgress = Message_ProgressRange() 
)

Writes a CAD file, according internal configuration.

Parameters
[in]thePathpath to the export CAD file
[out]theDocumentdocument to export
theProgress[in]progress indicator
Returns
true if Write operation has ended correctly

◆ Write() [2/4]

Standard_Boolean DE_Wrapper::Write ( const TCollection_AsciiString thePath,
const Handle< TDocStd_Document > &  theDocument,
Handle< XSControl_WorkSession > &  theWS,
const Message_ProgressRange theProgress = Message_ProgressRange() 
)

Writes a CAD file, according internal configuration.

Parameters
[in]thePathpath to the export CAD file
[out]theDocumentdocument to export
[in]theWScurrent work session
theProgress[in]progress indicator
Returns
true if Write operation has ended correctly

◆ Write() [3/4]

Standard_Boolean DE_Wrapper::Write ( const TCollection_AsciiString thePath,
const TopoDS_Shape theShape,
const Message_ProgressRange theProgress = Message_ProgressRange() 
)

Writes a CAD file, according internal configuration.

Parameters
[in]thePathpath to the export CAD file
[out]theShapeshape to export
theProgress[in]progress indicator
Returns
true if Write operation has ended correctly

◆ Write() [4/4]

Standard_Boolean DE_Wrapper::Write ( const TCollection_AsciiString thePath,
const TopoDS_Shape theShape,
Handle< XSControl_WorkSession > &  theWS,
const Message_ProgressRange theProgress = Message_ProgressRange() 
)

Writes a CAD file, according internal configuration.

Parameters
[in]thePathpath to the export CAD file
[out]theShapeshape to export
[in]theWScurrent work session
theProgress[in]progress indicator
Returns
true if Write operation has ended correctly

Field Documentation

◆ GlobalParameters

DE_ConfigurationNode::DE_SectionGlobal DE_Wrapper::GlobalParameters

Internal parameters for the all translators.


The documentation for this class was generated from the following file: