Preface

This book provides information about programming with GLG and using different GLG Run-Time environments, including C/C++, Java and ActiveX control.

The first section of this manual describes the C API, while the rest of the book describes the C++, Java and ActiveX control versions.

Although various programming environments such as C, C++, Java, ActiveX, use different syntax to invoke the GLG API, the semantics of the API methods is the same in either environment. The C programming section provides the most detailed description of each method in terms of its effect on the underlying GLG objects. It also provides more examples and may be used as a reference for C, C++, Java and ActiveX programmers.

The book contains the following chapters:

GLG Programming Reference Manual

Using the C/C++ version of the Toolkit
How to render a GLG drawing from an application program.

Details of using GLG Standard API for C and C++
A general overview of the process of programming with the GLG Toolkit.

Animating a GLG Drawing Using the Standard API
Now that the drawing has been rendered, a description of how to animate the drawing with the function library supplied with the GLG Toolkit.

Handling Input Events
A description of the ways in which a GLG drawing can be used to get input from an application program user.

The GLG Extended API
How to modify a drawing from an application program.

C/C++ Graph Layout Component
How to modify a drawing from an application program.

GLG C++ Bindings
A description of GLG C++ Bindings and GLG MFC class.

GLG Programming Tools and Utilities
Descriptions of the utility tools that come with the GLG Toolkit.

Using the ActiveX Control
A description of the Glg ActiveX control that allows GLG drawings to be used with OLE-compliant Microsoft Windows applications or in IE.

Using the Java version of the GLG Toolkit

A description of the Java version of the Glg Run-Time environment.

Appendices

Appendix A: Global Configuration Resources

A list of global configuration resources.

Appendix B: Message Object Resources
A table of the GLG event types and their message object resources.

Appendix C: GLG Object's Attribute Table

A list of the default attribute names for all object types.

Index

This guide assumes that you are conversant with the basic concepts of computer graphics programming. For a comprehensive discussion of three dimensional computer graphics, we recommend Computer Graphics: Principles and Practice , Foley, Van Dam, Feiner, and Hughes. Second edition, 1990; Addison-Wesley, Reading MA.

Please note that although the illustrations in this document represent the UNIX version of the GLG Graphics Builder, the information it contains is equally relevant to MS Windows users. The two versions present the same functionality in equivalent user interfaces, with minimal, cosmetic differences caused by the different platforms.

 

GLG Programming Reference Manual

 

Chapter 1 Using the C/C++ version of the Toolkit 17

1.1 Displaying a GLG Drawing 17

X Windows and Wrapper Widget 17

Creating the Wrapper Widget 18

Wrapper Widget Resources 19

Obtaining a Viewport Handle 23

Closing the Wrapper Widget 24

Microsoft Windows and GLG Custom Control 24

Creating the GLG Custom Control 25

Setting Initial Resources 25

Obtaining a Viewport Handle 26

Closing the Custom Control 27

Messages 27

The GLG Generic API 28

Function Summary 28

Generic Program Entry Point 29

Loading and Displaying a Glg Drawing using Generic API 29

GLG Generic API Function Descriptions 30

GlgAddCallback 30

GlgAddTimeOut 31

GlgAddWorkProc 32

GlgBell 32

GlgInit 33

GlgInitLocale 34

GlgInitialDraw 34

GlgLoadWidgetFromFile 35

GlgLoadWidgetFromImage 35

GlgLoadWidgetFromObject 36

GlgMainLoop 36

GlgRand 36

GlgRemoveTimeOut 37

GlgRemoveWorkProc 37

GlgResetHierarchy 37

GlgSetDefaultViewport 38

GlgSetupHierarchy 38

GlgSleep 38

GlgTerminate 39

Coding Examples 39

1.2 Details of using GLG Standard API for C and C++ 41

Creating a Widget 41

Widget Input 42

Displaying a Widget 42

Controlling a Widget 43

H and V Resources 43

Utilities 44

Linking with the GLG Libraries 45

OpenGL libraries 45

X Windows / UNIX 45

Microsoft Windows 47

Qt and GTK Integration 47

Error Processing 48

1.3 Animating a GLG Drawing Using the Standard API 49

Overview 49

Function Descriptions 51

GlgConcatResNames 51

GlgConcatStrings 52

GlgCreateIndexedName 52

GlgCreateTagList 53

GlgError 54

GlgExportStrings 55

GlgExportTags 55

GlgFree 56

GlgGetDResource 56

GlgGetGResource 57

GlgGetMajorVersion 57

GlgGetSelectionButton 58

GlgGetSResource 58

GlgGISConvert 59

GlgGISGetElevation 60

GlgHasResourceObject 60

