[mapserver-dev] Offset x -99 rendering Problem (and possibly a solution)

thomas bonfort thomas.bonfort at gmail.com
Fri Feb 20 08:44:05 EST 2009


Torsten,
I won't have time to look into this before 5.4 (there's also another
patch sitting in trac for another issue with offset lines).
thanks for looking into this, and hoping you can wait until a 5.4.x release .

(wink: I won't be offended if another dev wants to tackle this  before then )
regards,

thomas

On Mon, Feb 16, 2009 at 09:43, Torsten Weber <TWeber at traffic-consult.de> wrote:
> Hi all,
>
> in our application we need to be able to display line objects which in
> some case bare the same coordinates used in reverse order.
> In our case a travel route (line object) on a street map consists of the
> same street (bearing the same coordinates) used in both directions.
>
> We use the offset to mark the affected direction of traffic flow of an event.
> If the event affects both directions and the directions are not seperated by
> contruction, a geometry will be generated which has coordinates in reversed
> order.
>
> The offset calculation in maputils.c checks for equal direction only by
> checking the gradient but not for reversed direction, so a point will be lost
> and next point is calculated to "nowhere".
>
> We've applied a patch to our local mapserver source which solves this for our
> needs. We changed line 1530 to line 1532 in maputils.c from
>                              if(k==k0) continue; /* checking equal direction */
>                                x = (q-q0)/(k0-k);
>                                y = k*x+q;
>
> to
>                              if (k==k0) {
>                                if ((dx<0&&dx0>0)||(dx>0&&dx0<0)) { //reversed??
>                                  ret->line[i].numpoints++;
>                                  ret->line[i].point=realloc(ret->line[i].point,
> sizeof(pointObj)*ret->line[i].numpoints);
>                                  ret->line[i].point[idx].x =
> p->line[i].point[j-1].x-ox;
>                                  ret->line[i].point[idx].y = p->line[i].point[j-1].y-oy;
>                                  idx++;
>                                  x = p->line[i].point[j-1].x+ox;
>                                  y = p->line[i].point[j-1].y+oy;
>                                } else {
>                                  continue;
>                                }
>                              } else {
>                                x = (q-q0)/(k0-k);
>                                y = k*x+q;
>                              }
>
> It would be nice, if this can find its way to the next mapserver release.
>
> With regards
>
> Torsten Weber
>
> _______________________________________________
> mapserver-dev mailing list
> mapserver-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-dev
>


More information about the mapserver-dev mailing list