- Timestamp:
- Dec 12, 2017, 4:09:47 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/prototype-v0/zoo-project/zoo-kernel/service_internal_ms.c
r854 r860 76 76 77 77 /** 78 * Return the current publish_id value 79 * @param elem and maps pointer on which the search occur 80 * @return the integer value of the publish_id field, if any, 0 otherwise 81 */ 82 int getPublishedId(maps* elem){ 83 map* myIndex=getMap(elem->content,"published_id"); 84 if(myIndex!=NULL){ 85 return atoi(myIndex->value); 86 } 87 return 0; 88 } 89 /** 78 90 * Add width and height keys to an output maps containing the maximum width 79 91 * and height for displaying the full data extent. … … 87 99 */ 88 100 void setMapSize(maps* output,double minx,double miny,double maxx,double maxy){ 101 int imyIndex=getPublishedId(output); 89 102 double maxWidth=640; 90 103 double maxHeight=480; … … 118 131 #endif 119 132 if(output!=NULL){ 120 addToMap(output->content,"width",sWidth);121 addToMap(output->content,"height",sHeight);133 setMapArray(output->content,"width",imyIndex,sWidth); 134 setMapArray(output->content,"height",imyIndex,sHeight); 122 135 } 123 136 } … … 131 144 */ 132 145 void setReferenceUrl(maps* m,maps* tmpI){ 133 outputMapfile(m,tmpI);134 146 map *msUrl=getMapFromMaps(m,"main","mapserverAddress"); 135 147 if(msUrl==NULL){ … … 138 150 exit(-1); 139 151 } 152 int imyIndex=getPublishedId(tmpI); 153 if(getMapArray(tmpI->content,"ref_wms_link",imyIndex)!=NULL) 154 return; 155 outputMapfile(m,tmpI); 140 156 int finalProto=-1; 141 157 map *msOgcVersion=getMapFromMaps(m,"main","msOgcVersion"); 142 158 map *dataPath=getMapFromMaps(m,"main","dataPath"); 143 159 map *sid=getMapFromMaps(m,"lenv","usid"); 144 map* format=getMap(tmpI->content,"mimeType"); 145 map* rformat=getMap(tmpI->content,"requestedMimeType"); 146 map* width=getMap(tmpI->content,"width"); 147 map* height=getMap(tmpI->content,"height"); 148 map* protoMap=getMap(tmpI->content,"msOgc"); 149 map* versionMap=getMap(tmpI->content,"msOgcVersion"); 160 map* format=getMapArray(tmpI->content,"mimeType",imyIndex); 161 map* rformat=getMapArray(tmpI->content,"requestedMimeType",imyIndex); 162 map* width=getMapArray(tmpI->content,"width",imyIndex); 163 map* height=getMapArray(tmpI->content,"height",imyIndex); 164 map* protoMap=getMapArray(tmpI->content,"msOgc",imyIndex); 165 map* versionMap=getMapArray(tmpI->content,"msOgcVersion",imyIndex); 166 map* datatype=getMapArray(tmpI->content,"geodatatype",imyIndex); 150 167 char options[4][5][25]={ 151 168 {"WMS","1.3.0","GetMap","layers=%s","wms_extent"}, … … 154 171 {"WCS","1.1.0","GetCoverage","coverage=%s","wcs_extent"} 155 172 }; 156 map* datatype=getMap(tmpI->content,"geodatatype");157 173 if(datatype==NULL || strncmp(datatype->value,"other",5)==0){ 158 setMapInMaps(m,"lenv","mapError","true"); 159 setMapInMaps(m,"lenv","locator",tmpI->name); 160 setMapInMaps(m,"lenv","message",_("The ZOO-Kernel was able to retrieve the data but could not read it as geographic data.")); 161 if(getMapFromMaps(m,"lenv","state")==NULL) 162 errorException (m, _("Unable to find any geographic data"), "WrongInputData", tmpI->name); 174 map* minNb=getMap(tmpI->content,"minoccurs"); 175 if(minNb==NULL || atoi(minNb->value)>=1){ 176 setMapInMaps(m,"lenv","mapError","true"); 177 setMapInMaps(m,"lenv","locator",tmpI->name); 178 setMapInMaps(m,"lenv","message",_("The ZOO-Kernel was able to retrieve the data but could not read it as geographic data.")); 179 if(getMapFromMaps(m,"lenv","state")==NULL) 180 errorException (m, _("Unable to find any geographic data"), "WrongInputData", tmpI->name); 181 } 163 182 return; 164 183 } 165 184 int proto=0; 166 185 if(rformat==NULL){ 167 rformat=getMap (tmpI->content,"mimeType");186 rformat=getMapArray(tmpI->content,"mimeType",imyIndex); 168 187 } 169 188 if(strncasecmp(rformat->value,"text/xml",8)==0) … … 172 191 strncasecmp(rformat->value,"image/geotiff",10)==0) 173 192 proto=2; 193 int hasFormat=-1; 174 194 if(protoMap!=NULL){ 175 if(strncasecmp(protoMap->value,"WMS",3)==0) 195 hasFormat=1; 196 if(strncasecmp(protoMap->value,"WMS",3)==0){ 176 197 proto=0; 198 rformat=createMap("value","image/png"); 199 } 177 200 else{ 178 if(strncasecmp(protoMap->value,"WFS",3)==0) 201 if(strncasecmp(protoMap->value,"WFS",3)==0){ 179 202 proto=1; 180 else 203 rformat=createMap("value","text/xml"); 204 } 205 else { 181 206 proto=2; 207 rformat=createMap("value","image/tiff"); 208 } 182 209 } 183 210 } … … 190 217 } 191 218 192 map* extent=getMap(tmpI->content,options[proto][4]); 193 map* crs=getMap(tmpI->content,"crs"); 219 220 map* extent=getMapArray(tmpI->content,options[proto][4],imyIndex); 221 map* crs=getMapArray(tmpI->content,"crs",imyIndex); 194 222 int hasCRS=1; 195 223 if(crs==NULL){ … … 203 231 sprintf(layers,options[proto][3],tmpI->name); 204 232 205 char* webService_url=(char*)malloc((strlen(msUrl->value)+strlen(format->value)+strlen(tmpI->name)+strlen(width->value)+strlen(height->value)+strlen(extent->value)+256)*sizeof(char)); 233 if(format==NULL || width==NULL || height==NULL || extent==NULL){ 234 char tmpStr[1024]; 235 sprintf(tmpStr,_("Unable to create the mapfile for %s because of missing values."),tmpI->name); 236 errorException (m, tmpStr, 237 "InternalError", NULL); 238 exit(-1); 239 return; 240 } 241 242 if(proto==0){ 243 hasFormat=1; 244 rformat=createMap("mimeType","image/png"); 245 }else{ 246 if(proto==1){ 247 rformat=createMap("mimeType","text/xml"); 248 hasFormat=1; 249 } 250 else 251 if(proto==2){ 252 rformat=createMap("mimeType","image/tiff"); 253 hasFormat=1; 254 finalProto=1; 255 } 256 } 206 257 258 char* webService_url=(char*)malloc((strlen(msUrl->value)+strlen(rformat->value)+strlen(tmpI->name)+strlen(width->value)+strlen(height->value)+strlen(extent->value)+256)*sizeof(char)); 259 260 207 261 if(proto>0){ 208 262 if(proto==2) 209 263 finalProto=1; 210 264 sprintf(webService_url, 211 "%s?map=%s/%s_% s.map&request=%s&service=%s&version=%s&%s&format=%s&bbox=%s&crs=%s",265 "%s?map=%s/%s_%d_%s.map&request=%s&service=%s&version=%s&%s&format=%s&bbox=%s&crs=%s", 212 266 msUrl->value, 213 267 dataPath->value, 214 268 tmpI->name, 269 imyIndex, 215 270 sid->value, 216 271 options[proto][2], … … 223 278 ); 224 279 if(datatype!=NULL && strncasecmp(datatype->value,"raster",6)==0){ 225 addToMap(tmpI->content,"ref_wcs_link",webService_url);280 setMapArray(tmpI->content,"ref_wcs_link",imyIndex,webService_url); 226 281 } 227 282 else{ 228 addToMap(tmpI->content,"ref_wfs_link",webService_url);283 setMapArray(tmpI->content,"ref_wfs_link",imyIndex,webService_url); 229 284 } 230 285 proto=0; 286 freeMap(&rformat); 287 free(rformat); 231 288 rformat=createMap("mimeType","image/png"); 232 289 } 233 290 else{ 234 291 sprintf(webService_url, 235 "%s?map=%s/%s_% s.map&request=%s&service=%s&version=%s&%s&width=%s&height=%s&format=%s&bbox=%s&crs=%s",292 "%s?map=%s/%s_%d_%s.map&request=%s&service=%s&version=%s&%s&width=%s&height=%s&format=%s&bbox=%s&crs=%s", 236 293 msUrl->value, 237 294 dataPath->value, 238 295 tmpI->name, 296 imyIndex, 239 297 sid->value, 240 298 options[proto][2], … … 248 306 crs->value 249 307 ); 250 addToMap(tmpI->content,"ref_wms_link",webService_url);308 setMapArray(tmpI->content,"ref_wms_link",imyIndex,webService_url); 251 309 if(datatype!=NULL && strncasecmp(datatype->value,"raster",6)==0){ 252 310 proto=2; 311 freeMap(&rformat); 312 free(rformat); 253 313 rformat=createMap("mimeType","image/tiff"); 254 314 } 255 315 else{ 256 316 proto=1; 317 freeMap(&rformat); 318 free(rformat); 257 319 rformat=createMap("mimeType","text/xml"); 258 320 } 259 321 } 260 addToMap(tmpI->content,"Reference",webService_url);322 setMapArray(tmpI->content,"Reference",imyIndex,webService_url); 261 323 memset(layers,0,128); 262 324 sprintf(layers,options[proto][3],tmpI->name); 263 325 protoVersion=options[proto][1]; 264 extent=getMap (tmpI->content,options[proto][4]);326 extent=getMapArray(tmpI->content,options[proto][4],imyIndex); 265 327 memset(webService_url,0,strlen(webService_url)); 266 328 if(proto>0){ … … 268 330 finalProto=1; 269 331 sprintf(webService_url, 270 "%s?map=%s/%s_% s.map&request=%s&service=%s&version=%s&%s&format=%s&bbox=%s&crs=%s",332 "%s?map=%s/%s_%d_%s.map&request=%s&service=%s&version=%s&%s&format=%s&bbox=%s&crs=%s", 271 333 msUrl->value, 272 334 dataPath->value, 273 335 tmpI->name, 336 imyIndex, 274 337 sid->value, 275 338 options[proto][2], … … 282 345 ); 283 346 if(datatype!=NULL && strncasecmp(datatype->value,"raster",6)==0){ 284 addToMap(tmpI->content,"ref_wcs_link",webService_url);347 setMapArray(tmpI->content,"ref_wcs_link",imyIndex,webService_url); 285 348 } 286 349 else{ 287 addToMap(tmpI->content,"ref_wfs_link",webService_url);350 setMapArray(tmpI->content,"ref_wfs_link",imyIndex,webService_url); 288 351 } 289 352 }else{ 290 353 sprintf(webService_url, 291 "%s?map=%s/%s_% s.map&request=%s&service=%s&version=%s&%s&width=%s&height=%s&format=%s&bbox=%s&crs=%s",354 "%s?map=%s/%s_%d_%s.map&request=%s&service=%s&version=%s&%s&width=%s&height=%s&format=%s&bbox=%s&crs=%s", 292 355 msUrl->value, 293 356 dataPath->value, 294 357 tmpI->name, 358 imyIndex, 295 359 sid->value, 296 360 options[proto][2], … … 304 368 crs->value 305 369 ); 306 addToMap(tmpI->content,"ref_wms_link",webService_url);370 setMapArray(tmpI->content,"ref_wms_link",imyIndex,webService_url); 307 371 } 308 372 if(finalProto>0){ … … 311 375 sprintf(layers,options[proto][3],tmpI->name); 312 376 protoVersion=options[proto][1]; 313 extent=getMap (tmpI->content,options[proto][4]);377 extent=getMapArray(tmpI->content,options[proto][4],imyIndex); 314 378 memset(webService_url,0,strlen(webService_url)); 379 freeMap(&rformat); 380 free(rformat); 381 rformat=createMap("value","image/tiff"); 315 382 sprintf(webService_url, 316 "%s?map=%s/%s_% s.map&request=%s&service=%s&version=%s&%s&format=%s&bbox=%s&crs=%s",383 "%s?map=%s/%s_%d_%s.map&request=%s&service=%s&version=%s&%s&format=%s&bbox=%s&crs=%s", 317 384 msUrl->value, 318 385 dataPath->value, 319 386 tmpI->name, 387 imyIndex, 320 388 sid->value, 321 389 options[proto][2], … … 327 395 crs->value 328 396 ); 329 addToMap(tmpI->content,"ref_wcs_preview_link",webService_url);397 setMapArray(tmpI->content,"ref_wcs_preview_link",imyIndex,webService_url); 330 398 } 331 399 if(hasCRS==0){ … … 352 420 OGRSpatialReferenceH hSRS; 353 421 map* msSrs=NULL; 422 int imyIndex=getPublishedId(output); 354 423 hSRS = OSRNewSpatialReference(NULL); 355 424 if( pszProjection!=NULL && strlen(pszProjection)>1){ … … 375 444 if(output!=NULL){ 376 445 if(OSRIsGeographic(hSRS)==TRUE) 377 addToMap(output->content,"crs_isGeographic","true");446 setMapArray(output->content,"crs_isGeographic",imyIndex,"true"); 378 447 else 379 addToMap(output->content,"crs_isGeographic","false");380 addToMap(output->content,"crs",tmpSrs);448 setMapArray(output->content,"crs_isGeographic",imyIndex,"false"); 449 setMapArray(output->content,"crs",imyIndex,tmpSrs); 381 450 } 382 451 } … … 391 460 if(output!=NULL){ 392 461 if(OSRIsGeographic(hSRS)==TRUE) 393 addToMap(output->content,"crs_isGeographic","true");462 setMapArray(output->content,"crs_isGeographic",imyIndex,"true"); 394 463 else 395 addToMap(output->content,"crs_isGeographic","false");464 setMapArray(output->content,"crs_isGeographic",imyIndex,"false"); 396 465 } 397 466 free(proj4Str); … … 401 470 msLoadProjectionStringEPSG(&myLayer->projection,"EPSG:4326"); 402 471 if(output!=NULL){ 403 addToMap(output->content,"crs_isGeographic","true");472 setMapArray(output->content,"crs_isGeographic",imyIndex,"true"); 404 473 } 405 474 } 406 475 if(output!=NULL){ 407 addToMap(output->content,"crs","EPSG:4326");408 addToMap(output->content,"real_extent","true");476 setMapArray(output->content,"crs",imyIndex,"EPSG:4326"); 477 setMapArray(output->content,"real_extent",imyIndex,"true"); 409 478 } 410 479 msInsertHashTable(&(m->web.metadata),"ows_srs", "EPSG:4326 EPSG:900913 EPSG:3857"); … … 415 484 else{ 416 485 if(output!=NULL){ 417 msSrs=getMap (output->content,"msSrs");486 msSrs=getMapArray(output->content,"msSrs",imyIndex); 418 487 } 419 488 if(msSrs!=NULL){ … … 431 500 } 432 501 if(output!=NULL){ 433 addToMap(output->content,"crs",msSrs->value);434 addToMap(output->content,"crs_isGeographic","true");502 setMapArray(output->content,"crs",imyIndex,msSrs->value); 503 setMapArray(output->content,"crs_isGeographic",imyIndex,"true"); 435 504 } 436 505 } … … 454 523 void setMsExtent(maps* output,mapObj* m,layerObj* myLayer, 455 524 double minX,double minY,double maxX,double maxY){ 525 int imyIndex=getPublishedId(output); 456 526 msMapSetExtent(m,minX,minY,maxX,maxY); 457 527 #ifdef DEBUGMS … … 466 536 467 537 if(output!=NULL){ 468 map* test=getMap(output->content,"real_extent"); 538 map* test=getMapArray(output->content,"real_extent",imyIndex); 539 pointObj min, max; 540 projectionObj tempSrs; 541 min.x = m->extent.minx; 542 min.y = m->extent.miny; 543 max.x = m->extent.maxx; 544 max.y = m->extent.maxy; 545 char tmpSrsStr[1024]; 546 msInitProjection(&tempSrs); 547 msLoadProjectionStringEPSG(&tempSrs,"EPSG:4326"); 548 549 msProjectPoint(&(myLayer->projection),&tempSrs,&min); 550 msProjectPoint(&myLayer->projection,&tempSrs,&max); 551 469 552 if(test!=NULL){ 470 pointObj min, max;471 projectionObj tempSrs;472 min.x = m->extent.minx;473 min.y = m->extent.miny;474 max.x = m->extent.maxx;475 max.y = m->extent.maxy;476 char tmpSrsStr[1024];477 msInitProjection(&tempSrs);478 msLoadProjectionStringEPSG(&tempSrs,"EPSG:4326");479 480 msProjectPoint(&(m->projection),&tempSrs,&min);481 msProjectPoint(&m->projection,&tempSrs,&max);482 483 553 sprintf(tmpExtent,"%.3f,%.3f,%.3f,%.3f",min.y,min.x,max.y,max.x); 484 map* isGeo=getMap (output->content,"crs_isGeographic");554 map* isGeo=getMapArray(output->content,"crs_isGeographic",imyIndex); 485 555 #ifdef DEBUGMS 486 556 fprintf(stderr,"isGeo = %s\n",isGeo->value); 487 557 #endif 488 if(isGeo!=NULL && strcasecmp("true",isGeo->value)==0) 558 if(isGeo!=NULL && strcasecmp("true",isGeo->value)==0){ 559 sprintf(tmpExtent,"%.3f,%.3f,%.3f,%.3f",min.y,min.x,max.y,max.x); 560 setMapArray(output->content,"wgs84_extent",imyIndex,tmpExtent); 489 561 sprintf(tmpExtent,"%f,%f,%f,%f", minY,minX, maxY, maxX); 490 addToMap(output->content,"wms_extent",tmpExtent); 562 }else{ 563 sprintf(tmpExtent,"%.3f,%.3f,%.3f,%.3f",min.x,min.y,max.x,max.y); 564 setMapArray(output->content,"wgs84_extent",imyIndex,tmpExtent); 565 } 566 setMapArray(output->content,"wms_extent",imyIndex,tmpExtent); 491 567 sprintf(tmpSrsStr,"%.3f,%.3f,%.3f,%.3f",min.x,min.y,max.x,max.y); 492 addToMap(output->content,"wcs_extent",tmpExtent);568 setMapArray(output->content,"wcs_extent",imyIndex,tmpExtent); 493 569 }else{ 570 sprintf(tmpExtent,"%.3f,%.3f,%.3f,%.3f",min.x,min.y,max.x,max.y); 571 setMapArray(output->content,"wgs84_extent",imyIndex,tmpExtent); 494 572 sprintf(tmpExtent,"%f,%f,%f,%f",minX, minY, maxX, maxY); 495 map* isGeo=getMap (output->content,"crs_isGeographic");573 map* isGeo=getMapArray(output->content,"crs_isGeographic",imyIndex); 496 574 if(isGeo!=NULL){ 497 575 #ifdef DEBUGMS … … 501 579 sprintf(tmpExtent,"%f,%f,%f,%f", minY,minX, maxY, maxX); 502 580 } 503 addToMap(output->content,"wms_extent",tmpExtent);581 setMapArray(output->content,"wms_extent",imyIndex,tmpExtent); 504 582 sprintf(tmpExtent,"%.3f,%.3f,%.3f,%.3f",minX,minY,maxX,maxY); 505 addToMap(output->content,"wcs_extent",tmpExtent);583 setMapArray(output->content,"wcs_extent",imyIndex,tmpExtent); 506 584 } 507 585 } … … 518 596 */ 519 597 int tryOgr(maps* conf,maps* output,mapObj* m){ 520 521 map* tmpMap=getMap (output->content,"storage");598 int imyIndex=getPublishedId(output); 599 map* tmpMap=getMapArray(output->content,"storage",imyIndex); 522 600 char *pszDataSource=tmpMap->value; 523 601 … … 643 721 #endif 644 722 setMapInMaps(conf,"lenv","message","Unable to open datasource in read only mode"); 645 //OGR_DS_Destroy(poDS);646 //OGRCleanupAll();647 723 #ifdef DEBUGMS 648 724 fprintf(stderr,"Unable to access the DataSource, exit! \n"); … … 651 727 } 652 728 653 addToMap(output->content,"geodatatype","vector");729 setMapArray(output->content,"geodatatype",imyIndex,"vector"); 654 730 int iLayer = 0; 655 731 for( iLayer=0; iLayer < OGR_DS_GetLayerCount(poDS); iLayer++ ){ … … 687 763 msConnectLayer(myLayer,MS_OGR,pszDataSource); 688 764 689 addIntToMap (output->content,"nb_features",OGR_L_GetFeatureCount(poLayer,1));765 addIntToMapArray(output->content,"nb_features",imyIndex,OGR_L_GetFeatureCount(poLayer,1)); 690 766 691 767 /** … … 739 815 } 740 816 else{ 741 addToMap(output->content,"crs","EPSG:4326");742 addToMap(output->content,"crs_isGeographic","true");817 setMapArray(output->content,"crs",imyIndex,"EPSG:4326"); 818 setMapArray(output->content,"crs_isGeographic",imyIndex,"true"); 743 819 msLoadProjectionStringEPSG(&m->projection,"EPSG:4326"); 744 820 msInsertHashTable(&(m->web.metadata), "ows_srs", "EPSG:4326 EPSG:900913 EPSG:3857"); … … 752 828 memset(&extent,0,1024); 753 829 sprintf(extent,"%d,%d,%d,%d",oExt.MinX, oExt.MinY, oExt.MaxX, oExt.MaxY); 754 addToMap(output->content,"boundingbox",extent);830 setMapArray(output->content,"boundingbox",imyIndex,extent); 755 831 } 756 832 … … 771 847 msInsertHashTable(&(myLayer->metadata), "gml_include_items", "all"); 772 848 msInsertHashTable(&(myLayer->metadata), "ows_name", output->name); 773 map* tmpMap=getMap (output->content,"title");849 map* tmpMap=getMapArray(output->content,"title",imyIndex); 774 850 if(tmpMap!=NULL) 775 851 msInsertHashTable(&(myLayer->metadata), "ows_title", tmpMap->value); … … 839 915 */ 840 916 int tryGdal(maps* conf,maps* output,mapObj* m){ 841 map* tmpMap=getMap(output->content,"storage"); 917 int imyIndex=getPublishedId(output); 918 map* tmpMap=getMapArray(output->content,"storage",imyIndex); 842 919 char *pszFilename=tmpMap->value; 843 920 GDALDatasetH hDataset; … … 855 932 fprintf(stderr,"Unable to access the DataSource %s \n",pszFilename); 856 933 #endif 857 addToMap(output->content,"geodatatype","other");934 setMapArray(output->content,"geodatatype",imyIndex,"other"); 858 935 setMapInMaps(conf,"lenv","message","gdalinfo failed - unable to open"); 859 936 GDALDestroyDriverManager(); … … 864 941 #endif 865 942 866 addToMap(output->content,"geodatatype","raster");943 setMapArray(output->content,"geodatatype",imyIndex,"raster"); 867 944 /** 868 945 * Add a new layer set name, data … … 886 963 887 964 char *title=output->name; 888 tmpMap=getMap (output->content,"title");965 tmpMap=getMapArray(output->content,"title",imyIndex); 889 966 if(tmpMap!=NULL) 890 967 title=tmpMap->value; 891 968 char *abstract=output->name; 892 tmpMap=getMap (output->content,"abstract");969 tmpMap=getMapArray(output->content,"abstract",imyIndex); 893 970 if(tmpMap!=NULL) 894 971 abstract=tmpMap->value; … … 905 982 m->width=GDALGetRasterXSize( hDataset ); 906 983 m->height=GDALGetRasterYSize( hDataset ); 907 addIntToMap (output->content,"nb_pixels",GDALGetRasterXSize( hDataset )*GDALGetRasterYSize( hDataset ));984 addIntToMapArray(output->content,"nb_pixels",imyIndex,GDALGetRasterXSize( hDataset )*GDALGetRasterYSize( hDataset )); 908 985 909 986 /** … … 947 1024 memset(&extent,0,1024); 948 1025 sprintf(extent,"%d,%d,%d,%d",minX,minY,maxX,maxY); 949 addToMap(output->content,"boundingbox",extent);1026 setMapArray(output->content,"boundingbox",imyIndex,extent); 950 1027 } 951 1028 }else{ 952 1029 int scale=1; 953 1030 if(m->width>2048){ 954 addIntToMap (output->content,"width",2048);1031 addIntToMapArray(output->content,"width",imyIndex,2048); 955 1032 scale=2048/m->width; 956 1033 }else 957 addIntToMap (output->content,"width",m->width);958 addIntToMap (output->content,"height",m->height*scale);1034 addIntToMapArray(output->content,"width",imyIndex,m->width); 1035 addIntToMapArray(output->content,"height",imyIndex,m->height*scale); 959 1036 } 960 1037 … … 1130 1207 * First store the value on disk 1131 1208 */ 1132 map* mime=getMap(outputs->content,"mimeType"); 1209 int imyIndex=getPublishedId(outputs); 1210 map* mime=getMapArray(outputs->content,"mimeType",imyIndex); 1133 1211 char *ext="data"; 1134 1212 if(mime!=NULL) … … 1136 1214 ext="json"; 1137 1215 1138 map* storage=getMap (outputs->content,"storage");1216 map* storage=getMapArray(outputs->content,"storage",imyIndex); 1139 1217 if(storage==NULL){ 1140 1218 map* tmpMap=getMapFromMaps(conf,"main","dataPath"); 1141 1219 map* sidMap=getMapFromMaps(conf,"lenv","usid"); 1142 1220 char *pszDataSource=(char*)malloc((strlen(tmpMap->value)+strlen(sidMap->value)+strlen(outputs->name)+17)*sizeof(char)); 1143 sprintf(pszDataSource,"%s/ZOO_DATA_% s_%s.%s",tmpMap->value,outputs->name,sidMap->value,ext);1221 sprintf(pszDataSource,"%s/ZOO_DATA_%d_%s_%s.%s",tmpMap->value,imyIndex,outputs->name,sidMap->value,ext); 1144 1222 int f=zOpen(pszDataSource,O_WRONLY|O_CREAT,S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH); 1145 map *gfile=getMap (outputs->content,"generated_file");1223 map *gfile=getMapArray(outputs->content,"generated_file",imyIndex); 1146 1224 if(gfile!=NULL){ 1147 1225 readGeneratedFile(conf,outputs->content,gfile->value); 1148 1226 } 1149 map* sizeMap=getMap (outputs->content,"size");1150 map* vData=getMap (outputs->content,"value");1227 map* sizeMap=getMapArray(outputs->content,"size",imyIndex); 1228 map* vData=getMapArray(outputs->content,"value",imyIndex); 1151 1229 if(sizeMap!=NULL){ 1152 1230 zWrite(f,vData->value,atoi(sizeMap->value)*sizeof(char)); … … 1156 1234 } 1157 1235 close(f); 1158 addToMap(outputs->content,"storage",pszDataSource);1236 setMapArray(outputs->content,"storage",imyIndex,pszDataSource); 1159 1237 free(pszDataSource); 1160 1238 } … … 1327 1405 map* sid=getMapFromMaps(conf,"lenv","usid"); 1328 1406 char *mapPath= 1329 (char*)malloc(( 7+strlen(sid->value)+strlen(outputs->name)+strlen(tmp1->value))*sizeof(char));1330 sprintf(mapPath,"%s/%s_% s.map",tmp1->value,outputs->name,sid->value);1407 (char*)malloc((14+strlen(sid->value)+strlen(outputs->name)+strlen(tmp1->value))*sizeof(char)); 1408 sprintf(mapPath,"%s/%s_%d_%s.map",tmp1->value,outputs->name,imyIndex,sid->value); 1331 1409 msSaveMap(myMap,mapPath); 1332 1410 free(mapPath);
Note: See TracChangeset
for help on using the changeset viewer.