GlgImportStrings 61

GlgImportTags 62

GlgOnDrawMetafile 62

GlgOnPrint 63

GlgPrint 63

GlgReset 64

GlgSaveImage 64

GlgSendMessage 66

GlgSetBrowserObject 66

GlgSetDResource 67

GlgSetErrorHandler 68

GlgSetGResource 68

GlgSetReadOnlyStrings 69

GlgSetResourceFromObject 69

GlgSetSResource 70

GlgSetSResourceFromD 71

GlgSetZoom 72

GlgSetGISZoom 74

GlgStrClone 74

GlgUpdate 75

GlgWinPrint 75

GlmConvert 76

Communicating from a Client Process 77

Using Inter-Process Communication with the Standard API 78

Connecting to the GLG Graphics Builder 79

Communication Function Descriptions 79

GlgCreateLink 80

GlgDestroyLink 80

GlgLinkActive 80

GlgSync 81

Programming Examples of Inter-Client Communication 81

Writing a Custom Data Generator for Prototyping 84

1.4 Handling Input Events 87

Callback Events 87

Attaching Callbacks to a Viewport Object 87

Adding Callbacks to a GLG Wrapper Widget 88

Selection Callback 89

Input Callback 91

Trace Callbacks 92

Message Object 93

Examples 94

Printing Selected Object Names using Selection Callback 94

Printing Selected Object Names using Input Callback 94

Processing Input Object Messages 96

Refining Input Object Selection 97

Trace Callback examples 97

1.5 The GLG Extended API 99

Overview 99

Handling GLG Objects 101

The Reference Count 101

Function Descriptions 101

GlgCreateObject 102

Using GlgCreateObject 103

GlgAddObjectToTop 115

GlgAddObject 115

GlgConstrainObject 117

GlgContainsObject 118

GlgCopyObject 119

GlgCloneObject 119

GlgCreateInversedMatrix 120

GlgCreatePointArray 120

GlgCreateResourceList 121

GlgCreateSelectionMessage 122

GlgCreateSelectionNames 123

GlgCreateSelection 124

GlgDeleteTopObject 125

GlgDeleteObject 125

GlgDeleteThisObject 127

GlgDropObject 127

GlgFindObject 127

GlgFitObject 128

GlgGetBoxPtr 129

GlgGetDrawingMatrix 130

GlgGetElement 130

GlgGetIndex 130

GlgGetMatrixData 131

GlgGetNamedObject 131

GlgGetParent 132

GlgGetResourceObject 132

GlgGetSize 133

GlgGetStringIndex 133

GlgGetTagObject 133

GlgIterate 134

GlgLayoutObjects 135

GlgLoadObject 137

GlgLoadObjectFromImage 138

GlgMoveObject 138

GlgMoveObjectBy 139

GlgPositionObject 139

GlgReferenceObject 140

GlgReleaseObject 142

GlgReorderElement 142

GlgRotateObject 143

GlgSaveObject 144

GlgScaleObject 144

GlgScreenToWorld 145

GlgSetElement 145

GlgSetMatrixData 146

GlgSetResourceObject 146

GlgSetStart 147

GlgSetXform 147

GlgSuspendObject 148

GlgTransformObject 149

GlgTransformObject 149

GlgTransformPoint 150

GlgUnconstrainObject 150

GlgWorldToScreen 151

Get and Set Resource Function Extension 152

Enabling Strong Typing 152

1.6 GLG C++ Bindings 155

Using GLG Objects 155

Automatic Referencing and Dereferencing 156

Comparison Operators 156

Using Input and Selection Callbacks 157

Miscellaneous Utility Classes 157

Programming Examples 157

C++ API Files and Libraries 158

GlgClass.h 158

GlgClass.cpp 158

stdafx.h 158

Standard and Extended API 158

List of Classes and Methods in the GLG C++ Bindings 158

GlgSessionC 158

GlgObjectC 159

GlgLinkC 168

GlgControlC (Microsoft Windows Only) 169

GlgWrapperC (X Windows Only) 171

Chapter 2 Using the ActiveX Control 173

Overview 173

GLG ActiveX Control Properties 174

General Page 174

HProperties Page 176

VProperties Page 176

DLinks Page 176

SLinks Page 177

GLinks Page 177

Dynamic Resource String Syntax 177

Persistency Support 178

GLG ActiveX Control Events 178

ActiveX Control Methods 180

ActiveX Control Extended API Methods 185

GLG ActiveX Control Security 193

GLG ActiveX Control Environment Variables 193

Chapter 3 Using the Java version of the GLG Toolkit 195

Introduction 195

Using the Documentation 197

Jar Files 197

