Ticket #373 (new defect)

Opened 5 years ago

Problems with SIZEUNITS in 4.0

Reported by: dmorissette Assigned to: sdlime
Priority: high Milestone:
Component: MapServer C Library Version: 4.0
Severity: normal Keywords:
Cc: dgadoury@dmsolutions.ca

Description

We have run into a problem with 'STYLEUNITS', something that used to work in 3.6
didn't work in 4.0.  I have tracked down the problem and I'm filing this bug to
discuss and document the changes that need to be made.

Here is the layer definition that used to work in 3.6:

LAYER
    NAME "buffer_point"
    STATUS ON
    DATA "wnv2003"
    TYPE POINT
    SIZEUNITS KILOMETERS
    CLASS
      NAME "Buffer"
      SYMBOL "circle"
      COLOR 255 255 255
      OUTLINECOLOR 0 0 0
      SIZE 100
    END
  END

To get it to work in 4.0 we had to add SYMBOLSCALE and a MAXSCALE value:

LAYER
    NAME "buffer_point"
    STATUS ON
    DATA "wnv2003"
    TYPE POINT
    SYMBOLSCALE 10
    SIZEUNITS KILOMETERS
    CLASS
      NAME "Buffer"
      SYMBOL "circle"
      COLOR 255 255 255
      OUTLINECOLOR 0 0 0
      SIZE 100
      MINSIZE 2
      MAXSIZE 1000
    END
  END


I have modified the tests in mapdraw.c so that the SYMBOLSCALE isn't required if
SIZEUNITS != PIXELS is specified.  This is in line with what 3.6 used to do and
I'll commit that to CVS in a few minutes.

Now, there are 2 problems left:

1- I noticed that the layer.scalefactor is calculated only inside the functions
msDrawMap() and msDrawQueryMap().  If someone calls msDrawLayer() from MapScript
then the symbol scaling won't happen properly.  I would like to move the
calculation of layer.scalefactor inside msDrawLayer().  Do you see any problem
with that?

2- In 3.6 it was not necessary to specify MINSIZE/MAXSIZE to work together with
SIZEUNITS != PIXELS like we did, I would like to restore that behavior by
changing the tests that validate against MINSIZE/MAXSIZE in the various draw
functions so that if MINSIZE/MAXSIZE aren't specified then there is no limit in
size which seems to be what 3.6 was doing.  Does that sound ok?