Products - VISCO Examples

Code examples for creating a VISCO Manager

Using a C++ Application to Create the Manager

#include 
#include 

Visco::VisManagerClient* managerClientPtr = 
	(Visco::VisManagerClient*) NULL;

HWND hWnd;

hWnd = CreateWindow(	szWindowClass, szTitle, 
	WS_OVERLAPPEDWINDOW|WS_CLIPCHILDREN,
	CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, 
	NULL, NULL, hInstance, NULL);

if ( ! hWnd) 
{
   return FALSE;
}

ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);

initVisco(hWnd);

Methods for creating the VISCO Manager

void initVisco(HWND hWnd)
{

Instance and initialize the VisLoaderClient.

   Visco::VisLoaderClient loaderClient;

   if (loaderClient.init() == false)
   {
      cerr << "ERROR: Can't contact VISCO loader!" << endl;
      return;
   }

   cerr << "VISCO loader contacted ..." << endl;

Visco::VisWindowInfo structure is filled

   Visco::VisWindowInfo winInfo;
   winInfo.winId = (long) hWnd;
   winInfo.winSize.x = winInfo.winSize.y = 500;

and creates a VisManagerClient. Once the VisManager has been shut down, the pointer should be enabled using a delete cue.

   managerClientPtr = loaderClient.createVisManager(winInfo);

   assert(managerClientPtr != NULL);

The VISCO viewport is generated here. After this cue, the VISCO window should appear in the overriding window.

   if (managerClientPtr->createViewport(winInfo) == false)
   {
      cerr << "ERROR: Can't create VISCO window!" << endl;
		return;
   }
}

Using a Java Application to Create the Manager

import com.m4com.core.*;
import com.m4com.visco.*;
import com.m4com.ViscoIdl.*;

...

VisLoaderClient               theVisLoaderClient  = null;
VisManagerClient              theVisManagerClient = null; 

Here a VISCO widget based on an AWT canvas is generated. The Widget is then inserted into the required position in the application.

VisCanvas                     theVisCanvas = new VisCanvas(); 

Instance and initialize the VisLoaderClient. This cue forwards the "args" array with additional parameters to the VisLoaderClient.

   theVisLoaderClient = new VisLoaderClient(args);

Method for generating a VisManager object

public void createVisco()
{
   // ----------------------------------------------------------
   // Create a VISCO Instance ...

Start a VISCO instance and connect to the VisManager. The "createVisManager()" method returns an initialized VisManagerClient.

   theVisManagerClient = theVisLoaderClient.createVisManager();

   try
   {

Finally, the VICO viewport is created. The "createViewport()" takes as its value a VisCanvas in which the images and maps are to be displayed. After this cue, the VISCO window should be visible in the overriding window.

      if (theVisManagerClient.createViewport(this.theVisCanvas) 
      	== false)
      {
         theVisManagerClient.shutdown();
         theVisLoaderClient.shutdown();
         System.err.println("ERROR: Can't 
         	create viewport! Exit.");
         System.exit(1);
      }
   }
   catch (InvalidOpenGlDrawable e)
   {
      theVisManagerClient.shutdown();
      theVisLoaderClient.shutdown();
      System.err.println("ERROR: Can't create viewport! Exit.");
      System.exit(1);
   }

}
[ AGB ] [ IMPRESSUM ] [ DATENSCHUTZ / PRIVACY ]
[ english ] [ deutsch ]