1 /******************************************************************************
2 * $Id: fgis.h,v 1.2 2003-01-02 18:02:52 dron Exp $
4 * Project: fGIS core engine
5 * Purpose: This header file contain all definition of routines,
6 * which implements EPTcl commands. Neccessary for Eptcl_Init
8 ******************************************************************************
10 * Copyright (C) 1997, Victor Wagner <vitus@ice.ru>
11 * Copyright (C) 2003, Andrey Kiselev <dron@remotesensing.org>
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2, or (at your option)
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
27 *****************************************************************************
40 #define CACHE_THRESHOLD 4000000L
41 /* maximum size of cache, allowed for raster files */
43 #define MAX_PALETTE_SIZE 20480
44 /* The size of palette file wihch never would be exceeded
45 (256 lines, 80 chars each - is it enough?)
48 void Fgis_DefDeleteProc(ClientData client_data);
49 /* Empty command delete proc */
51 /* Argument parsing and checking*/
53 int Fgis_GetInt(Tcl_Interp *interp,int argc,char **argv,int index,
54 int min, int max,int *result, char *name);
55 /* Fetches int argument from argv array at index, checking for its presence,
56 format and range. Puts into result. name is descriptive name for errir
59 int Fgis_GetLimits(Tcl_Interp *interp,char *list,double *X1,double *Y1,
60 double *X2,double *Y2);
61 /* Parses four element list of doubles, representing region on map or
63 int Fgis_CkArgs(Tcl_Interp *interp,int cond, char *cmd, char *msg);
65 * Palette - related procedures
67 PATTERNS Fgis_GetPatterns(Tcl_Interp *interp,char *name);
69 int Fgis_Palette(ClientData data,Tcl_Interp *interp,int argc,char **argv);
70 /* palette object construction */
72 int Fgis_PaletteObj(ClientData data,Tcl_Interp *interp,int argc,char **argv);
73 /* Command procedure for palette object command */
75 void Fgis_DeletePalette(ClientData data);
76 /* all the same for pattern sets */
77 int Fgis_CreatePatterns(ClientData data,Tcl_Interp *interp,int argc,char **argv);
78 int Fgis_PatternObj(ClientData data,Tcl_Interp *interp, int argc, char **argv);
79 void Fgis_DeletePatterns(ClientData data);
81 * Accessible from other modules Returns palette, corresponding with
82 * tcl command name in interp. Don't try to fool it, passing non palette-object
83 * command! Returns NULL and leaves message in interpreter in case of error.
85 PALETTE Fgis_GetPalette(Tcl_Interp *interp, char *name);
86 /* Allows to fetch palette, if its Tcl name is given */
88 /* Raster related stuff */
90 int Fgis_Raster(ClientData data,Tcl_Interp *interp,int argc,char **argv);
91 /* implements raster command */
92 int Fgis_RasterObj(ClientData data,Tcl_Interp *interp,int argc, char **argv);
93 /* implements object command of raster objects */
95 void Fgis_DeleteRaster(ClientData data);
96 /* delete proc for command raster - desroys global tables*/
97 void Fgis_DeleteRasterObj(ClientData data);
98 /* delete proc for raster object command - destroys raster itself*/
100 RASTER_OBJECT Fgis_GetRaster(Tcl_Interp *interp, char *name);
101 /* vector related stuff */
103 int Fgis_Vector(ClientData data,Tcl_Interp *interp,int argc,char **argv);
104 int Fgis_VectorObj(ClientData data,Tcl_Interp *interp,int argc,char **argv);
105 void Fgis_DeleteVectorObj(ClientData data);
107 /* projection object */
108 int Fgis_Projection(ClientData data,Tcl_Interp* interp,int argc, char **argv);
109 int Fgis_ProjObject(ClientData data,Tcl_Interp* interp,int argc, char **argv);
110 void Fgis_DeleteProj(ClientData data);
111 /* Drawing objects */
113 int Fgis_RasterImage(ClientData data,Tcl_Interp* interp,int argc,
117 /* Planchet methods */
118 int Fgis_MapX(ClientData data,Tcl_Interp* interp,int argc, char **argv);
119 int Fgis_MapY(ClientData data,Tcl_Interp* interp,int argc, char **argv);
120 int Fgis_ScrY(ClientData data,Tcl_Interp* interp,int argc, char **argv);
121 int Fgis_ScrX(ClientData data,Tcl_Interp* interp,int argc, char **argv);
122 int Fgis_Fit(ClientData data,Tcl_Interp* interp,int argc, char **argv);
124 /* Functions for access planchet from C code */
125 double Fgis_AltX(Tcl_Interp *interp,char *planchet ,int x);
126 double Fgis_AltY(Tcl_Interp *interp,char *planchet ,int y);
127 int Fgis_PlanchetX(Tcl_Interp *interp, char *planchet ,double x);
128 int Fgis_PlanchetY(Tcl_Interp *interp, char *planchet ,double y);
129 int Fgis_ValidPlanchet(Tcl_Interp *interp, char *planchet);
130 int Fgis_CreateObjectCommand(Tcl_Interp *interp,char *prefix,
131 Tcl_CmdProc *proc,ClientData data, Tcl_CmdDeleteProc deleteProc);
134 /* Makes dynamically allocante copy of string, using Tcl allocator */
135 #define stralloc(x) (strcpy(Tcl_Alloc(strlen(x)+1),x))
137 /* Body of non-implemented procedure. When it goes away, I would be
139 #define NOT_YET {Tcl_SetResult(interp,"Not implemented yet",TCL_STATIC); return TCL_ERROR;}
141 /* Set result and return error */
142 #define ERROR_MESSAGE(msg,mode) {Tcl_SetResult(interp,msg,mode);return TCL_ERROR;}
144 /* Set result and return success */
145 #define RETURN(value,mode) {Tcl_SetResult(interp,value,mode);return TCL_OK;}
146 /* Given raster object, returns EPP* */
147 #define epp(x) (x->file->e)