Index: trunk/zoo-project/zoo-services/cgal/Makefile
===================================================================
--- trunk/zoo-project/zoo-services/cgal/Makefile	(revision 779)
+++ trunk/zoo-project/zoo-services/cgal/Makefile	(revision 917)
@@ -1,5 +1,5 @@
 ZRPATH=../..
 include ${ZRPATH}/zoo-kernel/ZOOMakefile.opts
-CFLAGS=-I${INST_INCLUDE} ${ZOO_CFLAGS} ${XML2CFLAGS} ${GDAL_CFLAGS} ${PYTHONCFLAGS} ${CGAL_CFLAGS} -frounding-math -fPIC -DLINUX_FREE_ISSUE #-DDEBUG
+CFLAGS= ${ZOO_CFLAGS} ${XML2CFLAGS} ${GDAL_CFLAGS} ${PYTHONCFLAGS} ${CGAL_CFLAGS} -frounding-math -fPIC -DLINUX_FREE_ISSUE #-DDEBUG
 CC=gcc
 
@@ -7,5 +7,5 @@
 	g++ ${CFLAGS} -c ./delaunay.c
 	g++ ${CFLAGS} -c ./voronoi.c
-	g++ ${CFLAGS} -shared -o cgi-env/cgal_service.zo ./delaunay.o ./voronoi.o ./cgal_service.o ${GDAL_LIBS} ${MACOS_LD_FLAGS} ${CGAL_LDFLAGS} -lCGAL -lgmp ${GDAL_LIBS} -L${ZRPATH}/zoo-kernel/ -lzoo_service
+	g++ ${CFLAGS} -shared -o cgi-env/cgal_service.zo ./delaunay.o ./voronoi.o ./cgal_service.o ${GDAL_LIBS} ${CGAL_LDFLAGS} -lCGAL -lgmp ${GDAL_LIBS} -L${ZRPATH}/zoo-kernel/ -lzoo_service -lfcgi
 
 cgal_service.o: cgal_service.c cgal_service.h
Index: trunk/zoo-project/zoo-services/cgal/cgal_service.c
===================================================================
--- trunk/zoo-project/zoo-services/cgal/cgal_service.c	(revision 779)
+++ trunk/zoo-project/zoo-services/cgal/cgal_service.c	(revision 917)
@@ -24,17 +24,32 @@
 #include "cgal_service.h"
 
