| 933 | **********************************************************************/ |
| 934 | |
| 935 | int msCopyMap(mapObj *dst, mapObj *src) |
| 936 | { |
| 937 | int i, return_value; |
| 938 | outputFormatObj *format; |
| 939 | |
| 940 | MS_COPYSTRING(dst->name, src->name); |
| 941 | MS_COPYSTELEM(status); |
| 942 | MS_COPYSTELEM(height); |
| 943 | MS_COPYSTELEM(width); |
| 944 | |
| 945 | for (i = 0; i < src->numlayers; i++) { |
| 946 | if (msGrowMapLayers(dst) == NULL) |
| 947 | return MS_FAILURE; |
| 948 | initLayer((GET_LAYER(dst, i)), dst); |
| 949 | |
| 950 | return_value = msCopyLayer((GET_LAYER(dst, i)), (GET_LAYER(src, i))); |
| 951 | if (return_value != MS_SUCCESS) { |
| 952 | msSetError(MS_MEMERR, "Failed to copy layer.", "msCopyMap()"); |
| 953 | return MS_FAILURE; |
| 954 | } |
| 955 | dst->numlayers++; |
| 956 | } |
| 957 | |
| 958 | return_value = msCopyFontSet(&(dst->fontset), &(src->fontset), dst); |
| 959 | if (return_value != MS_SUCCESS) { |
| 960 | msSetError(MS_MEMERR, "Failed to copy fontset.", "msCopyMap()"); |
| 961 | return MS_FAILURE; |
| 962 | } |
| 963 | |
| 964 | return_value = msCopySymbolSet(&(dst->symbolset), &(src->symbolset), dst); |
| 965 | if(return_value != MS_SUCCESS) { |
| 966 | msSetError(MS_MEMERR, "Failed to copy symbolset.", "msCopyMap()"); |
| 967 | return MS_FAILURE; |
| 968 | } |
| 969 | |
| 970 | /* msCopyLabelCache(&(dst->labelcache), &(src->labelcache)); */ |
| 971 | MS_COPYSTELEM(transparent); |
| 972 | MS_COPYSTELEM(interlace); |
| 973 | MS_COPYSTELEM(imagequality); |
| 974 | |
| 975 | MS_COPYRECT(&(dst->extent), &(src->extent)); |
| 976 | |
| 977 | MS_COPYSTELEM(cellsize); |
| 978 | MS_COPYSTELEM(units); |
| 979 | MS_COPYSTELEM(scaledenom); |
| 980 | MS_COPYSTELEM(defresolution); |
| 981 | MS_COPYSTELEM(resolution); |
| 982 | MS_COPYSTRING(dst->shapepath, src->shapepath); |
| 983 | MS_COPYSTRING(dst->mappath, src->mappath); |
| 984 | |
| 985 | MS_COPYCOLOR(&(dst->imagecolor), &(src->imagecolor)); |
| 986 | |
| 987 | /* clear existing destination format list */ |
| 988 | if( dst->outputformat && --dst->outputformat->refcount < 1 ) |
| 989 | { |
| 990 | msFreeOutputFormat( dst->outputformat ); |
| 991 | dst->outputformat = NULL; |
| 992 | } |