Compare commits

..

1 Commits

  1. 2
      modules/gmt/modgmt.cpp
  2. 1930
      modules/gmt/modgmt_colornames.cpp
  3. 58
      modules/gmt/modgmt_colornames.h
  4. 5
      modules/gmt/modgmt_func.cpp
  5. 1
      modules/gmt/modgmt_func.h
  6. 5
      modules/gmt/modgmt_gsfuncs.cpp
  7. 6
      modules/gmt/modgmt_internals.cpp
  8. 1
      modules/gmt/modgmt_internals.h
  9. 26
      modules/gmt/modgmt_map.cpp

2
modules/gmt/modgmt.cpp

@ -15,6 +15,7 @@ int gmt_module_init(void* p)
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;
@ -23,6 +24,7 @@ int gmt_module_init(void* p)
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>);

1930
modules/gmt/modgmt_colornames.cpp

File diff suppressed because it is too large Load Diff

58
modules/gmt/modgmt_colornames.h

@ -13,38 +13,38 @@ public:
};
inline unsigned int
ColorHash::colornamehash (const char *str, unsigned int len)
ColorHash::colornamehash ( const char *str, unsigned int len)
{
static const unsigned short asso_values[] =
{
2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728,
2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728,
2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728,
2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728,
2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 666, 27,
26, 23, 22, 789, 588, 587, 501, 436, 2728, 2728,
2728, 2728, 2728, 2728, 2728, 61, 96, 222, 98, 22,
117, 22, 561, 559, 22, 708, 179, 301, 42, 101,
242, 46, 23, 22, 116, 171, 821, 809, 2728, 169,
2728, 2728, 2728, 2728, 2728, 2728, 2728, 61, 96, 222,
98, 22, 117, 22, 561, 559, 22, 708, 179, 301,
42, 101, 242, 46, 23, 22, 116, 171, 821, 809,
2728, 169, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728,
2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728,
2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728,
2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728,
2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728,
2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728,
2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728,
2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728,
2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728,
2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728,
2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728,
2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728,
2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728, 2728,
2728, 2728, 2728, 2728, 2728, 2728
4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084,
4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084,
4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084,
4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084,
4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 800, 25,
20, 5, 0, 845, 785, 780, 640, 620, 4084, 4084,
4084, 4084, 4084, 4084, 4084, 80, 0, 686, 5, 0,
260, 0, 85, 770, 20, 950, 210, 95, 160, 195,
995, 335, 0, 0, 135, 425, 55, 863, 4084, 60,
4084, 4084, 4084, 4084, 4084, 4084, 4084, 80, 0, 686,
5, 0, 260, 0, 85, 770, 20, 950, 210, 95,
160, 195, 995, 335, 0, 0, 135, 425, 55, 863,
4084, 60, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084,
4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084,
4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084,
4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084,
4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084,
4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084,
4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084,
4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084,
4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084,
4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084,
4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084,
4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084,
4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084, 4084,
4084, 4084, 4084, 4084, 4084, 4084
};
int hval = len;
int hval = len;
switch (hval)
{
@ -81,4 +81,4 @@ ColorHash::colornamehash (const char *str, unsigned int len)
return hval + asso_values[(unsigned char)str[len - 1]];
}
#endif
#endif

5
modules/gmt/modgmt_func.cpp

@ -21,6 +21,11 @@ const ObjectBase* GMT_Footer(const ObjectList* input)
return new ObjectString(footer);
}
const ObjectBase* GMT_Datadir(const ObjectList* input)
{
return new ObjectString(datadir);
}
const ObjectBase* GMT_ColorGray(const ObjectList* input)
{
struct gmt_color c;

1
modules/gmt/modgmt_func.h

@ -6,6 +6,7 @@
const ObjectBase* GMT_Header(const ObjectList* input);
const ObjectBase* GMT_Footer(const ObjectList* input);
const ObjectBase* GMT_Datadir(const ObjectList* input);
const ObjectBase* GMT_ColorGray(const ObjectList* input);
const ObjectBase* GMT_ColorRGB(const ObjectList* input);
const ObjectBase* GMT_ColorHSV(const ObjectList* input);

5
modules/gmt/modgmt_gsfuncs.cpp

@ -82,7 +82,6 @@ static int GhostRun(const std::string& opts, struct gs_runtime* r, std::string*
{
struct gsworkthreadpars wp;
int* pret;
int ret=0;
wp.r=r;
wp.input_callback=input;
@ -97,7 +96,7 @@ static int GhostRun(const std::string& opts, struct gs_runtime* r, std::string*
ssize_t br;
char buffer[4096];
if(0!=pipe(pipefd)) {ret=-1; goto end;}
pipe(pipefd);
wp.fd=pipefd[1];
out->erase();
@ -113,8 +112,6 @@ static int GhostRun(const std::string& opts, struct gs_runtime* r, std::string*
}
else pret=reinterpret_cast<int*>(gsworkthread(&wp));
end:
if(0!=ret) return ret;
return *pret;
}

6
modules/gmt/modgmt_internals.cpp

@ -3,6 +3,7 @@
#include "modgmt_internals.h"
std::string header,footer;
std::string datadir;
// Workaround exit() in GMT_Call_Module. May need because return mode of gmt api is not very reliable
#if defined MODGMT_WORKAROUND_EXIT
@ -44,9 +45,8 @@ int callgmtmodule(void *api, const char *module, struct GMT_OPTION *opts, std::s
pthread_t wthr;
struct gmtworkthreadpars p;
int *pret;
int ret=0;
if(0!=pipe(pipefd)) {ret=-1; goto end;}
pipe(pipefd);
p.api=api;
p.module=module;
p.opts=opts;
@ -60,8 +60,6 @@ int callgmtmodule(void *api, const char *module, struct GMT_OPTION *opts, std::s
res->shrink_to_fit();
pthread_join(wthr,reinterpret_cast<void**>(&pret));
end:
if(0!=ret) return ret;
return *pret;
}
// Overloaded variant with opts as std::string

1
modules/gmt/modgmt_internals.h

@ -7,6 +7,7 @@
// here we save header and footer of gmt-produced eps files
extern std::string header,footer;
extern std::string datadir;
extern const int GMTMODE;
// Parameters for working thread

26
modules/gmt/modgmt_map.cpp

@ -298,16 +298,9 @@ const ObjectBase* GMT_Convert2PNG(const ObjectList* input)
if(taa.Exist()) aats=taa;
if(gaa.Exist()) aags=gaa;
tolower(aags); tolower(aats);
if("none" ==aags || "no"==aags || "n"==aags) aag=1;
if("none" ==aats || "no"==aats || "n"==aats) aat=1;
if("small"==aags || "s" ==aags ) aag=2;
if("small"==aats || "s" ==aats ) aat=2;
if("full" ==aags || "f" ==aags ) aag=4;
if("full" ==aats || "f" ==aats ) aat=4;
if("none" ==aags || "no"==aags || "n"==aags) aag=1; if("none" ==aats || "no"==aats || "n"==aats) aat=1;
if("small"==aags || "s" ==aags ) aag=2; if("small"==aats || "s" ==aats ) aat=2;
if("full" ==aags || "f" ==aags ) aag=4; if("full" ==aats || "f" ==aats ) aat=4;
if(0==aat) {err="Incorrect value for text antialiasing: "+aats; goto fail;}
if(0==aag) {err="Incorrect value for graphics antialiasing: "+aags; goto fail;}
}
@ -415,16 +408,9 @@ const ObjectBase* GMT_Convert2JPG(const ObjectList* input)
if(taa.Exist()) aats=taa;
if(gaa.Exist()) aags=gaa;
tolower(aags); tolower(aats);
if("none" ==aags || "no"==aags || "n"==aags) aag=1;
if("none" ==aats || "no"==aats || "n"==aats) aat=1;
if("small"==aags || "s" ==aags ) aag=2;
if("small"==aats || "s" ==aats ) aat=2;
if("full" ==aags || "f" ==aags ) aag=4;
if("full" ==aats || "f" ==aats ) aat=4;
if("none" ==aags || "no"==aags || "n"==aags) aag=1; if("none" ==aats || "no"==aats || "n"==aats) aat=1;
if("small"==aags || "s" ==aags ) aag=2; if("small"==aats || "s" ==aats ) aat=2;
if("full" ==aags || "f" ==aags ) aag=4; if("full" ==aats || "f" ==aats ) aat=4;
if(0==aat) {err="Incorrect value for text antialiasing: "+aats; goto fail;}
if(0==aag) {err="Incorrect value for graphics antialiasing: "+aags; goto fail;}
}

Loading…
Cancel
Save