The GenesisII Plugin SDK
GenesisII SDK v2.0 - August/1999

Introduction

Support and Plugin Distribution

Versions

Plugin Functions

Callback Reference

Data Types and Structures

Download the Plugin SDK Development Kit


Introduction

GenesisII implements a plugin interface so as to enable the development of additional Geomantics and third-party utilities. The interface provides i/o access to the GenesisII data model and is written with the following main functions in mind :-

1. Direct interface access to GIS systems

2. Custom manipulation of the GenesisII heightfield grid and other structures.

Plugins are simply DLLs and must be located in the plugin subdirectory of the GenesisII home directory. Plugins must have the .glg suffix. Plugins can be written in any language that can create a standalone dll - we supply an example in C++ (created with C++Builder 4).

GenesisII requires that a small number of standard functions are available to be called. In this version of the SDK this is limited to three functions to describe, initialize and run the plugin.

On initialization GenesisII asks the plugin for it's name (which will be added under the Plugin Interfaces section of the menu and SDK version). GenesisII then supplies the plugin with a data structure containing a set of callback functions which are subsequently used by the plugin to access GenesisII functions and data. A typical call into GenesisII will look like this:

  result = G2INTERFACE.GLGCreateNewGrid(NULL,x,y);

With the exception of grid point manipulation, all coordinate information is retrieved and set in terms of the current Georeference information.

Memory allocation and housekeeping functions are the responsibility of the programmer. Some function calls require that memory is allocated and passed as a pointer for holding coordinate or height information - it the programmers responsibility to ensure that the correct size block is allocated and freed as necessary.  


Support and Plugin Distribution

Support for GenesisII and the SDK are available from our website at http://www.geomantics.com or by email at support@geomantics.com. Developers are encouraged to join our email discussion list - currently hosted by onelist at http://www.onelist.com/geomantics.

The SDK is a freeware product. Plugins created with the SDK may be used and distributed royalty-free. Both Freeware and Commercial developments are allowed.

We encourage plugin authors to make there products available to other users. We are happy to place plugins on our site for download on our plugin page at http://www.geomantics.com/plugins.html. We are also happy to make commercial plugins available from our site and process orders for you - please contact us for terms.


Version Control

This is version 2.0 of the SDK. Version 2.0 plugins are required by GenesisII 2.5 and later. Version 1.0 plugins are not supported. Backwards compatibility will be maintained in future versions but in view of the recent release of version 1.0 it was feasible to omit this for simplicity in this version without inconveniencing 3rd party developers.

Changes from version 1.0 are

  1. Modified G2_PLANTPARAMETERS to include near, mid and far file descriptions for L-Parser files (previously used a single file for bmps)
  2. Added G2_URBANPARAMETERS and associated functions to handle Urban Plans
  3. Modified G2_TERRAINLAYER to include urban plan information


Plugin functions

This section describes functions and data types that must be supported by the plugin.

Note that all functions are defined as DLLExport using #define DLLExport extern "C" _stdcall _export


DescribePlugin

DLLExport void* DescribePlugin(
char* description,
int* version
);

Purpose: Returns identification string and SDK version to GenesisII.

This is the first function that GenesisII will call on initialization. The description string will be added to the Plugin Interface menu. The version number is included for forwards compatibility - it must be set to 1 for this version of the SDK or the plugin will be rejected.

 


InitPlugin

DLLExport void* InitPlugin(
G2_INTERFACE* g2,
);

Purpose: Returns list of callback functions to the Plugin.

If GenesisII successfully identifies the plugin it will call this function to pass the plugin a data structure containing a set of callback functions. These will be subsequently used by the plugin to access GenesisII functions and data. A typical call into GenesisII will look like this:

result = G2INTERFACE.GLGCreateNewGrid(NULL,x,y);

 


RunPlugin

DLLExport int* RunPlugin(
);

Purpose: Executes the plugin function code.

This function is called by GenesisII whenever the plugin's menu item is selected. You are responsible for all memory and resources used by the plugin.

 


