|
|
|
#include "modgmt.h"
|
|
|
|
#include "modgmt_func.h"
|
|
|
|
#include "modgmt_internals.h"
|
|
|
|
#include "modgmt_gsfuncs.h"
|
|
|
|
#include "modgmt_map.h"
|
|
|
|
|
|
|
|
// Initialisation function
|
|
|
|
int gmt_module_init(void* p)
|
|
|
|
{
|
|
|
|
// Fill header and footer
|
|
|
|
void* gmtapi;
|
|
|
|
int ret=0;
|
|
|
|
|
|
|
|
gmtapi=GMT_Create_Session("gmt_makemap",2,GMTMODE,0);
|
|
|
|
if(0==gmtapi) return 1;
|
|
|
|
if(0==ret) ret=callgmtmodule(gmtapi,"psclip","-C -P -K",&header,gmt_filter_headfoot);
|
|
|
|
if(0==ret) ret=callgmtmodule(gmtapi,"psclip","-C -P -O",&footer,gmt_filter_headfoot);
|
|
|
|
if(0==ret) callgmtmodule(gmtapi,"psclip","--show-datadir",&datadir);
|
|
|
|
GMT_Destroy_Session(gmtapi);
|
|
|
|
if(0!=ret) return ret;
|
|
|
|
|
|
|
|
gmt_projection::FillProjNames();
|
|
|
|
if(!gmt_font::FillFontNames()) return 1;
|
|
|
|
|
|
|
|
RegisterFunction("GMT_Header",GMT_Header);
|
|
|
|
RegisterFunction("GMT_Footer",GMT_Footer);
|
|
|
|
RegisterFunction("GMT_Datadir",GMT_Datadir);
|
|
|
|
RegisterFunction("GET",Get<ObjectGMTCoord>);
|
|
|
|
RegisterFunction("GET",Get<ObjectGMTRegion>);
|
|
|
|
RegisterFunction("GET",Get<ObjectGMTProjection>);
|
|
|
|
RegisterFunction("GET",Get<ObjectGMTColor>);
|
|
|
|
RegisterFunction("GET",Get<ObjectGMTDash>);
|
|
|
|
RegisterFunction("GET",Get<ObjectGMTPen>);
|
|
|
|
RegisterFunction("GET",Get<ObjectGMTFont>);
|
|
|
|
RegisterFunction("GET",Get<ObjectGMTLayer>);
|
|
|
|
|
|
|
|
RegisterFunction("Coord",GMT_Type<struct gmt_coord>);
|
|
|
|
RegisterFunction("Region",GMT_Type<struct gmt_region>);
|
|
|
|
RegisterFunction("Projection",GMT_Type<struct gmt_projection>);
|
|
|
|
RegisterFunction("Color",GMT_Type<struct gmt_color>);
|
|
|
|
RegisterFunction("ColorGray",GMT_ColorGray);
|
|
|
|
RegisterFunction("ColorRGB",GMT_ColorRGB);
|
|
|
|
RegisterFunction("ColorHSV",GMT_ColorHSV);
|
|
|
|
RegisterFunction("ColorCMYK",GMT_ColorCMYK);
|
|
|
|
RegisterFunction("Pen",GMT_Type<struct gmt_pen>);
|
|
|
|
RegisterFunction("Font",GMT_Type<struct gmt_font>);
|
|
|
|
RegisterFunction("Shift",GMT_LayerShift);
|
|
|
|
RegisterFunction("DrawFrame",GMT_DrawFrame);
|
|
|
|
RegisterFunction("Map",GMT_Map);
|
|
|
|
RegisterFunction("Convert2PDF",GMT_Convert2PDF);
|
|
|
|
RegisterFunction("Convert2PNG",GMT_Convert2PNG);
|
|
|
|
RegisterFunction("Convert2JPG",GMT_Convert2JPG);
|
|
|
|
RegisterFunction("Convert2JPEG",GMT_Convert2JPG);
|
|
|
|
|
|
|
|
CheckGhostscriptAbilities();
|
|
|
|
// Calculating bounding box is critical
|
|
|
|
if(!gs_abilities.havebbox) return 1;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|