/* * tclgeomap.h -- * * This header file describes the externally visible facilities of * the tclgeomap extension to Tcl. See the tclgeomap (n) man page for * information on the commands this package adds to Tcl. * * Copyright (c) 2004 Gordon D. Carrie. All rights reserved. * * Licensed under the Open Software License version 2.1 * * Please address questions and feedback to user0@tkgeomap.org * * @(#) $Id: tclgeomap.h,v 1.31 2007/06/29 15:59:53 tkgeomap Exp $ * ******************************************** * */ #ifndef _TCLGEOMAP #define _TCLGEOMAP #include #include #include #include #include #include #include #ifdef __WIN32__ #include #include #else #include #endif #include #include "geography.h" #include "geoProj.h" #include "geoLines.h" #include "mapLines.h" #define TCLGEOMAP_MAJOR_VERSION 2 #define TCLGEOMAP_MINOR_VERSION 11 #define TCLGEOMAP_PATCH_LEVEL 4 #define TCLGEOMAP_VERSION "2.11.4" /* * The following declarations export generic geography functions in Tcl. */ EXTERN Tcl_Obj * Tclgeomap_NewGeoPtObj _ANSI_ARGS_((GeoPt geoPt)); EXTERN void Tclgeomap_SetGeoPtObj _ANSI_ARGS_((Tcl_Obj *ptr, GeoPt geoPt)); EXTERN int Tclgeomap_GetGeoPtFromObj _ANSI_ARGS_(( Tcl_Interp *interp, Tcl_Obj *objPtr, GeoPt *geoPtPtr)); EXTERN Tcl_Obj * Tclgeomap_NewMapPtObj _ANSI_ARGS_((MapPt mapPt)); EXTERN void Tclgeomap_SetMapPtObj _ANSI_ARGS_((Tcl_Obj *ptr, MapPt mapPt)); EXTERN int Tclgeomap_GetMapPtFromObj _ANSI_ARGS_(( Tcl_Interp *interp, Tcl_Obj *objPtr, MapPt *mapPtPtr)); EXTERN Tcl_Obj * Tclgeomap_NewGeoTimeObj _ANSI_ARGS_(( struct GeoTime_Jul jul)); EXTERN void Tclgeomap_SetGeoTimeObj _ANSI_ARGS_((Tcl_Obj *ptr, struct GeoTime_Jul jul)); EXTERN int Tclgeomap_GetGeoTimeFromObj _ANSI_ARGS_(( Tcl_Interp *interp, Tcl_Obj *objPtr, struct GeoTime_Jul *julPtr)); /* * The following structure manages geographic projections in Tcl. It is * derived from the GeoProj structure declared in geoProj.h, so functions * that take pointers to GeoProj structures can also accept pointers to * Tclgeomap_Proj structures. */ struct Tclgeomap_Proj { struct GeoProj proj; /* Geographic projection */ Tcl_Interp *interp; /* Interpreter in which the command * corresponding to the projection resides */ Tcl_Command cmd; /* Tcl command for the projection */ Tcl_HashTable updateTasks; /* Procedures to call when the projection * changes. ONE_WORD_KEYS are clientData's. * Values are procedures of form * void (*updateProc)(ClientData clientData). * The update procedures are called with their * clientData values as arguments when the * projection changes. */ Tcl_HashTable deleteTasks; /* Procedures to call when the projection is * deleted. Entries are added with calls to * Tclgeomap_AddProjDeleteTask. ONE_WORD_KEYS * are clientData's. Values are * Tclgeomap_ProjDeleteProcs. */ }; typedef struct Tclgeomap_Proj *Tclgeomap_Proj; typedef void (Tclgeomap_ProjUpdateProc)(ClientData clientData); typedef void (Tclgeomap_ProjDeleteProc)(ClientData clientData); EXTERN Tclgeomap_Proj Tclgeomap_GetProj _ANSI_ARGS_((Tcl_Interp *interp, char *name)); EXTERN CONST char * Tclgeomap_ProjName _ANSI_ARGS_((Tclgeomap_Proj proj)); EXTERN void Tclgeomap_AddProjUpdateTask _ANSI_ARGS_(( Tclgeomap_Proj proj, Tclgeomap_ProjUpdateProc updateProc, ClientData clientData)); EXTERN void Tclgeomap_CnxProjUpdateTask _ANSI_ARGS_((Tclgeomap_Proj, ClientData clientData)); EXTERN void Tclgeomap_AddProjDeleteTask _ANSI_ARGS_(( Tclgeomap_Proj, Tclgeomap_ProjDeleteProc, ClientData)); EXTERN void Tclgeomap_CnxProjDeleteTask _ANSI_ARGS_(( Tclgeomap_Proj, ClientData)); /* * This structures stores a GeoLnArr structure with information needed to * manage a GeoLnArr struct in Tcl. Pointers to Tclgeomap_LnArr structures * can be used as parameters in the procedures declared in this file, and also * in * procedures declared in geoLines.h that take pointers to GeoLnArr * structures. Clients should not access members directly. The structure * declaration is visible for to enable inheritance and to ease debugging. */ struct Tclgeomap_LnArr { struct GeoLnArr geoLnArr; /* The geolinearray. See geoLines.h * for contents */ Tcl_Interp *interp; /* Interpreter in which the command * corresponding to the geolinearray resides */ Tcl_Command cmd; /* Tcl command for the array */ Tcl_HashTable mapLnArrs; /* This table stores mapline arrays derived * from geoLnArr. Keys are projections. * Values are MapLnArr's obtained from the * geolinearray with the projection. */ Tcl_HashTable deleteTasks; /* Table of deletion procs to call when the * tclgeolinearray is deleted. Entries to this * table are added with calls to * Tclgeomap_AddLnArrDeleteTask. * ONE_WORD_KEYS are clientData's and values * are Tclgeomap_LnArrDeleteProc's given as * arguments Tclgeomap_AddLnArrDeleteTask. */ }; typedef struct Tclgeomap_LnArr *Tclgeomap_LnArr; /* * Procedure type: */ typedef void (Tclgeomap_LnArrDeleteProc)(ClientData clientData); /* * Procedure declarations: */ EXTERN Tclgeomap_LnArr Tclgeomap_AddLnArr _ANSI_ARGS_((Tcl_Interp *, char *, GeoLnArr)); EXTERN void Tclgeomap_AddLnArrDeleteTask _ANSI_ARGS_(( Tclgeomap_LnArr, Tclgeomap_LnArrDeleteProc, ClientData)); EXTERN void Tclgeomap_CnxLnArrDeleteTask _ANSI_ARGS_(( Tclgeomap_LnArr, ClientData)); EXTERN Tclgeomap_LnArr Tclgeomap_GetLnArr _ANSI_ARGS_((Tcl_Interp *, char *)); EXTERN CONST char * Tclgeomap_LnArrName _ANSI_ARGS_((Tclgeomap_LnArr)); EXTERN MapLnArr Tclgeomap_LnArrToMap _ANSI_ARGS_((Tclgeomap_LnArr, Tclgeomap_Proj)); /* * This structure stores information about a named place. Client * applications should not make direct references to fields in this * structure. It is made visible to help with debugging. */ struct Tclgeomap_Place { GeoPt geoPt; /* Latitude and longitude of a place */ Tcl_Interp *interp; /* Interpreter in which the command resides */ Tcl_Command cmd; /* Tcl command for the place */ Tcl_HashTable updateTasks; /* Procedures to call when the place moves. * Entries are added with calls to * Tclgeomap_AddPlaceUpdateTask. ONE_WORD_KEYS * are clientData's. Values are * Tclgeomap_PlaceUpdateProc's. */ Tcl_HashTable deleteTasks; /* Procedures to call when the place is deleted. * Entries are added with calls to * Tclgeomap_AddPlaceDeleteTask. ONE_WORD_KEYS * are clientData's. Values are * Tclgeomap_PlaceDeleteProc's. */ }; typedef struct Tclgeomap_Place *Tclgeomap_Place; /* * Procedure types: */ typedef void (Tclgeomap_PlaceUpdateProc) _ANSI_ARGS_((ClientData)); typedef void (Tclgeomap_PlaceDeleteProc) _ANSI_ARGS_((ClientData)); /* * Global functions: */ EXTERN void Tclgeomap_AddPlaceUpdateTask _ANSI_ARGS_(( Tclgeomap_Place, Tclgeomap_PlaceUpdateProc, ClientData)); EXTERN void Tclgeomap_CnxPlaceUpdateTask _ANSI_ARGS_(( Tclgeomap_Place, ClientData)); EXTERN void Tclgeomap_AddPlaceDeleteTask _ANSI_ARGS_(( Tclgeomap_Place, Tclgeomap_PlaceDeleteProc, ClientData)); EXTERN void Tclgeomap_CnxPlaceDeleteTask _ANSI_ARGS_(( Tclgeomap_Place, ClientData)); EXTERN Tclgeomap_Place Tclgeomap_GetPlace _ANSI_ARGS_((Tcl_Interp *, CONST char *)); EXTERN GeoPt Tclgeomap_PlaceLoc _ANSI_ARGS_((Tclgeomap_Place)); EXTERN CONST char * Tclgeomap_PlaceName _ANSI_ARGS_((Tclgeomap_Place)); /* * The following declaration exports the Tclgeomap interface. */ EXTERN int Tclgeomap_Init _ANSI_ARGS_((Tcl_Interp *)); EXTERN Tcl_Obj *Tclgeomap_JulDayToList _ANSI_ARGS_((struct GeoTime_Jul jul)); EXTERN void Tclgeomap_AppendTime _ANSI_ARGS_((Tcl_Obj *list, struct GeoTime_Jul jul)); #endif