Skip to content

Commit d2dda2c

Browse files
committed
PROJ6: improve performance of msOWSPrintBoundingBox() with context sharing
1 parent c3afefd commit d2dda2c

File tree

7 files changed

+284
-184
lines changed

7 files changed

+284
-184
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ mappluginlayer.c mapsymbol.c mapchart.c mapimagemap.c mappool.c maptclutf.c
259259
mapcluster.c mapio.c mappostgis.c maptemplate.c mapcontext.c mapjoin.c
260260
mappostgresql.c mapthread.c mapcopy.c maplabel.c mapprimitive.c maptile.c
261261
mapcpl.c maplayer.c mapproject.c maptime.c mapcrypto.c maplegend.c hittest.c
262-
mapprojhack.c maptree.c mapdebug.c maplexer.c mapquantization.c mapunion.c
262+
maptree.c mapdebug.c maplexer.c mapquantization.c mapunion.c
263263
mapdraw.c maplibxml2.c mapquery.c maputil.c strptime.c mapdrawgdal.c
264264
mapraster.c mapuvraster.c mapdummyrenderer.c mapobject.c maprasterquery.c
265265
mapwcs.c maperror.c mapogcfilter.c mapregex.c mapwcs11.c mapfile.c

mapcopy.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ int msCopyProjectionExtended(projectionObj *dst, projectionObj *src, char ** arg
7070
for(i=0 ; i< num_args; i++) {
7171
dst->args[dst->numargs++] = msStrdup(args[i]);
7272
}
73+
msProjectionInheritContextFrom(dst, src);
7374
if (dst->numargs != 0) {
7475
if (msProcessProjection(dst) != MS_SUCCESS)
7576
return MS_FAILURE;

mapfile.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,7 +1266,8 @@ int msLoadProjectionStringEPSG(projectionObj *p, const char *value)
12661266
{
12671267
#ifdef USE_PROJ
12681268
assert(p);
1269-
msFreeProjection(p);
1269+
1270+
msFreeProjectionExceptContext(p);
12701271

12711272
p->gt.need_geotransform = MS_FALSE;
12721273
#ifdef USE_PROJ_FASTPATHS
@@ -1299,8 +1300,7 @@ int msLoadProjectionString(projectionObj *p, const char *value)
12991300
p->gt.need_geotransform = MS_FALSE;
13001301

13011302
#ifdef USE_PROJ
1302-
msFreeProjection(p);
1303-
1303+
msFreeProjectionExceptContext(p);
13041304

13051305
/*
13061306
* Handle new style definitions, the same as they would be given to
@@ -3570,6 +3570,12 @@ int initLayer(layerObj *layer, mapObj *map)
35703570

35713571
layer->units = MS_METERS;
35723572
if(msInitProjection(&(layer->projection)) == -1) return(-1);
3573+
3574+
if( map )
3575+
{
3576+
msProjectionInheritContextFrom(&(layer->projection), &(map->projection));
3577+
}
3578+
35733579
layer->project = MS_TRUE;
35743580

35753581
initCluster(&layer->cluster);
@@ -5925,6 +5931,8 @@ int initMap(mapObj *map)
59255931
map->latlon.args[0] = msStrdup("proj=latlong");
59265932
map->latlon.args[1] = msStrdup("ellps=WGS84"); /* probably want a different ellipsoid */
59275933
if(msProcessProjection(&(map->latlon)) == -1) return(-1);
5934+
5935+
msProjectionInheritContextFrom(&(map->projection), &(map->latlon));
59285936
#endif
59295937

59305938
map->templatepattern = map->datapattern = NULL;

mapows.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2093,6 +2093,7 @@ void msOWSProjectToWGS84(projectionObj *srcproj, rectObj *ext)
20932093
if (srcproj->proj && !msProjIsGeographicCRS(srcproj)) {
20942094
projectionObj wgs84;
20952095
msInitProjection(&wgs84);
2096+
msProjectionInheritContextFrom(&wgs84, srcproj);
20962097
msLoadProjectionString(&wgs84, "+proj=longlat +ellps=WGS84 +datum=WGS84");
20972098
msProjectRect(srcproj, &wgs84, ext);
20982099
msFreeProjection(&wgs84);
@@ -2211,6 +2212,7 @@ void msOWSPrintBoundingBox(FILE *stream, const char *tabspace,
22112212

22122213
/* reproject the extents for each SRS's bounding box */
22132214
msInitProjection(&proj);
2215+
msProjectionInheritContextFrom(&proj, srcproj);
22142216
if (msLoadProjectionStringEPSG(&proj, (char *)value) == 0) {
22152217
if (msProjectionsDiffer(srcproj, &proj) == MS_TRUE) {
22162218
msProjectRect(srcproj, &proj, &ext);

0 commit comments

Comments
 (0)