Callback functions

 

Basic project/grid parameters

Viewing parameters

Working with the Landscape Grid (HeightField)

Working with Terrain Layers

Working with Vegetation/Plants

Working with Urban Plans

Deletion functions for polygons, lines and models

Working with Polygons

Working with Lines

Working with Models

Miscellaneous Calls


GLGGetParameters

DLLExport void GLGGetParameters(
void *self,
G2_PARAMETERS *G2Parameters
);

Purpose: Retrieves basic project and grid information.

This would normally be the first function called by a plugin. It retrieves basic information about grid size, spacing and georeferencing data - see data structures section for details. Note that the initial void pointer to self is a read only pointer used by the underlying Delphi implementation and should normally be passed as NULL. See the Data Structures section for further information on i/o and fields.


GLGSetParameters

DLLExport void GLGSetParameters(
void *self,
G2_PARAMETERS *G2Parameters
);

Purpose: Sets basic project and grid information.

Sets basic project parameters. Note that although for simplicity the same data structure is used as for GLGGetParameters some information is not updates. See data structures section for details. See the Data Structures section for further information on i/o and fields.


GLGGetViewingParameters

DLLExport void GLGGetViewingParameters(
void *self,
G2_VIEWPARAMETERS *G2ViewParameters
);

Purpose: Retrieves basic viewing information.

This function retrieves basic viewing information such as camera, target and lighting positions. For simplicity the SDK does not allow access to GenesisII's atmospheric model. See the Data Structures section for further information on i/o and fields.


GLGSetViewingParameters

DLLExport void* GLGSetViewingParameters(
void *self,
G2_VIEWPARAMETERS *G2ViewParameters
);

Purpose: Sets basic viewing information.

This function sets basic viewing information such as camera, target and lighting positions. For simplicity the SDK does not allow access to GenesisII's atmospheric model. See the Data Structures section for further information on i/o and fields.


GLGCreateNewGrid

DLLExport bool GLGCreateNewGrid(
void *self,

int x,
int y,
float sx,
float sy

);

Purpose: Creates a new heightfield grid.

x,y: Width (x) and Height (y) of new grid.
sx,sy: Grid point spacing in x and y directions.

This function creates a new heightfield grid. All values are set to G2_NULLHEIGHT. Returns true on success and false on failure. Maximum grid size is implementation-dependent but will be always be at least 1201 x 1201 points (USGS 1 degree dem grid size).


GLGGetPointHeight

DLLExport double GLGGetPointHeight(
void *self,

int x,
int y

);

Purpose: Retrieves grid point heights at grid position x,y.

Note that value is returned as double, but internal implementation is only guaranteed as single precision in GenesisII 2.x. Returns -MAXINT on invalid coordinates.


GLGSetPointHeight

DLLExport void GLGSetPointHeight(
void *self,

int x,
int y

);

Purpose: Sets grid point heights at grid position x,y.

Note that value is returned as double, but internal implementation is only guaranteed as single precision in GenesisII 2.x. Returns -MAXINT on invalid coordinates.


GLGGetPointWater

DLLExport bool GLGGetPointWater(
void *self,

int x,
int y

);

Purpose: Retrieves water attribute at grid position x,y.

Returns true if grid point is water (note this refers to lakes, sea etc. and not rivers), otherwise returns false.


GLGSetPointWater

DLLExport void GLGSetPointWater(
void *self,

int x,
int y,
bool isWater,
);

Purpose: Sets water attribute at grid position x,y.

Sets water attribute at grid position x,y to the value of isWater. Set to true for water, false for land. Note that this refers to lakes, sea etc. and not rivers.


GLGGetHeightField

DLLExport void GLGGetHeightField(
void *self,

int Size,
float *HeightField
);

Purpose: Retrieves a heightfield as an array of floats.

GLGGetHeightField retrieves the whole landscape grid in a single call as an array of floats. This is useful (and faster) when working on the whole grid rather than individual points. The programmer is responsible for ensuring that sufficient memory is allocated to retrieve the whole grid and freeing the memory when no longer required.


