DG Kernel (ActiveX) Documentation


Skip Navigation Links.
Start page
Quick Start
Search Page
Installation
What is new
Upgrading Native Apps
Licensing
Collapse ModelsModels
Collapse DG Kernel ControlsDG Kernel Controls
Collapse API ReferenceAPI Reference
Interface List
Vector Space
Collapse General GeometryGeneral Geometry
Collapse ModelModel
Collapse ViewView
Collapse General ComputingGeneral Computing
Collapse Samples and TutorialsSamples and Tutorials
Collapse GraphicsGraphics
Collapse Math ObjectsMath Objects
Collapse DeprecatedDeprecated
Redistribution
Model Viewer
Open Source
Support
Skip Navigation Links Go to DGKC docs Search Documentation


ITechnology_DG Interface

GetTechnologyName
GetGlobalObjectPointer
GetPointer
GetInterface
Execute
SetTechnologyToAppCallback
GetInterface2

The interface provides access to technologies used in DG Kernel. It is intended for advanced C++ deveopment where some modification of open source of a third party component is required. It queries major global objects from the component, maps them to DG Kernel entities when possible and establishes communication both ways between DG Kernel based application and the third party component

The interface can be queried from IGlobalAPI_KC with

ITechnology_DG* iTechnology = NULL;
iKcApi->GetTechnology("OCCT", &iTechnology);

Or
iKcApi->GetTechnology("Ogre", &iTechnology);

See also OCCT Bridge sample, Ogre Bridge sample

POSNT type below must be considered as (cast to) void*


HRESULT GetTechnologyName(BSTR* name)

Returns name of this technology ("OCCT" or "Ogre" in this version).

HRESULT GetGlobalObjectPointer(char* type, POSNT* pp)

Parameters

type - [in] Type of the item requested. See remarks

pp - [out,retval] The requested pointer. See remarks

Remarks:

Returns pointer to the specified object in the technolgy. There are no object obtainable in this way in the OCCT technology. For Ogre technology the only valid opion for type is "Root", in which case the returned value is Ogre::Root* pointer of the only Ogre::Root object.


HRESULT GetPointer(IUnknown* objectFrom, char* interfaceNameFrom, char* requestedPointer, POSNT* outPointer)

Parameters

objectFrom - [in] DG Kernel object, which has acces to the requested pointer

interfaceNameFrom - [in] The actual name of the objectFrom interface

requestedPointer - [in] Specifies (enumerates) the requested pointer. See remarks

outPointer - [out,retval] The requested pointer

Remarks:

Maps DG Kernel objects to the technology. Returns pointer to the specified object in the technolgy. objectFrom specifies either DG Kernel view or a specific DG Kernel item, which owns or can be mapped to the requested object. Valid options for input and type of retun are listed below:

OCCT Technology

objectFrom interfaceNameFrom requestedPointer Returned type
IView* "IView" "TDocStd_Application" Handle_AIS_TDocStd_Application*
IView* "IView" "TDocStd_Document" Handle_TDocStd_Document*
IView* "IView" "V3d_Viewer" Handle_V3d_Viewer*
IView* "IView" "AIS_InteractiveContext" Handle_AIS_InteractiveContext*
IEntity_DG* "IEntity_DG" "TopoDS_Shape" TopoDS_Shape*
ISection* "ISection" "TopoDS_Shape" TopoDS_Shape*
ISection* "ISection" "AIS_Shape" Handle_AIS_Shape*

When requestedPointer  is "TDocStd_Application" the returned pointer must be dereferenced immediately and stored like:
POSNT p = NULL;
iTechnology->GetPointer(iView, "IView", "TDocStd_Application", &p);
Handle_TDocStd_Application hApp = *((Handle_TDocStd_Application*)p);

See OcctBridgeView::DoTest() in OCCT Bridge sample

Ogre Technology

objectFrom interfaceNameFrom requestedPointer Returned type
IView* "IView" "RenderWindow" Ogre::RenderWindow*
IView* "IView" "SceneManager" Ogre::SceneManager*
IView* "IView" "Camera" Ogre::Camera*
IView* "IView" "RenderSystem" Ogre::RenderSystem*
IView* "IView" "RootSceneNode" Ogre::RootSceneNode*

Example:
POSNT p = NULL;
iTechnology->GetPointer(iView, "IView", "Camera", &p);
Ogre::Camera* cam = (Ogre::Camera*)p;

