Skip to content

Commit

Permalink
PROJ6: more uses of reprojectionObj to improve performance
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed Oct 1, 2019
1 parent 528ceec commit cce4556
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 7 deletions.
22 changes: 20 additions & 2 deletions mapogcsos.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,15 @@ void msSOSAddGeometryNode(xmlNsPtr psNsGml, xmlNsPtr psNsMs, xmlNodePtr psParen

if (psParent && psShape) {
if (msProjectionsDiffer(&map->projection, &lp->projection) == MS_TRUE) {
msProjectShape(&lp->projection, &map->projection, psShape);
if( lp->reprojectorLayerToMap == NULL )
{
lp->reprojectorLayerToMap = msProjectCreateReprojector(
&lp->projection, &map->projection);
}
if( lp->reprojectorLayerToMap )
{
msProjectShapeEx(lp->reprojectorLayerToMap, psShape);
}
msOWSGetEPSGProj(&(map->projection), &(lp->metadata), "SO", MS_TRUE, &pszEpsg_buf);
pszEpsg = pszEpsg_buf;
}
Expand Down Expand Up @@ -773,7 +781,17 @@ void msSOSAddMemberNode(xmlNsPtr psNsGml, xmlNsPtr psNsOm, xmlNsPtr psNsSwe, xml

#ifdef USE_PROJ
if(msProjectionsDiffer(&(lp->projection), &(map->projection)))
msProjectShape(&lp->projection, &map->projection, &sShape);
{
if( lp->reprojectorLayerToMap == NULL )
{
lp->reprojectorLayerToMap = msProjectCreateReprojector(
&lp->projection, &map->projection);
}
if( lp->reprojectorLayerToMap )
{
msProjectShapeEx(lp->reprojectorLayerToMap, &sShape);
}
}
#endif
psNode = xmlNewChild(psNode, psNsGml, BAD_CAST "featureMember", NULL);
/* xmlSetNs(psNode,xmlNewNs(psNode, BAD_CAST "http://www.opengis.net/gml", BAD_CAST "gml")); */
Expand Down
61 changes: 56 additions & 5 deletions maptemplate.c
Original file line number Diff line number Diff line change
Expand Up @@ -1621,7 +1621,17 @@ static int processShplabelTag(layerObj *layer, char **line, shapeObj *origshape)
labelPos = shape->line[0].point[0];
if(layer->transform == MS_TRUE) {
if(layer->project && msProjectionsDiffer(&(layer->projection), &(layer->map->projection)))
msProjectShape(&layer->projection, &layer->map->projection, shape);
{
if( layer->reprojectorLayerToMap == NULL )
{
layer->reprojectorLayerToMap = msProjectCreateReprojector(
&layer->projection, &layer->map->projection);
}
if( layer->reprojectorLayerToMap )
{
msProjectShapeEx(layer->reprojectorLayerToMap, shape);
}
}

labelPos = shape->line[0].point[0];
labelPos.x = MS_MAP2IMAGE_X(labelPos.x, layer->map->extent.minx, cellsize);
Expand All @@ -1632,7 +1642,18 @@ static int processShplabelTag(layerObj *layer, char **line, shapeObj *origshape)
labelposvalid = MS_FALSE;
if(layer->transform == MS_TRUE) {
if(layer->project && msProjectionsDiffer(&(layer->projection), &(layer->map->projection)))
msProjectShape(&layer->projection, &layer->map->projection, shape);
{
if( layer->reprojectorLayerToMap == NULL )
{
layer->reprojectorLayerToMap = msProjectCreateReprojector(
&layer->projection, &layer->map->projection);
}
if( layer->reprojectorLayerToMap )
{
msProjectShapeEx(layer->reprojectorLayerToMap, shape);
}
}

if(clip_to_map)
msClipPolylineRect(shape, layer->map->extent);

Expand Down Expand Up @@ -1661,7 +1682,17 @@ static int processShplabelTag(layerObj *layer, char **line, shapeObj *origshape)
labelposvalid = MS_FALSE;
if(layer->transform == MS_TRUE) {
if(layer->project && msProjectionsDiffer(&(layer->projection), &(layer->map->projection)))
msProjectShape(&layer->projection, &layer->map->projection, shape);
{
if( layer->reprojectorLayerToMap == NULL )
{
layer->reprojectorLayerToMap = msProjectCreateReprojector(
&layer->projection, &layer->map->projection);
}
if( layer->reprojectorLayerToMap )
{
msProjectShapeEx(layer->reprojectorLayerToMap, shape);
}
}

if(clip_to_map)
msClipPolygonRect(shape, layer->map->extent);
Expand Down Expand Up @@ -1749,7 +1780,17 @@ static int processShplabelTag(layerObj *layer, char **line, shapeObj *origshape)

/* if necessary, project the shape to match the map */
if(msProjectionsDiffer(&(layer->projection), &(layer->map->projection)))
msProjectShape(&layer->projection, &layer->map->projection, &tShape);
{
if( layer->reprojectorLayerToMap == NULL )
{
layer->reprojectorLayerToMap = msProjectCreateReprojector(
&layer->projection, &layer->map->projection);
}
if( layer->reprojectorLayerToMap )
{
msProjectShapeEx(layer->reprojectorLayerToMap, &tShape);
}
}

msClipPolylineRect(&tShape, layer->map->extent);

Expand Down Expand Up @@ -2125,7 +2166,17 @@ static int processShpxyTag(layerObj *layer, char **line, shapeObj *shape)

/* if necessary, project the shape to match the map */
if(msProjectionsDiffer(&(layer->projection), &(layer->map->projection)))
msProjectShape(&layer->projection, &layer->map->projection, &tShape);
{
if( layer->reprojectorLayerToMap == NULL )
{
layer->reprojectorLayerToMap = msProjectCreateReprojector(
&layer->projection, &layer->map->projection);
}
if( layer->reprojectorLayerToMap )
{
msProjectShapeEx(layer->reprojectorLayerToMap, &tShape);
}
}

switch(tShape.type) {
case(MS_SHAPE_POINT):
Expand Down

0 comments on commit cce4556

Please sign in to comment.