GLGSetHeightField

DLLExport void GLGSetHeightField(
void *self,

int Size,
float *HeightField
);

Purpose: Sets a heightfield from an array of floats.

GLGSetHeightField sets the the whole landscape grid in a single call from an array of floats. This is useful (and faster) when working on the whole grid rather than individual points. The programmer is responsible for ensuring that sufficient memory is allocated to set the whole grid and freeing the memory when no longer required.


GLGGetTerrainLayerInfo

DLLExport bool GLGGetTerrainLayerInfo(
void *self,

int LayerIdx,
G2_TERRAINLAYER *G2TerrainLayer

);

Purpose: Retrieves Terrain Layer information.

Terrain Layers information corresponds to the information controlled from the Terrain Layers editor in GenesisII.

Returns true on success, false on failure. GenesisII can support many terrain layers, each of which has attributes for factor such as ground color and fractalization, and plant and model placement. Terrain layers are mapped onto the landscape surface as Terrain polygons, lines and points. There is hence a one to many relationship between the landscape and the terrain layers, which in turn has a one to many relationship to polygons, lines or points.

Note that this version of GenesisII always has 4 occurrences of the Surface (G2_SURF) and Plant (G2_PLANT) structures per terrain layer. This will most probably change in future versions of the program and SDK. See the Data Structures section for further information on i/o and fields.


GLGSetTerrainLayerInfo

DLLExport bool GLGSetTerrainLayerInfo(
void *self,

int LayerIdx,
G2_TERRAINLAYER *G2TerrainLayer

);

Purpose: Sets Terrain Layer information.

Terrain Layers information corresponds to the information controlled from the Terrain Layers editor in GenesisII.

Returns true on success, false on failure. GenesisII can support many terrain layers, each of which has attributes for factor such as ground color and fractalization, and plant and model placement. Terrain layers are mapped onto the landscape surface as Terrain polygons, lines and points. There is hence a one to many relationship between the landscape and the terrain layers, which in turn has a one to many relationship to polygons, lines or points.

Note that this version of GenesisII always has 4 occurrences of the Surface (G2_SURF) and Plant (G2_PLANT) structures per terrain layer. This will most probably change in future versions of the program and SDK. See the Data Structures section for further information on i/o and fields.


GLGCreateNewTerrainLayer

DLLExport int GLGCreateNewTerrainLayer(
void *self,

G2_TERRAINLAYER *G2TerrainLayer
);

Purpose: Creates a new terrain layer.

Terrain Layers information corresponds to the information controlled from the Terrain Layers editor in GenesisII.

GLGCreateNewTerrainLayer creates a new terrain layer using the information passed in the G2_TERRAINLAYER structure (note that the value passed in the ID field is ignored and will be set to the new ID on return). If successful the call returns the LayerIdx value for the created layer, otherwise -1 is returned if the call fails.


GLGGetPlantInfo

DLLExport bool GLGGetPlantInfo(
void *self,

int PlantIdx,
G2_PLANTPARAMETERS *G2PlantParameters

);

Purpose: Retrieves Vegetation or Plant information.

Vegetation information corresponds to the information controlled from the Vegetation editor in GenesisII.

Returns true on success, false on failure. GenesisII can support many plants, each of which is a 2D bitmap displayed as a billboard. Vegetation is mapped onto the landscape using the attributes of defined by Terrain layers and polygon or line placement. There is hence a one to many relation ship between the landscape and the plants, terrain layers and plants, and lines/polygons and plants.


GLGSetPlantInfo

DLLExport bool GLGSetPlantInfo(
void *self,

int PlantIdx,
G2_PLANTPARAMETERS *
G2PlantParameters
);

Purpose: Sets Vegetation or Plant information.

Vegetation information corresponds to the information controlled from the Vegetation editor in GenesisII.

