#include "render.h"
#include "htmltable.h"
#include <limits.h>
+#ifdef WIN32
+#include "libltdl/lt_system.h"
+#endif
+#ifndef WIN32
+#include <unistd.h>
+#endif
#define RBCONST 12
#define RBCURVE .5
boolean pfilled; /* true if fill not handled by user shape */
char *color, *name;
int doMap = (obj->url || obj->explicit_tooltip);
+ static char* ipfilename = NULL;
+ static char* imagepath = NULL;
+ static boolean firsttime = TRUE;
+ char *p;
if (doMap && !(job->flags & EMIT_CLUSTERS_LAST))
gvrender_begin_anchor(job,
name = agget(n, "shapefile");
usershape_p = TRUE;
} else if ((name = agget(n, "image"))) {
+
+ if (firsttime) {
+ imagepath = agget(agraphof(n),"imagepath");
+ firsttime = FALSE;
+ }
+ if ((access (safefile(name), R_OK) != 0) && imagepath != NULL){
+ if (p = strrchr(name, '/'))
+ name = ++p;
+ ipfilename = realloc(ipfilename,(strlen(imagepath) + strlen(name) + 2));
+ sprintf (ipfilename, "%s%s%s", imagepath, DIRSEP, name);
+ name = ipfilename;
+ }
usershape_p = TRUE;
}
if (usershape_p) {
#include <string.h>
#include <errno.h>
+#ifdef WIN32
+#include "libltdl/lt_system.h"
+#endif
+#ifndef WIN32
+#include <unistd.h>
+#endif
+
#include "types.h"
#include "logic.h"
#include "memory.h"
#define XML_MAGIC "<?xml"
#define SVG_MAGIC "<svg"
+#ifdef WIN32
+#define DIRSEP "\\"
+#else
+#define DIRSEP "/"
+#endif
+
static knowntype_t knowntypes[] = {
{ PNG_MAGIC, sizeof(PNG_MAGIC)-1, FT_PNG, "png", },
{ PS_MAGIC, sizeof(PS_MAGIC)-1, FT_PS, "ps", },
*/
point gvusershape_size(graph_t * g, char *name)
{
+ static char *ipfilename = NULL;
+ static char* imagepath;
+ static boolean firsttime = TRUE;
+ const char *str;
+ char *p;
point rv;
pointf dpi;
-
+
/* no shape file, no shape size */
if (!name || (*name == '\0')) {
rv.x = rv.y = -1;
dpi.x = dpi.y;
else
dpi.x = dpi.y = (double)DEFAULT_DPI;
+
+ //imagepath is typically set as a graph attribute on macos platforms
+ //It points to the directory where node images are located
+ if (firsttime) {
+ imagepath = agget(g,"imagepath");
+ firsttime = FALSE;
+ }
+ if ((access (safefile(name), R_OK) != 0) && imagepath != NULL){
+ if (p = strrchr(name, '/'))
+ name = ++p;
+ ipfilename = realloc(ipfilename,(strlen(imagepath) + strlen(name) + 2));
+ sprintf (ipfilename, "%s%s%s", imagepath, DIRSEP, name);
+ name = ipfilename;
+ }
return gvusershape_size_dpi (gvusershape_open (name), dpi);
+
}