]> granicus.if.org Git - graphviz/commitdiff
Further processing of Yifan's edge painting code: add copyright notice
authorEmden R. Gansner <erg@alum.mit.edu>
Sun, 2 Mar 2014 23:44:39 +0000 (18:44 -0500)
committerEmden R. Gansner <erg@alum.mit.edu>
Sun, 2 Mar 2014 23:44:39 +0000 (18:44 -0500)
to new source files and #ifndefs to .h files;
update gvmap to use color_schemes;
pull valid color scheme name test from main programs and make a function
in the color_palette library.

19 files changed:
cmd/edgepaint/edgepaintmain.c
cmd/gvmap/Makefile.am
cmd/gvmap/gvmap.c
cmd/gvmap/make_map.c
cmd/gvmap/make_map.h
lib/edgepaint/edge_distinct_coloring.c
lib/edgepaint/edge_distinct_coloring.h
lib/edgepaint/furtherest_point.c
lib/edgepaint/furtherest_point.h
lib/edgepaint/intersection.c
lib/edgepaint/intersection.h
lib/edgepaint/lab.c
lib/edgepaint/lab.h
lib/edgepaint/lab_gamut.h
lib/edgepaint/node_distinct_coloring.c
lib/edgepaint/node_distinct_coloring.h
lib/sfdpgen/spring_electrical.c
lib/sparse/color_palette.c
lib/sparse/color_palette.h