Returns true on success, false on failure. GenesisII can support many plants, each of which is a 2D bitmap displayed as a billboard. Vegetation is mapped onto the landscape using the attributes of defined by Terrain layers and polygon or line placement. There is hence a one to many relation ship between the landscape and the plants, terrain layers and plants, and lines/polygons and plants.


GLGCreateNewPlant

DLLExport int GLGCreateNewPlant(
void *self,

G2_PLANTPARAMETERS *G2PlantParameters
);

Purpose: Creates a new plant.

Vegetation information corresponds to the information controlled from the Vegetation editor in GenesisII.

GLGCreateNewPlant creates a new plant using the information passed in the G2_PLANTPARAMETERS structure (note that the value passed in the ID field is ignored and will be set to the new ID on return). If successful the call returns the PlantIdx value for the created layer, otherwise -1 is returned if the call fails.


GLGDeleteAllPolygonsInLayer

DLLExport bool GLGDeleteAllPolygonsInLayer(
void *self,

int LayerIdx
);

Purpose: Deletes all polygons for a terrain layer.

This action corresponds to right clicking on a polygon in GenesisII's landscape editor and selecting 'delete all polygons in this layer'.

Returns true on success, false on failure. Note that GenesisII doesn't actually delete any polygons until the project is saved, the polygons just being flagged as deleted. However no SDK access is available to the polygons once flagged.


GLGDeleteAllLinesInLayer

DLLExport bool GLGDeleteAllLinesInLayer(
void *self,

int LayerIdx
);

Purpose: Deletes all lines for a terrain layer.

This action corresponds to right clicking on a line in GenesisII's landscape editor and selecting 'delete all lines in this layer'.

Returns true on success, false on failure. Note that GenesisII doesn't actually delete any lines until the project is saved, the lines just being flagged as deleted. However no SDK access is available to the lines once flagged.


GLGDeleteAllModelsInLayer

DLLExport bool GLGDeleteAllModelsInLayer(
void *self,

int LayerIdx
);

Purpose: Deletes all models for a terrain layer.

This action corresponds to right clicking on a model in GenesisII's landscape editor and selecting 'delete all models in this layer'.

Returns true on success, false on failure. Note that GenesisII doesn't actually delete any models until the project is saved, the models just being flagged as deleted. However no SDK access is available to the models once flagged.


GLGGetPolygonInfo

DLLExport bool GLGGetPolygonInfo(
void *self,

int PolygonIdx,
G2_POLYGONINFO *G2PolygonInfo

);

Purpose: Retrieves basic information about a polygon.

This call retrieves all information about a polygon - most importantly LayerIdx, and the number of point coordinates which define the polygon (excluding the closing point). It does not retrieve the polygon coordinates themselves as this is variable, instead the programmer should allocate memory to hold an array of floats to define the points and retrieve these by calling GLCGetPolygonCoordinates.

Returns true on success, false on failure. GenesisII can support many polygons, each of which is assigned to a terrain layer. There is hence a one to many relation ship between terrain layers and polygons.


GLGGetPolygonCoordinates

DLLExport bool GLGGetPolygonCoordinates(
void *self,

int PolygonIdx,
G2_POLYGONINFO *
G2PolygonInfo
);

Purpose: Retrieves coordinate information for a polygon.

This call retrieves all points for a polygon as an array of floats (x,y corresponding to alternate items). It is the programmers responsibility to allocate sufficient memory to hold this data before the call and free the memory once used. Failure to allocate sufficient memory may crash GenesisII.

Returns true on success, false on failure.


GLGAddPolygon

DLLExport int GLGAddPolygon(
void *self,

G2_POLYGONINFO *G2PolygonInfo
);

Purpose: Creates a new polygon.

GLGAddPolygon creates a new terrain polygon using the information passed in the G2_POLYGONINFO structure (note that the value passed in the ID field is ignored and will be set to the new ID on return). If successful the call returns the PolygonIdx value for the created layer, otherwise -1 is returned if the call fails. The call validates the terrain layer value passed and will fail if this is not valid. As with GLGGetPolygonCoordinates it is the programmers responsibility to allocate sufficient memory to hold coordinate information.


