Skip to content

Commit

Permalink
PROJ6: improve performance of msOWSPrintBoundingBox() with context sh…
Browse files Browse the repository at this point in the history
…aring
  • Loading branch information
rouault committed Oct 1, 2019
1 parent c3afefd commit d2dda2c
Show file tree
Hide file tree
Showing 7 changed files with 284 additions and 184 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ mappluginlayer.c mapsymbol.c mapchart.c mapimagemap.c mappool.c maptclutf.c
mapcluster.c mapio.c mappostgis.c maptemplate.c mapcontext.c mapjoin.c
mappostgresql.c mapthread.c mapcopy.c maplabel.c mapprimitive.c maptile.c
mapcpl.c maplayer.c mapproject.c maptime.c mapcrypto.c maplegend.c hittest.c
mapprojhack.c maptree.c mapdebug.c maplexer.c mapquantization.c mapunion.c
maptree.c mapdebug.c maplexer.c mapquantization.c mapunion.c
mapdraw.c maplibxml2.c mapquery.c maputil.c strptime.c mapdrawgdal.c
mapraster.c mapuvraster.c mapdummyrenderer.c mapobject.c maprasterquery.c
mapwcs.c maperror.c mapogcfilter.c mapregex.c mapwcs11.c mapfile.c
Expand Down
1 change: 1 addition & 0 deletions mapcopy.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ int msCopyProjectionExtended(projectionObj *dst, projectionObj *src, char ** arg
for(i=0 ; i< num_args; i++) {
dst->args[dst->numargs++] = msStrdup(args[i]);
}
msProjectionInheritContextFrom(dst, src);
if (dst->numargs != 0) {
if (msProcessProjection(dst) != MS_SUCCESS)
return MS_FAILURE;
Expand Down
14 changes: 11 additions & 3 deletions mapfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -1266,7 +1266,8 @@ int msLoadProjectionStringEPSG(projectionObj *p, const char *value)
{
#ifdef USE_PROJ
assert(p);
msFreeProjection(p);

msFreeProjectionExceptContext(p);

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

#ifdef USE_PROJ
msFreeProjection(p);

msFreeProjectionExceptContext(p);

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

layer->units = MS_METERS;
if(msInitProjection(&(layer->projection)) == -1) return(-1);

if( map )
{
msProjectionInheritContextFrom(&(layer->projection), &(map->projection));
}

layer->project = MS_TRUE;

initCluster(&layer->cluster);
Expand Down Expand Up @@ -5925,6 +5931,8 @@ int initMap(mapObj *map)
map->latlon.args[0] = msStrdup("proj=latlong");
map->latlon.args[1] = msStrdup("ellps=WGS84"); /* probably want a different ellipsoid */
if(msProcessProjection(&(map->latlon)) == -1) return(-1);

msProjectionInheritContextFrom(&(map->projection), &(map->latlon));
#endif

map->templatepattern = map->datapattern = NULL;
Expand Down
2 changes: 2 additions & 0 deletions mapows.c
Original file line number Diff line number Diff line change
Expand Up @@ -2093,6 +2093,7 @@ void msOWSProjectToWGS84(projectionObj *srcproj, rectObj *ext)
if (srcproj->proj && !msProjIsGeographicCRS(srcproj)) {
projectionObj wgs84;
msInitProjection(&wgs84);
msProjectionInheritContextFrom(&wgs84, srcproj);
msLoadProjectionString(&wgs84, "+proj=longlat +ellps=WGS84 +datum=WGS84");
msProjectRect(srcproj, &wgs84, ext);
msFreeProjection(&wgs84);
Expand Down Expand Up @@ -2211,6 +2212,7 @@ void msOWSPrintBoundingBox(FILE *stream, const char *tabspace,

/* reproject the extents for each SRS's bounding box */
msInitProjection(&proj);
msProjectionInheritContextFrom(&proj, srcproj);
if (msLoadProjectionStringEPSG(&proj, (char *)value) == 0) {
if (msProjectionsDiffer(srcproj, &proj) == MS_TRUE) {
msProjectRect(srcproj, &proj, &ext);
Expand Down

0 comments on commit d2dda2c

Please sign in to comment.