Interfaces 198

GlgInputListener 198

GlgSelectListener 198

GlgTraceListener 198

GlgHListener 199

GlgVListener 199

GlgReadyListener 199

GlgErrorHandler 200

GlgBean class 200

GlgJBean class 200

GlgJLWBean class 200

Properties 201

Constructors 202

Methods 202

Extended API Methods 210

GlgObject class 214

Variables 214

Methods 214

Extended API Methods 221

GLG Utility Classes 228

GlgPoint class 228

GlgCube class 229

GlgMatrixData class 229

GlgTraceData class 230

GLG objects classes 230

Overview 230

GlgArc class 231

GlgBoxAttr class 231

GlgDynArray class 231

GlgFont class 231

GlgFontTable class 232

GlgFrame class 232

GlgFunction class 232

GlgHistory class 233

GlgImage class 233

GlgList class 233

GlgLight class 234

GlgMarker class 234

GlgParallelogram class 234

GlgPolySurface class 234

GlgPolygon class 235

GlgPolyline class 235

GlgReference class 235

GlgRenderingAttr class 235

GlgResourceReference class 236

GlgScreen 236

GlgSeries class 236

GlgSpline class 236

GlgSquareSeries class 237

GlgTag class 237

GlgText class 237

GlgViewport class 237

GlgXform class 238

Attribute classes 238

GlgDataPoint class 238

GlgDDataPoint class 238

GlgGDataPoint class 238

GlgSDataPoint class 238

Data Value classes 239

GlgDataValue class 239

GlgDDataValue class 239

GlgGDataValue class 239

GlgSDataValue class 239

GlgMatrix class 240

Graph Layout Classes 240

Overview 240

GlgGraphNode class 240

GlgGraphEdge class 241

GlgGraphLayout class 242

Chapter 4 GLG Programming Tools and Utilities 249

4.1 The Data Generation Utility 250

Using datagen to Prototype Drawings in the Builder 250

Using datagen in Stand-Alone mode 250

Command Line Arguments and Options 251

Data Set Specification 252

Data Set Options 253

Data File Format 254

4.2 GLG Script 255

Overview 255

Standard Command Set 255

set_value 255

set_tag 256

update 256

sync 256

print 256

Database Record Support Commands 257

create_record 257

add_field 257

delete_record 258

read_records 258

end_read 258

read_one_record 258

Database Record Support Example 258

Extended Command Set 259

get_value 259

get_tag 259

select_object 260

select_container 260

select_element 260

load_object 260

set_resource_object 260

reference 261

drop 261

create 261

add_new 263

add_copy 263

delete 264

4.3 Code Generation Utility 265
4.4 Drawing File Conversion Utility 266

4.5 C/C++ Graph Layout Component 269

Overview 269

Data Access Macros 269

Function Descriptions 271

Appendices 281

5.1 Appendix A: Global Configuration Resources 281
5.2 Appendix B: Message Object Resources 285

Generic Resources of the Message Object 285

Specific Resources of the Message Object 286

Slider Message Object 287

Knob Message Object 288

Button Message Object 288

Text Message Object 290

Spinner Message Object 291

List Message Object 291

Option Message Object 292

Menu Message Object 292

Clock and Stopwatch Message Object 293

Timer Message Object 293

Palette Message Object 294

Font Browser Message Object 294

Browser Message Object 295

Zoom Message Object 295

Custom Event Message Object 297

Object Selection Message Object 299

Window Message Object 300

5.3 Appendix C: GLG Object's Attribute Table 301

Generic Attributes 301

Generic Attributes of Drawable objects 301

Polygon Attributes 301

Rendering Object Attributes 302

Marker Attributes 302

Text Object Attributes 302

Box Attributes Object Attributes 302

Arc Attributes 303

Parallelogram Attributes 303

Spline Object Attributes 303

Image Object attributes 304

GIS Object attributes 304

Group and List Objects' Attributes 304

Connector Object Attributes 304

Reference Object Attributes 304

Series Object Attributes 305

Square Series Object Attributes 305

Polyline Attributes 305

Polysurface Attributes 306

Frame Object Attributes 306

Viewport Attributes 306

Light Object Attributes 307

Screen Object Attributes 307

Colortable Object Attributes 308

Font Table Object Attributes 308

Font Object Attributes 309

Transformation Object Attributes 309

Alias Object Attributes 309

History Object Attributes 309

Data Object Attributes 310

Attribute Object Attributes 310

Tag Object Attributes 310

Function Object Attributes 310

Using the C/C++ version of the Toolkit

Using the ActiveX Control

Using the Java version of the GLG Toolkit

GLG Programming Tools and Utilities

Appendices

Index