GLGGetLineInfo

DLLExport bool GLGGetLineInfo(
void *self,

int LineIdx,
G2_LINEINFO *G2LineInfo

);

Purpose: Retrieves basic information about a line.

This call retrieves all information about a line - most importantly LayerIdx, and the number of point coordinates which define the line. It does not retrieve the line coordinates themselves as this is variable, instead the programmer should allocate memory to hold an array of floats to define the points and retrieve these by calling GLCGetLineCoordinates.

Returns true on success, false on failure. GenesisII can support many lines, each of which is assigned to a terrain layer. There is hence a one to many relation ship between terrain layers and lines.


GLGGetLineCoordinates

DLLExport bool GLGGetLineCoordinates(
void *self,

int LineIdx,
G2_LINEINFO *
G2LineInfo
);

Purpose: Retrieves coordinate information for a line.

This call retrieves all points for a line as an array of floats (x,y corresponding to alternate items). It is the programmers responsibility to allocate sufficient memory to hold this data before the call and free the memory once used. Failure to allocate sufficient memory may crash GenesisII.

Returns true on success, false on failure.


GLGAddLine

DLLExport int GLGAddLine(
void *self,

G2_LINEINFO *G2LineInfo
);

Purpose: Creates a new line.

GLGAddLine creates a new terrain line using the information passed in the G2_LINEINFO structure (note that the value passed in the ID field is ignored and will be set to the new ID on return). If successful the call returns the LineIdx value for the created layer, otherwise -1 is returned if the call fails. The call validates the terrain layer value passed and will fail if this is not valid. As with GLGGetLineCoordinates it is the programmers responsibility to allocate sufficient memory to hold coordinate information.


GLGGetModelInfo

DLLExport bool GLGGetModelInfo(
void *self,

int ModelIdx,
G2_MODELINFO *G2ModelInfo

);

Purpose: Retrieves information about a model.

This call retrieves all information about a model. Returns true on success, false on failure. GenesisII can support many models, each of which is assigned to a terrain layer. There is hence a one to many relation ship between terrain layers and models.


GLGAddModel

DLLExport int GLGAddModel(
void *self,

G2_MODELINFO *G2ModelInfo
);

Purpose: Creates a new model.

GLGAddModel creates a new terrain model using the information passed in the G2_MODELINFO structure (note that the value passed in the ID field is ignored and will be set to the new ID on return). If successful the call returns the ModelIdx value for the created layer, otherwise -1 is returned if the call fails. The call validates the terrain layer value passed and will fail if this is not valid.


GLGUpdateChildren

DLLExport bool GLGUpdateChildren(
void *self,

);

Purpose: Forces GenesisII to redraw all children that might be effected by changes.

Although calls to the plugin SDK may change information in the current GenesisII project, none of the windows that might be effected by these changes will be updated automatically - this avoids GenesisII doing repeated redraws whilst the plugin interface is running. However once your plugin has completed it's tasks it should force a redraw if any update changes have been made by calling GLGUpdateChildren as it's final call.


Data Types and Structure

Note that items shown in italics are read-only.