index d6b28f88f5ebc6f6e9e9974715bc4fcca5d6894a..bf082e759b7fe98a46bd69e64741749b8fc12e13 100644 (file)
@@ -120,8 +120,6 @@ static void init(int argc, char *argv[], real *angle, real *accuracy, char **inf
 
   unsigned int c;
   char* cmd = argv[0];
-  int cs_len = 10000;
-  int r, g, b;
   outfile = NULL;
 
   Verbose = FALSE;
@@ -130,8 +128,7 @@ static void init(int argc, char *argv[], real *angle, real *accuracy, char **inf
   *infile = NULL;
   *check_edges_with_same_endpoint = 0;
   *seed = 123;
-  if (!(*color_scheme)) *color_scheme = malloc(sizeof(char)*cs_len);
-  strcpy(*color_scheme, "lab");
+  *color_scheme = "lab";
   *lightness = NULL;
 
   while ((c = getopt(argc, argv, ":vc:a:s:r:l:o")) != -1) {
@@ -167,14 +164,11 @@ static void init(int argc, char *argv[], real *angle, real *accuracy, char **inf
       break;
     case 'c':
       if (strncmp(optarg,"olor_scheme=", 12) == 0){
-       if (strcmp(optarg + 12,"rgb") != 0 && strcmp(optarg + 12,"lab") != 0 && strcmp(optarg + 12,"gray") != 0 &&
-           (!color_palettes_Q(optarg + 12)) &&
-           sscanf(optarg + 12,"#%02X%02X%02X", &r, &g, &b) != 3){
+       if (knownColorScheme(optarg + 12))
+          *color_scheme = optarg+12;
+        else {
          fprintf(stderr,"-color_scheme option must be a valid string\n");
          usage(cmd, 1);
-       } else {
-         if (strlen(*color_scheme) < strlen(optarg + 12)) *color_scheme = realloc(*color_scheme, sizeof(char)*(strlen(optarg + 12) + 1));
-         strcpy(*color_scheme, optarg + 12);
        }
       } else {
        usage(cmd, 1);
@@ -251,10 +245,10 @@ int main(int argc, char *argv[])
   int check_edges_with_same_endpoint, seed;
   char *color_scheme = NULL;
   char *lightness = NULL;
-       Agraph_t *g;
-       Agraph_t *prev = NULL;
-       ingraph_state ig;
-       int rv = 0;
+  Agraph_t *g;
+  Agraph_t *prev = NULL;
+  ingraph_state ig;
+  int rv = 0;
 
        init(argc, argv, &angle, &accuracy, &infile, &check_edges_with_same_endpoint, &seed, &color_scheme, &lightness);
        newIngraph(&ig, Files, gread);
index e18b18a5c464494196faa2477e101f0554cb1466..ab6c81d47de207a3b98afcf1f4321f37565eaca2 100644 (file)
@@ -11,6 +11,7 @@ AM_CPPFLAGS = \
        -I$(top_srcdir)/lib/neatogen \
        -I$(top_srcdir)/lib/sfdpgen \
        -I$(top_srcdir)/lib/sparse \
+       -I$(top_srcdir)/lib/edgepaint \
        -I$(top_srcdir)/lib/cgraph \
        -I$(top_srcdir)/lib/ingraphs \
        -I$(top_srcdir)/lib/cdt
@@ -31,6 +32,7 @@ gvmap_CPPFLAGS = $(AM_CPPFLAGS)
 cluster_CPPFLAGS = $(AM_CPPFLAGS) -g
 
 gvmap_LDADD = \
+       $(top_builddir)/lib/edgepaint/libedgepaint_C.la \
        $(top_builddir)/lib/sfdpgen/libsfdpgen_C.la \
        $(top_builddir)/lib/neatogen/libneatogen_C.la \
        $(top_builddir)/lib/sparse/libsparse_C.la \
@@ -41,6 +43,7 @@ gvmap_LDADD = \
        $(GTS_LIBS) -lm
 
 cluster_LDADD = \
+       $(top_builddir)/lib/edgepaint/libedgepaint_C.la \
        $(top_builddir)/lib/sfdpgen/libsfdpgen_C.la \
        $(top_builddir)/lib/neatogen/libneatogen_C.la \
        $(top_builddir)/lib/sparse/libsparse_C.la \
index 9025a075501b08024ea1e3275562bdab676f2fd5..40b02a798057caf36054d145c83f79e79b82ebfe 100644 (file)
@@ -36,6 +36,8 @@
 #include "ingraphs.h"
 #include "DotIO.h"
 #include "colorutil.h"
+#include "color_palette.h"
+
 #ifdef WIN32
 #define strdup(x) _strdup(x)
 #endif
@@ -109,6 +111,7 @@ typedef struct {
     int plotedges;
     int color_scheme;
     real line_width;
+    char *color_scheme_str;
     char *opacity;
     char *plot_label;
     real *bg_color;
@@ -275,6 +278,7 @@ init(int argc, char **argv, params_t* pm)
 
   pm->outfile = NULL;
   pm->opacity = NULL;
+  pm->color_scheme_str = NULL;
   pm->nrandom = -1;
   pm->dim = 2;
   pm->shore_depth_tol = 0;
@@ -385,8 +389,12 @@ init(int argc, char **argv, params_t* pm)
         pm->opacity = strdup(stmp);
       } else if ((sscanf(optarg,"%d",&r) > 0) && r >= COLOR_SCHEME_NONE && r <= COLOR_SCHEME_GREY){
         pm->color_scheme = r;
+      } else if (knownColorScheme(optarg)) {
+        pm->color_scheme = COLOR_SCHEME_NONE;
+        pm->color_scheme_str = optarg;
       } else {
-        usage(cmd,1);
+        fprintf(stderr,"-c option %s is invalid, must be a valid integer or string\n", optarg);
+        usage(cmd, 1);
       }
       break;
     case 'd':
@@ -560,6 +568,10 @@ makeMap (SparseMatrix graph, int n, real* x, real* width, int* grouping,
   /* compute a good color permutation */
   if (pm->color_optimize && country_graph && rgb_r && rgb_g && rgb_b) 
     map_optimal_coloring(pm->seed, country_graph, rgb_r,  rgb_g, rgb_b);
+  else if (pm->color_scheme_str){
+    map_palette_optimal_coloring(pm->color_scheme_str, "0,100", country_graph, 0.01, -10,
+               &rgb_r, &rgb_g, &rgb_b);
+  }
 
 #ifdef TIME
   fprintf(stderr, "map making time = %f\n",((real) (clock() - cpu)) / CLOCKS_PER_SEC);
index b9d7bcb0f68b2a4c1ff896337959fd530d23fc0a..59adbb6216c091e38a6c39710f8e70c11ad1b0af 100644 (file)
 #endif /* not SINGLE */
 /* #include "triangle.h" */
 
+#include "lab.h"
+#include "node_distinct_coloring.h"
+
+void map_palette_optimal_coloring(char *color_scheme, char *lightness, SparseMatrix A0, real accuracy, int seed, 
+                                 float **rgb_r, float **rgb_g, float **rgb_b){
+  /*
+    for a graph A, get a distinctive color of its nodes so that the color distanmce among all nodes are maximized. Here
+    color distance on a node is defined as the minimum of color differences between a node and its neighbors.
+    accuracy is the threshold given so that when finding the coloring for each node, the optimal is
+    with in "accuracy" of the true global optimal.
+    color_scheme: rgb, gray, lab, or one of the color palettes in color_palettes.h, or a list of hex rgb colors separaterd by comma like "#ff0000,#00ff00"
+    lightness: of the form 0,70, specifying the range of lightness of LAB color. Ignored if scheme is not COLOR_LAB.
+    .          if NULL, 0,70 is assumed
+    A: the graph of n nodes
+    accuracy: how accurate to find the optimal
+    cdim: dimension of the color space
+    seed: random_seed. If negative, consider -seed as the number of random start iterations
+    rgb_r, rgb_g, rgb_b: float array of length A->m + 1, which contains color for each country. 1-based
+  */
+  /*color: On input an array of size n*cdim, if NULL, will be allocated. On exit the final color assignment for node i is [cdim*i,cdim*(i+1)), in RGB (between 0 to 1)
+    color_diff: the minuimum color difference across all edges
+    color_diff_sum: the sum of min color dfference across all nodes
+  */
+  real *colors = NULL, color_diff, color_diff_sum;
+  int flag;
+  int n = A0->m, i, cdim;
+
+  SparseMatrix A, B;
+  int weightedQ = TRUE;
+  int iter_max = 100;
+
+  {real *dist = NULL;
+    A = SparseMatrix_symmetrize(A0, FALSE);
+    SparseMatrix_distance_matrix(A, 0, &dist);
+    SparseMatrix_delete(A);
+    A = SparseMatrix_from_dense(n, n, dist);
+    FREE(dist);
+    A = SparseMatrix_remove_diagonal(A);
+    SparseMatrix_export(stdout, A);
+  }
+
+  //  A = SparseMatrix_multiply(A0, A0);
+  node_distinct_coloring(color_scheme, lightness, weightedQ, A, accuracy, iter_max, seed, &cdim, &colors, &color_diff, &color_diff_sum, &flag);
+
+  if (A != A0){
+    SparseMatrix_delete(A);
+  }
+  *rgb_r = MALLOC(sizeof(float)*(n+1));
+  *rgb_g = MALLOC(sizeof(float)*(n+1));
+  *rgb_b = MALLOC(sizeof(float)*(n+1));
+
+  for (i = 0; i < n; i++){
+    (*rgb_r)[i+1] = (float) colors[cdim*i];
+    (*rgb_g)[i+1] = (float) colors[cdim*i + 1];
+    (*rgb_b)[i+1] = (float) colors[cdim*i + 2];
+  }
+  FREE(colors);
+
+}
+
 void map_optimal_coloring(int seed, SparseMatrix A, float *rgb_r,  float *rgb_g, float *rgb_b){
   int *p = NULL;
   float *u = NULL;
index 84223b478efab55b3698ab3c15c125109e82fce3..15d5d5ec8f395c037d0953d5758046b68b57f0ac 100644 (file)
@@ -48,6 +48,7 @@ void plot_processing_map(Agraph_t* gr, int n, int dim, real *x, SparseMatrix pol
 #endif
 
 void map_optimal_coloring(int seed, SparseMatrix A, float *rgb_r,  float *rgb_g, float *rgb_b);
+void map_palette_optimal_coloring(char *color_scheme, char *lightness, SparseMatrix A, real accuracy, int seed, float **rgb_r, float **rgb_g, float **rgb_b);
 
 enum {POLY_LINE_REAL_EDGE, POLY_LINE_NOT_REAL_EDGE};
 enum {OUT_PS = 1, OUT_M = 0, OUT_M_COUNTRY_GRAPH = 2, OUT_DOT = 3, OUT_PROCESSING = 4};
index dd520c7de18b51d0a5833288767dc1146c2f2ae4..41a5c002eb0cbc9fb94479dcb3f675117a56f5f5 100644 (file)
@@ -1,3 +1,12 @@
+/*************************************************************************
+ * Copyright (c) 2011 AT&T Intellectual Property 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: See CVS logs. Details at http://www.graphviz.org/
+ *************************************************************************/
 #include "general.h"
 #include "time.h"
 #include "SparseMatrix.h"
index f819e033517f34b127b5643ddd0da9d0f704cdca..a059f7f9c2179c6f61cbb7e3087b79304413f5d1 100644 (file)
@@ -1 +1,16 @@
+/*************************************************************************
+ * Copyright (c) 2014 AT&T Intellectual Property 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: See CVS logs. Details at http://www.graphviz.org/
+ *************************************************************************/
+
+#ifndef EDGE_DISTINCT_COLORING_H
+#define EDGE_DISTINCT_COLORING_H
+
 Agraph_t* edge_distinct_coloring(char *color_scheme, char *lightness, Agraph_t* g, real angle, real accuracy, real check_edges_with_same_endpoint, int seed);
+
+#endif
index 05cf55c8de6005cc983922fd6c8a8b42e8d6e7b6..77d0336b23a37dbd6f7383e1be2e1639c61f8638 100644 (file)
@@ -1,3 +1,12 @@
+/*************************************************************************
+ * Copyright (c) 2011 AT&T Intellectual Property 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: See CVS logs. Details at http://www.graphviz.org/
+ *************************************************************************/
 #include "general.h"
 #include "QuadTree.h"
 #include "furtherest_point.h"
index c09d100a581656066b4764ae49d4eb87e421fe26..c12a2da6bbd90eda3ff7054a86cf21858f50c7f1 100644 (file)
@@ -1,3 +1,18 @@
+/*************************************************************************
+ * Copyright (c) 2014 AT&T Intellectual Property 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: See CVS logs. Details at http://www.graphviz.org/
+ *************************************************************************/
+
+#ifndef FURTHEREST_POINT_H
+#define FURTHEREST_POINT_H
+
 void furtherest_point(int k, int dim, real *wgt, real *pts, real *center, real width, int max_level, real (*usr_dist)(int, real*, real*), real *dist_max, real **argmax);
 void furtherest_point_in_list(int k, int dim, real *wgt, real *pts, QuadTree qt, int max_level,
                              real (*usr_dist)(int, real*, real*), real *dist_max, real **argmax);
+#endif
index 6659537e9552fd3773739bfc8eeeed2b083b2032..e7063d098620a3ee6bfd3c9ed9f2f4c6703a439a 100644 (file)
@@ -1,3 +1,12 @@
+/*************************************************************************
+ * Copyright (c) 2011 AT&T Intellectual Property 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: See CVS logs. Details at http://www.graphviz.org/
+ *************************************************************************/
 #include "general.h"
 
 static real cross(real *u, real *v){
index c2e5f2ac5bdd29d439f0be08a6a10dea79d35004..30f6b64d166c074d8b93319a664c1273a41253dd 100644 (file)
@@ -1 +1,16 @@
+/*************************************************************************
+ * Copyright (c) 2014 AT&T Intellectual Property 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: See CVS logs. Details at http://www.graphviz.org/
+ *************************************************************************/
+
+#ifndef INTERSECTION_H
+#define INTERSECTION_H
+
 real intersection_angle(real *p1, real *p2, real *q1, real *q2);
+
+#endif
index 13fecb2eec5d2565c681ecd0e711988f38d9edcf..d1fc4e7b1263059349c1520dbec0747c3073c94d 100644 (file)
@@ -1,3 +1,12 @@
+/*************************************************************************
+ * Copyright (c) 2011 AT&T Intellectual Property 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: See CVS logs. Details at http://www.graphviz.org/
+ *************************************************************************/
 #include "general.h"
 #include "QuadTree.h"
 #include "lab.h"
index 713424b25559e46b3016bba827c6108eb1592dd8..c5fd60ab82cf6b354790fd1b231bd1f0abb9f2c6 100644 (file)
@@ -1,3 +1,12 @@
+/*************************************************************************
+ * Copyright (c) 2014 AT&T Intellectual Property 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: See CVS logs. Details at http://www.graphviz.org/
+ *************************************************************************/
 #ifndef LAB_H
 #define LAB_H
 
index f97e62a311273c1c0eb5e6332ff090cfd294d57a..2a30bec09ecb80b722f0e4782afe56c13b8ece4f 100644 (file)
@@ -1,3 +1,16 @@
+/*************************************************************************
+ * Copyright (c) 2014 AT&T Intellectual Property 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: See CVS logs. Details at http://www.graphviz.org/
+ *************************************************************************/
+
+#ifndef LAB_GAMUT_H
+#define LAB_GAMUT_H
+
 static color_lab lab_gamut_data[] = {{0,0,0},
 {1,-2,1},
 {1,-1,-1},
@@ -826814,3 +826827,5 @@ static color_lab lab_gamut_data[] = {{0,0,0},
 {99,1,1},
 {99,2,-1},
 {100,0,0}};
+
+#endif
index 829a536a75acb61f4bb81eb7d3b00703aebb3e3d..399553861836040d79f56a9f177fa1a74717b852 100644 (file)
@@ -1,3 +1,12 @@
+/*************************************************************************
+ * Copyright (c) 2011 AT&T Intellectual Property 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: See CVS logs. Details at http://www.graphviz.org/
+ *************************************************************************/
 #include "general.h"
 #include "SparseMatrix.h"
 #include "QuadTree.h"
index 625bf7ffe2aaf49c5962df98c68d173a989c4588..c560b110710b659b8ebb16f0548d8a8e772ec1ed 100644 (file)
@@ -1,3 +1,18 @@
+/*************************************************************************
+ * Copyright (c) 2014 AT&T Intellectual Property 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: See CVS logs. Details at http://www.graphviz.org/
+ *************************************************************************/
+
+#ifndef NODE_DISTINCT_COLORING_H
+#define NODE_DISTINCT_COLORING_H
+
 enum {COLOR_RGB, COLOR_GRAY, COLOR_LAB};
 enum {ERROR_BAD_LAB_GAMUT_FILE = -10, ERROR_BAD_COLOR_SCHEME = -9};
 void node_distinct_coloring(char *color_scheme, char *lightness, int weightedQ, SparseMatrix A, real accuracy, int iter_max, int seed, int *cdim, real **colors, real *color_diff, real *color_diff_sum, int *flag);
+
+#endif
index b55779d62062a4eb6f4a4fc9837d1644e2e4c8a3..29485cd63e6f320c1cd0fa435c98285fb53df8e4 100644 (file)
@@ -234,8 +234,9 @@ void export_embedding(FILE *fp, int dim, SparseMatrix A, real *x, real *width){
   if (width && dim == 2){
     for (i = 0; i < A->m; i++){
       if (i >= 0) fprintf(fp,",");
-      fprintf(fp,"(*%f,%f*){GrayLevel[.5,.5],Rectangle[{%f,%f},{%f,%f}]}", width[i*dim], width[i*dim+1],x[i*dim] - width[i*dim] + 5, x[i*dim+1] - width[i*dim+1] + 5,
-             x[i*dim] + width[i*dim] - 5, x[i*dim+1] + width[i*dim+1] - 5);
+      fprintf(fp,"(*width={%f,%f}, x = {%f,%f}*){GrayLevel[.5,.5],Rectangle[{%f,%f},{%f,%f}]}", width[i*dim], width[i*dim+1], x[i*dim], x[i*dim + 1],
+          x[i*dim] - width[i*dim], x[i*dim+1] - width[i*dim+1],
+          x[i*dim] + width[i*dim], x[i*dim+1] + width[i*dim+1]);
     }
   }
 
@@ -479,7 +480,7 @@ void spring_electrical_embedding_fast(int dim, SparseMatrix A0, spring_electrica
   int max_qtree_level = ctrl->max_qtree_level;
   oned_optimizer qtree_level_optimizer = NULL;
 
-  if (!A) return;
+  if (!A || maxiter <= 0) return;
 
   m = A->m, n = A->n;
   if (n <= 0 || dim <= 0) return;
@@ -682,7 +683,7 @@ void spring_electrical_embedding_slow(int dim, SparseMatrix A0, spring_electrica
   oned_optimizer qtree_level_optimizer = NULL;
 
   fprintf(stderr,"spring_electrical_embedding_slow");
-  if (!A) return;
+  if (!A || maxiter <= 0) return;
 
   m = A->m, n = A->n;
   if (n <= 0 || dim <= 0) return;
@@ -941,7 +942,7 @@ void spring_electrical_embedding(int dim, SparseMatrix A0, spring_electrical_con
   int max_qtree_level = ctrl->max_qtree_level;
   oned_optimizer qtree_level_optimizer = NULL;
 
-  if (!A) return;
+  if (!A || maxiter <= 0) return;
 
   m = A->m, n = A->n;
   if (n <= 0 || dim <= 0) return;
@@ -1267,7 +1268,7 @@ void spring_maxent_embedding(int dim, SparseMatrix A0, SparseMatrix D, spring_el
   double stress = 0;
 #endif
 
-  if (!A) return;
+  if (!A || maxiter <= 0) return;
   m = A->m, n = A->n;
   if (n <= 0 || dim <= 0) return;
 
@@ -1525,7 +1526,7 @@ void spring_electrical_spring_embedding(int dim, SparseMatrix A0, SparseMatrix D
   real *center = NULL, *supernode_wgts = NULL, *distances = NULL, nsuper_avg, counts = 0;
   int max_qtree_level = 10;
 
-  if (!A) return;
+  if (!A  || maxiter <= 0) return;
   m = A->m, n = A->n;
   if (n <= 0 || dim <= 0) return;
 
@@ -2191,12 +2192,14 @@ static void multilevel_spring_electrical_embedding_core(int dim, SparseMatrix A0
 
   post_process_smoothing(dim, A, ctrl, node_weights, x, flag);
 
+  if (Verbose) fprintf(stderr, "ctrl->overlap=%d\n",ctrl->overlap);
+
+  /* rotation has to be done before overlap removal, since rotation could induce overlaps */
   if (dim == 2){
     pcp_rotate(n, dim, x);
   }
   if (ctrl->rotation != 0) rotate(n, dim, x, ctrl->rotation);
 
-  if (Verbose) fprintf(stderr, "ctrl->overlap=%d\n",ctrl->overlap);
 
   remove_overlap(dim, A, x, label_sizes, ctrl->overlap, ctrl->initial_scaling,
                 ctrl->edge_labeling_scheme, n_edge_label_nodes, edge_label_nodes, A, ctrl->do_shrinking, flag);
index 4b57a97e470808e0da3eb9650b0152568373e69d..b04c6ead687dcaeef5549f949b1228d6d637b8f7 100644 (file)
@@ -1,5 +1,28 @@
+
+/*************************************************************************
+ * Copyright (c) 2013 AT&T Intellectual Property 
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: See CVS logs. Details at http://www.graphviz.org/
+ *************************************************************************/
+
 #include "color_palette.h"
 #include "string.h"
+#include "macros.h"
+
+int knownColorScheme (char* name)
+{
+  int r, g, b;
+
+  return streq(name,"rgb") 
+      || streq(name,"lab") 
+      || streq(name,"gray") 
+      || color_palettes_Q(name) 
+      || (sscanf(name,"#%02X%02X%02X", &r, &g, &b) == 3);
+}
 
 char *color_palettes_get(char *color_palette_name){
   int i;
index 044805a804ca122dc85356eff15386129071d929..991497811e87420284794f5e8945157b2cf6674b 100644 (file)
 enum {MAX_COLOR = 1001};
 
 enum {npalettes = 265};
+extern int knownColorScheme (char*);
 extern char *color_palettes[npalettes][2];
-char *color_palettes_get(char *color_palette_name);/* return a list of rgb in hex form: "#ff0000,#00ff00,..." */
-void color_palettes_name_print(FILE *fp);
-int color_palettes_Q(char *color_palette_name);
+  /* return a list of rgb in hex form: "#ff0000,#00ff00,..." */
+extern char *color_palettes_get(char *color_palette_name);
+extern void color_palettes_name_print(FILE *fp);
+extern int color_palettes_Q(char *color_palette_name);
 
 extern float palette_pastel[1001][3];
 extern float palette_blue_to_yellow[1001][3];