Changeset 862 for branches/prototype-v0/zoo-project/zoo-services
- Timestamp:
- Feb 1, 2018, 11:27:28 AM (7 years ago)
- Location:
- branches/prototype-v0/zoo-project/zoo-services
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/prototype-v0/zoo-project/zoo-services/cgal/Makefile
r779 r862 1 1 ZRPATH=../.. 2 2 include ${ZRPATH}/zoo-kernel/ZOOMakefile.opts 3 CFLAGS= -I${INST_INCLUDE}${ZOO_CFLAGS} ${XML2CFLAGS} ${GDAL_CFLAGS} ${PYTHONCFLAGS} ${CGAL_CFLAGS} -frounding-math -fPIC -DLINUX_FREE_ISSUE #-DDEBUG3 CFLAGS= ${ZOO_CFLAGS} ${XML2CFLAGS} ${GDAL_CFLAGS} ${PYTHONCFLAGS} ${CGAL_CFLAGS} -frounding-math -fPIC -DLINUX_FREE_ISSUE #-DDEBUG 4 4 CC=gcc 5 5 … … 7 7 g++ ${CFLAGS} -c ./delaunay.c 8 8 g++ ${CFLAGS} -c ./voronoi.c 9 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_service9 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 10 10 11 11 cgal_service.o: cgal_service.c cgal_service.h -
branches/prototype-v0/zoo-project/zoo-services/cgal/cgal_service.c
r775 r862 24 24 #include "cgal_service.h" 25 25 26 int parseInput(maps* conf,maps* inputs, std::vector<Point >* points,char* filename){26 int parseInput(maps* conf,maps* inputs, std::vector<Pointz>* points,char* filename){ 27 27 map* tmpm=NULL; 28 28 tmpm=getMapFromMaps(inputs,"InputPoints","value"); … … 87 87 break; 88 88 if(poFeature->GetGeometryRef() != NULL){ 89 points->push_back(Point (OGR_G_GetX(poFeature->GetGeometryRef(),0),OGR_G_GetY(poFeature->GetGeometryRef(),0)));89 points->push_back(Pointz(OGR_G_GetX(poFeature->GetGeometryRef(),0),OGR_G_GetY(poFeature->GetGeometryRef(),0))); 90 90 } 91 91 } -
branches/prototype-v0/zoo-project/zoo-services/cgal/cgal_service.h
r469 r862 38 38 39 39 typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; 40 typedef Kernel::Point_2 Point ;40 typedef Kernel::Point_2 Pointz; 41 41 42 int parseInput(maps*,maps*, std::vector<Point >*,char*);42 int parseInput(maps*,maps*, std::vector<Pointz>*,char*); 43 43 44 44 #endif -
branches/prototype-v0/zoo-project/zoo-services/cgal/cgi-env/Voronoi.zcfg
r536 r862 46 46 </Default> 47 47 <Supported> 48 mimeType = image/png 49 useMapserver = true 50 asReference = true 51 msStyle = STYLE COLOR 125 0 105 OUTLINECOLOR 0 0 0 WIDTH 0.3 OPACITY 65 END 52 </Supported> 53 <Supported> 48 54 mimeType = text/xml 49 55 encoding = base64 -
branches/prototype-v0/zoo-project/zoo-services/cgal/delaunay.c
r775 r862 40 40 OGRRegisterAll(); 41 41 42 std::vector<Point > points;42 std::vector<Pointz> points; 43 43 if(int res=parseInput(conf,inputs,&points,"/vsimem/tmp")!=SERVICE_SUCCEEDED) 44 44 return res; -
branches/prototype-v0/zoo-project/zoo-services/cgal/voronoi.c
r775 r862 24 24 25 25 #include <CGAL/Exact_predicates_inexact_constructions_kernel.h> 26 #include <CGAL/Triangulation_euclidean_traits_xy_3.h>26 //#include <CGAL/Triangulation_euclidean_traits_2.h> 27 27 #include <CGAL/Delaunay_triangulation_2.h> 28 #include <CGAL/Constrained_Delaunay_triangulation_2.h>28 //#include <CGAL/Constrained_Delaunay_triangulation_2.h> 29 29 #include <CGAL/Triangulation_conformer_2.h> 30 30 #include <CGAL/Triangulation_face_base_2.h> … … 39 39 40 40 typedef CGAL::Delaunay_triangulation_2<Kernel> Triangulation; 41 typedef Triangulation::Face_iterator Face_iterator; 41 42 typedef Triangulation::Edge_iterator Edge_iterator; 42 43 typedef Triangulation::Vertex_circulator Vertex_circulator; … … 45 46 46 47 int Voronoi(maps*& conf,maps*& inputs,maps*& outputs){ 47 #ifdef DEBUG48 //#ifdef DEBUG 48 49 fprintf(stderr,"\nService internal print\nStarting\n"); 49 #endif 50 //#endif 51 //return SERVICE_FAILED; 50 52 maps* cursor=inputs; 51 53 OGRGeometryH geometry,res; … … 54 56 tmpm=getMapFromMaps(inputs,"InputPoints","value"); 55 57 58 fprintf(stderr," **** %s %d\n",__FILE__,__LINE__); 59 fflush(stderr); 60 56 61 OGRRegisterAll(); 57 62 58 std::vector<Point> points; 59 if(int res=parseInput(conf,inputs,&points,"/vsimem/tmp")!=SERVICE_SUCCEEDED) 60 return res; 63 std::vector<Pointz> points; 64 if(int res=parseInput(conf,inputs,&points,"/vsimem/tmp")!=SERVICE_SUCCEEDED){ 65 fprintf(stderr," **** %s %d\n",__FILE__,__LINE__); 66 fflush(stderr); 67 return SERVICE_FAILED; 68 } 69 fprintf(stderr," **** %s %d\n",__FILE__,__LINE__); 70 fflush(stderr); 61 71 62 72 Triangulation T; 63 73 T.insert(points.begin(), points.end()); 64 74 65 OGRRegisterAll();75 //OGRRegisterAll(); 66 76 /* -------------------------------------------------------------------- */ 67 77 /* Try opening the output datasource as an existing, writable */ … … 191 201 CGAL::Object o = T.dual(eit); 192 202 if (const Kernel::Segment_2 *tmp=CGAL::object_cast<Kernel::Segment_2>(&o)) { 193 const Point p1=tmp->source();194 const Point p2=tmp->target();203 const Pointz p1=tmp->source(); 204 const Pointz p2=tmp->target(); 195 205 #ifdef DEBUG 196 206 fprintf(stderr,"P1 %d %d | P2 %d %d\n",p1.x(),p1.y(),p2.x(),p2.y()); … … 210 220 } 211 221 else if (const Kernel::Ray_2 *tmp=CGAL::object_cast<Kernel::Ray_2>(&o)) { 212 const Point p1=tmp->source();213 const Point p2=tmp->point(2);222 const Pointz p1=tmp->source(); 223 const Pointz p2=tmp->point(2); 214 224 OGRFeatureH hFeature = OGR_F_Create( OGR_L_GetLayerDefn( poDstLayer ) ); 215 225 OGRGeometryH currLine=OGR_G_CreateGeometry(wkbLineString); … … 250 260 fprintf(stderr,"\nService internal print\n===\n"); 251 261 #endif 252 OGRCleanupAll();262 //OGRCleanupAll(); 253 263 return SERVICE_SUCCEEDED; 254 264 } -
branches/prototype-v0/zoo-project/zoo-services/ogr/ogr2ogr/service.c
r790 r862 96 96 #endif 97 97 { 98 const char *pszDialect = NULL; 98 99 const char *pszFormat = "ESRI Shapefile"; 99 100 const char *pszDataSource = NULL; … … 155 156 sprintf(serverAddress,"%s",tmpMap->value); 156 157 } 157 158 158 159 tmpMap=NULL; 159 160 char tmpurl[1024]; … … 223 224 if(tmpMap!=NULL && strncasecmp(tmpMap->value,"NULL",4)!=0){ 224 225 pszSQLStatement = tmpMap->value; 226 } 227 228 tmpMap=getMapFromMaps(inputs,"dialect","value"); 229 if(tmpMap!=NULL){ 230 pszDialect=strdup(tmpMap->value); 225 231 } 226 232 … … 367 373 }*/ 368 374 375 369 376 tmpMap=NULL; 370 377 tmpMap=getMapFromMaps(inputs,"InputDSN","value"); … … 825 832 826 833 poResultSet = poDS->ExecuteSQL( pszSQLStatement, poSpatialFilter, 827 NULL);834 pszDialect ); 828 835 829 836 if( poResultSet != NULL ) … … 841 848 } 842 849 poDS->ReleaseResultSet( poResultSet ); 843 } 844 } 850 }else{ 851 setMapInMaps(conf,"lenv","message","There was an error when running yoru SQL query."); 852 if(pszDialect!=NULL) 853 free(pszDialect); 854 return SERVICE_FAILED; 855 } 856 } 857 if(pszDialect!=NULL) 858 free(pszDialect); 845 859 846 860 /* -------------------------------------------------------------------- */ … … 901 915 902 916 #ifdef ZOO_SERVICE 903 outputs->content=createMap("value",(char*)pszwebDestData); 917 setMapInMaps(outputs,"OutputedDataSourceName","value",(char*)pszwebDestData); 918 //outputs->content=createMap("value",(char*)pszwebDestData); 904 919 #endif 905 920 … … 930 945 fprintf(stderr,"%s %d\n",__FILE__,__LINE__); 931 946 932 OGRCleanupAll();947 //OGRCleanupAll(); 933 948 fprintf(stderr,"%s %d\n",__FILE__,__LINE__); 934 949 … … 939 954 940 955 #ifdef ZOO_SERVICE 956 //sleep(10); 941 957 return SERVICE_SUCCEEDED; 942 958 #else -
branches/prototype-v0/zoo-project/zoo-services/utils/hpc/service.c
r854 r862 2 2 * Author : Gérald FENOY 3 3 * 4 * Copyright 20 08-2009GeoLabs SARL. All rights reserved.4 * Copyright 2017 GeoLabs SARL. All rights reserved. 5 5 * 6 6 * This work was supported by public funds received in the framework of GEOSUD, -
branches/prototype-v0/zoo-project/zoo-services/utils/hpc/service2.c
r854 r862 2 2 * Author : Gérald FENOY 3 3 * 4 * Copyright 2008-2009 GeoLabs SARL. All rights reserved. 5 * 4 * Copyright 2017 GeoLabs SARL. All rights reserved. 5 * 6 * This work was supported by public funds received in the framework of GEOSUD, 7 * a project (ANR-10-EQPX-20) of the program "Investissements d'Avenir" managed 8 * by the French National Research Agency 9 * 6 10 * This work was supported by public funds received in the framework of GEOSUD, 7 11 * a project (ANR-10-EQPX-20) of the program "Investissements d'Avenir" managed … … 42 46 43 47 #include <dirent.h> 48 #include <string.h> 49 #include <cerrno> 50 44 51 extern "C" { 52 53 /** 54 * Retrieve the error message which occured when trying to remove a file 55 * (return values can be EACCES, EBUSY, EFAULT, EIO, EISDIR, ELOOP, 56 * ENAMETOOLONG, ENOENT, ENOMEM, ENOTDIR, EPERM, EROFS, UNKNOWN). 57 * 58 * @param errn 59 * @result a string corresponding to the error number 60 */ 61 char* fetchErrno(int errn){ 62 switch(errn){ 63 case EACCES: 64 return "EACCES"; 65 case EBUSY: 66 return "EBUSY"; 67 case EFAULT: 68 return "EFAULT"; 69 case EIO: 70 return "EIO"; 71 case EISDIR: 72 return "EISDIR"; 73 case ELOOP: 74 return "ELOOP"; 75 case ENAMETOOLONG: 76 return "ENAMETOOLONG"; 77 case ENOENT: 78 return "ENOENT"; 79 case ENOMEM: 80 return "ENOMEM"; 81 case ENOTDIR: 82 return "ENOTDIR"; 83 case EPERM: 84 return "EPERM"; 85 case EROFS: 86 return "EROFS"; 87 default: 88 return "UNKNOWN"; 89 } 90 } 45 91 46 92 /** … … 78 124 */ 79 125 int tryDeleteDataFile(const char* storage,const char* filename){ 80 char* fullpath=(char*)malloc((strlen(storage)+strlen(filename)+2)*sizeof(char)); 81 sprintf(fullpath,"%s/%s",storage,filename); 126 char* fullpath=NULL; 127 if(filename!=NULL){ 128 fullpath=(char*)malloc((strlen(storage)+strlen(filename)+2)*sizeof(char)); 129 sprintf(fullpath,"%s/%s",storage,filename); 130 } 131 else 132 fullpath=zStrdup(storage); 82 133 if(unlink(fullpath)==0){ 83 134 // TODO store the filename_full in the deletedfiles 84 fprintf(stderr,"#### DeleteData #### %s %d %s has been successfully deleted\n",__FILE__,__LINE__, filename);135 fprintf(stderr,"#### DeleteData #### %s %d %s has been successfully deleted\n",__FILE__,__LINE__,(strlen(filename)>0?filename:fullpath)); 85 136 }else{ 86 fprintf(stderr,"#### DeleteData #### unable to delete %s \n",fullpath);137 fprintf(stderr,"#### DeleteData #### unable to delete %s %s \n",fullpath,fetchErrno(errno)); 87 138 } 88 139 free(fullpath); … … 138 189 } 139 190 if(fcontent!=NULL && strcasecmp(fcontent,"SHARED")!=0){ 140 // Delete associated zcm and zcp191 // Delete associated zcm, zcp and maps files 141 192 tryDeleteCacheFile(cacheDir->value,filename->value,"zca"); 142 193 tryDeleteCacheFile(cacheDir->value,filename->value,"zcm"); 143 194 tryDeleteCacheFile(cacheDir->value,filename->value,"zcp"); 144 // Delete ZOO_DATA_<input>_<sid>.data and <input>_<sid>.map 195 tryDeleteCacheFile(tmpPath->value,filename->value,"maps"); 196 // Delete <input>_<sid>.map 145 197 char* datafile=(char*)malloc((strlen(jobid->value)+strlen(ioname->value)+19)*sizeof(char)); 146 sprintf(datafile,"ZOO_DATA_%s_%s.data",ioname->value,jobid->value);147 tryDeleteDataFile(dataPath->value,datafile);148 free(datafile);149 datafile=(char*)malloc((strlen(jobid->value)+strlen(ioname->value)+19)*sizeof(char));150 198 sprintf(datafile,"%s_%s.map",ioname->value,jobid->value); 151 199 tryDeleteDataFile(dataPath->value,datafile); … … 160 208 char tmp1[8]; 161 209 snprintf(tmp1,7,"%s",filename->value); 162 if(strcasecmp(tmp1,"output")==0){ 163 tryDeleteDataFile(tmpPath->value,filename->value); 210 if(strcasecmp(tmp1,"output")==0 || strcasecmp(tmp1,"input_")==0){ 211 trydeletedatafile(tmppath->value,filename->value); 212 char *tmp=zStrdup(filename->value); 213 tmp[strlen(tmp)-strlen(strrchr(tmp,'.'))]=0; 214 char *mapsfile=(char*)malloc((strlen(tmp)+6)*sizeof(char)); 215 sprintf(mapsfile,"%s.maps",tmp); 216 char* mapPath=(char*)malloc((strlen(tmpPath->value)+strlen(mapsfile)+2)*sizeof(char)); 217 sprintf(mapPath,"%s/%s",tmpPath->value,mapsfile); 218 FILE* myMapsfile=fopen(mapPath,"r"); 219 if(myMapsfile!=NULL){ 220 char *buffer=(char*)malloc(1024*sizeof(char)); 221 while(fgets(buffer, 1024, myMapsfile) != NULL){ 222 buffer[strlen(buffer)-1]=0; 223 tryDeleteDataFile(buffer,NULL); 224 } 225 free(buffer); 226 fclose(myMapsfile); 227 } 228 tryDeleteDataFile(mapPath,NULL); 229 free(mapPath); 230 free(mapsfile); 164 231 // Delete ZOO_DATA_<output>_<sid>.data and <output>_<sid>.map 165 232 char* datafile=(char*)malloc((strlen(jobid->value)+strlen(ioname->value)+19)*sizeof(char));
Note: See TracChangeset
for help on using the changeset viewer.