// ** Interface structures **
// These give access to Genesis's drawing model and fall into the following
// categories...
// 1.  Overall Project information and Grid definition
// 2.  Terrain layer definition
// 3.  Terrain structures regions, lines and points definition
// 4.  Vegetation definition
// 5.  Urban definition
// 6.  Camera/Target/Lighting definition
// 7.  General program functionality - refresh etc.
//
// Much of this corresponds directly to the dialog structure of G2, but
// to summerize...
//
//      +---------+        +------+
//      |         |--------| Grid |
//      |         |        +------+   +------------+
//      | Project |-------------------| Atmosphere |
//      |         |                   +----------- +
//      |         |-------------------|   Camera   |
//      +---------+                   +------------+
//       |   |   |
//       |   |   +-------------------------------------------+
//       |   |                                              /|\
//       |   |                               +-------------------------------+
//       |   |                               |          Terrain Layers       |
//       |   |                               +-------------------------------+
//       |   |                                      |         |         |
//       |   |                                     /|\       /|\       /|\
//       |   |                                  +-------+  +-----+  +------+
//       |   |                                  |Regions|  |Lines|  |Models|
//       |   |                                  +-------+  +-----+  +------+
//    +--+   +---+                                |   |     |   |
//    |          |                                |   |     |   |
//    |          |                                |   |     |   |
//    |          |                                |   |     |   |
//    |         /|\                               |   |     |   |
//    |  +---------------+\*4                     |   |     |   |
//    |  |               |------------------------+   |     |   |
//    |  |     Plants    |/                           |     |   |
//    |  |               |\*4                         |     |   |
//    |  |               |----------------------------------+   |
//    |  +---------------+/                           |         |
//   /|\                                              |         |
//  +---------------+                                 |         |
//  |               |---------------------------------+         |
//  |     Urban     |                                           |
//  |               |-------------------------------------------+
//  +---------------+
//
//                                      *region/lines limited to 4 - may change
//---------------------------------------------------------------------------

// project and grid parameter information
struct G2_PARAMETERS
{
 // grid
  int    GridWidth;          // Grid width
  int    GridHeight;         // Grid height
  double GridSpacingX;       // Grid point spacing along x
 double GridSpacingY;       // ...and y
 double MaxHeight;          // Grid max height
  double MinHeight;          // ...and min
 double VerticalScale;      // Vertical scaling
  double GeoRef[4];          // Georeferencing info, top,left:bottom,right
  // Terrain layers and vector information
  int    TerrainLayersCount; // number terrain layers
 int    PlantCount;         // number 2D plant images
 int    PolygonCount;       // Number of polygons
 int    LineCount;          // Number of lines
 int    ModelCount;         // Number of models
 // Directory paths
  char   PlantDir[256];      // Plant model directory
  char   ModelDir[256];      // 3D model directory
 char   Reserved[512];      // Reserved
};

// Camera, Target etc
struct G2_VIEWPARAMETERS
{
 float  CameraPosition[3];  // camera position xyz - y is vertical
  float  TargetPosition[3];  // target position xyz - y is vertical
  double Perspective;        // perspective in degrees
  double LightAltitude;      // Altitude position of light in degrees.  90 is overhead
  double LightAzimuth;       // Azimuth position of light in degrees.    0 is North
 char   Reserved[64];       // Reserved
};

// Surface definition
struct G2_SDEF
{
 float  PrimaryColor[4];    // primary and secondary color series are fractal...
  float  SecondaryColor[4];  // ...mixed to generate the surface
  double Roughness;          // surface roughness
  double Specularity;        // lighting characteristics
  int    Shininess;          //
  double Emission;           //
 char   Reserved[64];       // Reserved
};

// plant used on a terrain
struct G2_PLANT
{
 int    ID;                 // ID of plant - retrieve details with
 double Size;               // size and...
  double Density;            // ...density of plants plotted
 char   Reserved[64];       // Reserved
};

// terrain layer definition
struct G2_TERRAINLAYER
{
  int      ID;                     // Unique key for this layer
  bool     OverrideDefaultColor;   // Override default surface colors
  bool     OverrideDefaultSurface; // Override default surface properties (other tahn colors)
  bool     DrawPlants;             // Draw plants in this layer
  char     Name[256];              // Name of this layer
  bool     DrawLayer;              // polygon drawn in landscape module
  int      SurfaceCount;           // Surfaces - must be 4 for this SDK version
  G2_SDEF  Surface[4];             // Surface definition
  int      PlantCount;             // Plant count - must be 4 for this SDK version
  G2_PLANT Plants[4];              // Plant definition
  char     ModelSource[256];       // 3D model source file - relative path
  double   LineWidth;              // polyline width
  double   ModelSize;              // default model size
  double   ModelRotation;          // default model rotation
  float    LandscapeColor[4];      // color layer is drawn IN LANDSCAPE MODULE
  bool     PolygonLineOnly;        // Draw plants on polygon edges only
  bool     DrawModel;              // Draw 3D models in this layer
  bool     DrawUrban;              // Draw urban plan
  int      UrbanID;                // Urban plan asscoiated with this terrain
  char     Reserved[512];          // Reserved
};