-int parseInput(maps* conf,maps* inputs, std::vector<Point>* points,char* filename){
+int parseInput(maps* conf,maps* inputs, std::vector<Pointz>* points,char* filename){
   map* tmpm=NULL;
-  tmpm=getMapFromMaps(inputs,"InputPoints","value");
-  VSILFILE *ifile=VSIFileFromMemBuffer(filename,(GByte*)tmpm->value,strlen(tmpm->value),FALSE);
-  VSIFCloseL(ifile);
+  tmpm=getMapFromMaps(inputs,"InputPoints","cache_file");
 #if GDAL_VERSION_MAJOR >= 2
-  GDALDataset *ipoDS =
-    (GDALDataset*) GDALOpenEx( filename,
-			       GDAL_OF_READONLY | GDAL_OF_VECTOR,
-			       NULL, NULL, NULL );
+  GDALDataset *ipoDS;
 #else
-  OGRDataSource* ipoDS = OGRSFDriverRegistrar::Open(filename,FALSE);
+  OGRDataSource* ipoDS;
 #endif
+  if(tmpm==NULL){
+    tmpm=getMapFromMaps(inputs,"InputPoints","value");
+    VSILFILE *ifile=VSIFileFromMemBuffer(filename,(GByte*)tmpm->value,strlen(tmpm->value),FALSE);
+    VSIFCloseL(ifile);
+#if GDAL_VERSION_MAJOR >= 2
+  ipoDS = (GDALDataset*) GDALOpenEx( filename,
+				     GDAL_OF_READONLY | GDAL_OF_VECTOR,
+				     NULL, NULL, NULL );
+#else
+  ipoDS = OGRSFDriverRegistrar::Open(filename,FALSE);
+#endif
+  }else
+#if GDAL_VERSION_MAJOR >= 2
+    ipoDS = (GDALDataset*) GDALOpenEx( tmpm->value,
+				       GDAL_OF_READONLY | GDAL_OF_VECTOR,
+				       NULL, NULL, NULL );
+#else
+    ipoDS = OGRSFDriverRegistrar::Open(tmpm->value,FALSE);
+#endif
+    
   if( ipoDS == NULL )
     {
@@ -87,5 +102,5 @@
 	  break;
 	if(poFeature->GetGeometryRef() != NULL){
-	  points->push_back(Point(OGR_G_GetX(poFeature->GetGeometryRef(),0),OGR_G_GetY(poFeature->GetGeometryRef(),0)));
+	  points->push_back(Pointz(OGR_G_GetX(poFeature->GetGeometryRef(),0),OGR_G_GetY(poFeature->GetGeometryRef(),0)));
 	}
       }
Index: trunk/zoo-project/zoo-services/cgal/cgal_service.h
===================================================================
--- trunk/zoo-project/zoo-services/cgal/cgal_service.h	(revision 779)
+++ trunk/zoo-project/zoo-services/cgal/cgal_service.h	(revision 917)
@@ -38,7 +38,7 @@
 
 typedef CGAL::Exact_predicates_inexact_constructions_kernel            Kernel;
-typedef Kernel::Point_2                                                Point;
+typedef Kernel::Point_2                                                Pointz;
 
-int parseInput(maps*,maps*, std::vector<Point>*,char*);
+int parseInput(maps*,maps*, std::vector<Pointz>*,char*);
 
 #endif
Index: trunk/zoo-project/zoo-services/cgal/cgi-env/Voronoi.zcfg
===================================================================
--- trunk/zoo-project/zoo-services/cgal/cgi-env/Voronoi.zcfg	(revision 779)
+++ trunk/zoo-project/zoo-services/cgal/cgi-env/Voronoi.zcfg	(revision 917)
@@ -46,4 +46,10 @@
     </Default>
     <Supported>
+      mimeType = image/png
+      useMapserver = true
+      asReference = true
+      msStyle = STYLE COLOR 125 0 105 OUTLINECOLOR 0 0 0 WIDTH 0.3 OPACITY 65 END
+    </Supported>
+    <Supported>
      mimeType = text/xml
      encoding = base64
Index: trunk/zoo-project/zoo-services/cgal/delaunay.c
===================================================================
--- trunk/zoo-project/zoo-services/cgal/delaunay.c	(revision 779)
+++ trunk/zoo-project/zoo-services/cgal/delaunay.c	(revision 917)
@@ -40,5 +40,5 @@
     OGRRegisterAll();
 
-    std::vector<Point> points;
+    std::vector<Pointz> points;
     if(int res=parseInput(conf,inputs,&points,"/vsimem/tmp")!=SERVICE_SUCCEEDED)
       return res;
Index: trunk/zoo-project/zoo-services/cgal/voronoi.c
===================================================================
--- trunk/zoo-project/zoo-services/cgal/voronoi.c	(revision 779)
+++ trunk/zoo-project/zoo-services/cgal/voronoi.c	(revision 917)
@@ -24,7 +24,7 @@
 
 #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
-#include <CGAL/Triangulation_euclidean_traits_xy_3.h>
+//#include <CGAL/Triangulation_euclidean_traits_2.h>
 #include <CGAL/Delaunay_triangulation_2.h>
-#include <CGAL/Constrained_Delaunay_triangulation_2.h>
+//#include <CGAL/Constrained_Delaunay_triangulation_2.h>
 #include <CGAL/Triangulation_conformer_2.h>
 #include <CGAL/Triangulation_face_base_2.h>
@@ -39,4 +39,5 @@
 
 typedef CGAL::Delaunay_triangulation_2<Kernel>  Triangulation;
+typedef Triangulation::Face_iterator  Face_iterator;
 typedef Triangulation::Edge_iterator  Edge_iterator;
 typedef Triangulation::Vertex_circulator Vertex_circulator;
@@ -45,7 +46,8 @@
 
   int Voronoi(maps*& conf,maps*& inputs,maps*& outputs){
-#ifdef DEBUG
+    //#ifdef DEBUG
     fprintf(stderr,"\nService internal print\nStarting\n");
-#endif
+    //#endif
+    //return SERVICE_FAILED;
     maps* cursor=inputs;
     OGRGeometryH geometry,res;
@@ -54,14 +56,22 @@
     tmpm=getMapFromMaps(inputs,"InputPoints","value");
 
+    fprintf(stderr," **** %s %d\n",__FILE__,__LINE__);
+    fflush(stderr);
+
     OGRRegisterAll();
 
-    std::vector<Point> points;
-    if(int res=parseInput(conf,inputs,&points,"/vsimem/tmp")!=SERVICE_SUCCEEDED)
-      return res;
+    std::vector<Pointz> points;
+    if(int res=parseInput(conf,inputs,&points,"/vsimem/tmp")!=SERVICE_SUCCEEDED){
+      fprintf(stderr," **** %s %d\n",__FILE__,__LINE__);
+      fflush(stderr);
+      return SERVICE_FAILED;
+    }
+    fprintf(stderr," **** %s %d\n",__FILE__,__LINE__);
+    fflush(stderr);
     
     Triangulation T;
     T.insert(points.begin(), points.end());
 
-    OGRRegisterAll();
+    //OGRRegisterAll();
     /* -------------------------------------------------------------------- */
     /*      Try opening the output datasource as an existing, writable      */
@@ -187,10 +197,21 @@
     int ns = 0;
     int nr = 0;
+    int nf = 0;
+    Face_iterator fit =T.faces_begin();
+    FILE* f=fopen("/tmp/toto.log","w+");
+    for ( ; fit !=T.faces_end(); ++fit) {
+      fprintf(stderr," *** %s %d %d %d\n",__FILE__,__LINE__,nf,fit.info());
+      fflush(stderr);
+      
+      nf++;
+    }
+    fclose(f);
     Edge_iterator eit =T.edges_begin();
     for ( ; eit !=T.edges_end(); ++eit) {
       CGAL::Object o = T.dual(eit);
       if (const Kernel::Segment_2 *tmp=CGAL::object_cast<Kernel::Segment_2>(&o)) {
-	const Point p1=tmp->source();
-	const Point p2=tmp->target();
+	const Pointz p1=tmp->source();
+	const Pointz p2=tmp->target();
+	fprintf(stderr,"P1 %d %d | P2 %d %d\n",p1.x(),p1.y(),p2.x(),p2.y());
 #ifdef DEBUG
 	fprintf(stderr,"P1 %d %d | P2 %d %d\n",p1.x(),p1.y(),p2.x(),p2.y());
@@ -210,6 +231,6 @@
       }
       else if (const Kernel::Ray_2 *tmp=CGAL::object_cast<Kernel::Ray_2>(&o)) { 
-	const Point p1=tmp->source();
-	const Point p2=tmp->point(2);
+	const Pointz p1=tmp->source();
+	const Pointz p2=tmp->point(2);
 	OGRFeatureH hFeature = OGR_F_Create( OGR_L_GetLayerDefn( poDstLayer ) );
 	OGRGeometryH currLine=OGR_G_CreateGeometry(wkbLineString);
@@ -250,5 +271,5 @@
     fprintf(stderr,"\nService internal print\n===\n");
 #endif
-    OGRCleanupAll();
+    //OGRCleanupAll();
     return SERVICE_SUCCEEDED;
   }