See OcctBridgeView::DoTest() in Ogre Bridge sample


HRESULT GetInterface(POSNT pointer, char* pointerType, char* interfaceName, IUnknown** interf)

Parameters

pointer - [in] Pointer to an object in the technology

pointerType - [in] Specifies (enumerates) type of  the technology object

interfaceName - [in] Name of the DG Kernel interface to be obtained.

interf - [out,retval] The requested interface

Remarks:

Returns the specified DG Kernel interface. The method provides reverse mapping of the technology to DG Kernel, where possible.  pointer points to an object in the technology. Valid options for input and type of the retun are listed below:

OCCT Technology

pointer pointerType interfaceName Returned interf
TopoDS_Shape* "TopoDS_Shape" "ISection" ISection*

Ogre Technology

pointer pointerType interfaceName Returned interf
SceneNode* "SceneNode" "ISection" ISection*
SceneNode* "SceneNode" "IItem" IItem*
Renderable* "Renderable" "ISection" ISection*
Renderable* "Renderable" "IItem" IItem*

HRESULT Execute(char* operation, __int64 param0, __int64 param1)

Parameters

operation,param0,param1 - [in] User-defined generic parameters. See remarks

Remarks:

The method provides a way for the DG Kernel based application to call functionality implemented in the technology modules directly. DG Kernel passes the call to the technology object (see below) without any other action.

OCCT Technology

 The call is passed to OcctDgBridge::ExecuteDg(const char* operation, __int64 param0, __int64 param1) method of the OcctDgBridge theOcctDgBridge; global object. The implementation of the method and definition of theOcctDgBridge are located in DG Kernel\ThirdParty\OCCT\src\TDocStd\OcctDgBridge.cxx added to ApplicationFramework\TKLCAF project of the DG Kernel\ThirdParty\OCCT\adm\msvc\vc12\OCCT.sln solution.

The default implementation of OcctDgBridge::ExecuteDg() is used only by the OCCT Bridge sample and can be safely replaced with any custom code

Ogre Technology

The call is passed to the Root::ExecuteDg(const String& operation, __int64 param0, __int64 param1) method of the Ogre::Root class in DG Kernel\ThirdParty\Ogre\ogre\ogremain\src\ogreroot.cpp

The default implementation of Root::ExecuteDg() is used only by the Ogre Bridge sample and can be safely replaced with any custom code


HRESULT SetTechnologyToAppCallback(bool(*func)(__int64 implementationObj, const char* operation, __int64 param0, __int64 param1), __int64 implementnObj)

Parameters

func - [in] Pointer to a callback function, implemented in DG Kernel based application

implementnObj - [in] Any pass through parameter. Its value will be passed as the first parameter to any func calls;

Remarks:

The method provides a way for DG Kernel-based applications to receive calls from modified technology code. To use this functionality:

  • Implement funct in your DG Kernel-based application
  • Call this method on start of your application
  • Call OcctDgBridge::ExecuteApplicationCallbackDg() (OCCT) or Root::ExecuteDg() (Ogre) (See remarks for the Execute method above) from your technology customisation code

The implementnObj parameter is provided for convenience. The suggested use is for identofication of the objects, which implements the callback in case a global function is not convenient. See the Bridge examples. It is not used by DG Kernel.


HRESULT GetInterface2(POSNT pointer, char* pointerType, IUnknown* context, char* interfaceName, IUnknown** interf)

Parameters

pointer - [in] Pointer to an object in the technology

pointerType - [in] Specifies (enumerates) type of  the technology object

context - [in] Additional input parameter. See the table below

interfaceName - [in] Name of the DG Kernel interface to be obtained.

interf - [out,retval] The requested interface

Remarks:

Returns the specified DG Kernel interface. The method provides reverse mapping of the technology to DG Kernel, where possible.  pointer points to an object in the technology. Valid options for input and type of the retun are listed below:

OCCT Technology

pointer pointerType context interfaceName Returned interf
TopoDS_Shape* "TopoDS_Shape" IModel_DG "IBRepShape_DG" IBRepShape_DG*

Ogre Technology

pointer pointerType interfaceName Returned interf
SceneNode* "SceneNode" "ISection" ISection*
SceneNode* "SceneNode" "IItem" IItem*
Renderable* "Renderable" "ISection" ISection*
Renderable* "Renderable" "IItem" IItem*