Skip to content
Permalink
Browse files
PROJ6: more uses of reprojectionObj to improve performance
  • Loading branch information
rouault committed Oct 1, 2019
1 parent 528ceec commit cce45562a74162cb089e4a1e3e6de7ab7cd4acc5
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 7 deletions.
@@ -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;
}
@@ -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")); */
@@ -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);
@@ -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);

@@ -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);
@@ -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);

@@ -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):

0 comments on commit cce4556

Please sign in to comment.