// Plant info
struct G2_PLANTPARAMETERS
{
  int      ID;                // An ID - internal use by G2 only
  char     Name[256];         // Display name for this plant
  char     FarFileName[256];  // BMP source file - far
  char     MidFileName[256];  // BMP source file - mid
  char     NearFileName[256]; // BMP source file - near
  char     Reserved[64];      // Reserved
};

// Urban plans
struct G2_URBANPLAN
{
  int      ID;                  // An ID - internal use by G2 only
  char     Name[256];           // Display name for this plan
  double   SizeX;               // x size in metres of plan
  double   SizeY;               // y size in metres of plan
  double   Height;              // max height in metres of plan
  char     HeightPlan[256];     // BMP source file - far
  char     WallColorPlan[256];  // BMP source file - mid
  char     RoofColorPlan[256];  // BMP source file - near
  int      Zone;                // Urban zone type
  char     Reserved[512];       // Reserved
};

// Polygon info
// Note that responsibility for allocating memory for coordinates is the plugin programmers responsibility
struct G2_POLYGONINFO
{
 int      ID;              // An ID - internal use by G2 only
 bool     Deleted;         // Deleted flag.
  int      TerrainLayerID;  // ID of terrain layer this relates to
  int      CoordinateCount; // coordinates in poly (not including closing point)
  float    *Coordinates;    // Pointer to array of floats holding x,y in georeferenced coordinates
};

// Line info
// Note that responsibility for allocating memory for coordinates is the plugin programmers responsibility
struct G2_LINEINFO
{
 int      ID;              // An ID - internal use by G2 only
 bool     Deleted;         // Deleted flag.
 int      TerrainLayerID;  // ID of terrain layer this relates to
 int      CoordinateCount; // coordinates in poly (not including closing point)
 float    *Coordinates;    // Pointer to array of floats holding x,y
};

// Model info
struct G2_MODELINFO
{
 int      ID;              // An ID - internal use by G2 only
  bool     Deleted;         // Deleted flag.
  int      TerrainLayerID;  // ID of terrain layer this relates to
  float    x;               // x,y position - georeferenced
  float    y;
 float    Size;            // Model size and
  float    Rotation;        // ...Rotation
 char     Reserved[64];    // Reserved
};

// ---- Callback Interface structure returned on plugin initialization -------//
// GensisisII is largely written in Delphi and hence this structure contains  //
// some additions to the normal C/C++ definition.                             //
// The functions reference the current project object in Genesis and carry a  //
// pascal self reference value as parameter 0.  This can safely be ignored    //
// and passed as NULL for C/C++ use.  Additional BYTEs handle 'of object'     //
// flag used by equivalent Delphi record                                      //
//----------------------------------------------------------------------------//
struct G2_INTERFACE
{
 // Get/Set basic project/grid parameters
  void   _stdcall (*GLGGetParameters)(void *self, G2_PARAMETERS *G2Parameters); BYTE f0;
 void   _stdcall (*GLGSetParameters)(void *self, G2_PARAMETERS *G2Parameters); BYTE f1;
 // Get/Set viewing parameters - camera, target etc.
  void   _stdcall (*GLGGetViewingParameters)(void *self, G2_VIEWPARAMETERS *G2ViewParameters); BYTE f2;
 void   _stdcall (*GLGSetViewingParameters)(void *self, G2_VIEWPARAMETERS *G2ViewParameters); BYTE f3;
 // Create grid and Get/Set grid point properties
  bool   _stdcall (*GLGCreateNewGrid)(void *self, int x, int y, float sx, float sy); BYTE f4;
 double _stdcall (*GLGGetPointHeight)(void *self, int x, int y); BYTE f5;
 void   _stdcall (*GLGSetPointHeight)(void *self, int x, int y, double NewHeight); BYTE f6;
 bool   _stdcall (*GLGGetPointWater)(void *self, int x, int y); BYTE f7;
 void   _stdcall (*GLGSetPointWater)(void *self, int x, int y, bool isWater); BYTE f8;
 bool   _stdcall (*GLGGetHeightField)(void *self, int Size, float *HeightField);  BYTE f9;
 bool   _stdcall (*GLGSetHeightField)(void *self, int Size, float *HeightField);  BYTE f10;
 // Create/Get/Set terrain layers
  bool   _stdcall (*GLGGetTerrainLayerInfo)(void *self, int LayerIdx, G2_TERRAINLAYER *G2TerrainLayer); BYTE f11;
 bool   _stdcall (*GLGSetTerrainLayerInfo)(void *self, int LayerIdx, G2_TERRAINLAYER *G2TerrainLayer); BYTE f12;
 int    _stdcall (*GLGCreateNewTerrainLayer)(void *self, G2_TERRAINLAYER *G2TerrainLayer); BYTE f13;
 // Create/Get/Set plant info
  bool   _stdcall (*GlGGetPlantInfo)(void *self, int PlantIdx, G2_PLANTPARAMETERS *G2PlantParameters); BYTE f14;
 bool   _stdcall (*GlGSetPlantInfo)(void *self, int PlantIdx, G2_PLANTPARAMETERS *G2PlantParameters); BYTE f15;
 int    _stdcall (*GlGCreateNewPlant)(void *self, G2_PLANTPARAMETERS *G2PlantParameters); BYTE f16;
 // Create/Get/Set urban plans
 bool   _stdcall (*GlGGetUrbanPlan)(void *self, int UrbanIdx, G2_URBANPLAN *PG2UrbanPlan); BYTE f212;
 bool   _stdcall (*GlGSetUrbanPlan)(void *self, int UrbanIdx, G2_URBANPLAN *PG2UrbanPlan); BYTE f213;
 int    _stdcall (*GlGCreateNewUrbanPlan)(void *self, G2_URBANPLAN *PG2UrbanPlan); BYTE f214;
 // Deletion functions for polygons, lines and models (points)
  bool   _stdcall (*GLGDeleteAllPolygonsInLayer)(void *self, int LayerIdx); BYTE f17;
 bool   _stdcall (*GLGDeleteAllLinesInLayer)(void *self, int LayerIdx); BYTE f18;
 bool   _stdcall (*GLGDeleteAllModelsInLayer)(void *self, int LayerIdx); BYTE f19;
 // Create polygons and Get info
  bool   _stdcall (*GLGGetPolygonInfo)(void *self, int PolygonIdx, G2_POLYGONINFO *G2PolygonInfo); BYTE f20;
 bool   _stdcall (*GLGGetPolygonCoordinates)(void *self, int PolygonIdx, G2_POLYGONINFO *G2PolygonInfo); BYTE f21;
 bool   _stdcall (*GLGAddPolygon)(void *self, G2_POLYGONINFO *G2PolygonInfo); BYTE f22;
 // Create lines and Get info
  bool   _stdcall (*GLGGetLineInfo)(void *self, int LineIdx, G2_LINEINFO *G2LineInfo); BYTE f23;
 bool   _stdcall (*GLGGetLineCoordinates)(void *self, int LineIdx, G2_LINEINFO *G2LineInfo); BYTE f24;
 bool   _stdcall (*GLGAddLine)(void *self, G2_LINEINFO *G2LineInfo); BYTE f25;
 // Create lines and Get info
  bool   _stdcall (*GLGGetModelInfo)(void *self, int ModelIdx, G2_MODELINFO *G2ModelInfo); BYTE f26;
 bool   _stdcall (*GLGAddModel)(void *self, G2_MODELINFO *G2ModelInfo); BYTE f27;
 // Utility function to force update
 void   _stdcall (*GLGUpdateChildren)(void *self); BYTE f28;
}


Copyright 1999 Geomantics.