Problem with ShapeObj->{classindex}

Sean Gillies sgillies at FRII.COM
Tue Oct 18 12:19:28 EDT 2005


Tom,

There is a recent bug in the tracker which may be relevant:

   http://mapserver.gis.umn.edu/bugs/show_bug.cgi?id=1494

Although it doesn't appear in the comments, I seem to recall that this 
may have been related to legend rendering.

cheers,
Sean

On Oct 18, 2005, at 9:48 AM, Tom Melhuish wrote:

> I have been watching the list and have not seen any response to my 
> problen
> yet. I have used the $class->insertStyle(style, index) method to 
> define and
> retrieve an index for the styleObj but don't see anything comparable 
> for the
> ClassObj when looking in the mapscript.pm file. I am successful in 
> defining
> my classes and see them appear in the Legend. I tried using class index
> 1,2,3..5 to set the ShapeObj->{classindex}, but it always used the 
> first
> classObj defined for all of the shapeObjs I create.
>
> Can someone please help. I hate to have to create a separate layer for 
> each
> feature I need to define.
> Please let me know if I need to provide more information to define my
> problem.
> Thanks again.
>
> -----Original Message-----
> From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU]On
> Behalf Of Tom Melhuish
> Sent: Wednesday, October 12, 2005 4:53 PM
> To: MAPSERVER-USERS at LISTS.UMN.EDU
> Subject: Re: [UMN_MAPSERVER-USERS] Problem with ShapeObj->{classindex}
>
>
> To add to my issue, I was able to generate a Legend with the classes I
> defined. The colors in the Legend where displayed as expected. It 
> looks like
> the ShapeObj->{classindex} has no effect an the shapeObjs defined and
> defaults to the first classObj defined. I'm running:
> 	mapserver 4.2.2
> 	Redhat 9.0
> 	httpd-2.0.53
>
> Thanks in advance for your help.
>
> -----Original Message-----
> From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU]On
> Behalf Of Tom Melhuish
> Sent: Tuesday, October 11, 2005 3:14 PM
> To: MAPSERVER-USERS at LISTS.UMN.EDU
> Subject: [UMN_MAPSERVER-USERS] Problem with ShapeObj->{classindex}
>
>
> I'm creating a feature and need to change the colors for each one that 
> is
> generated. I'm able to create the shapeObjs and associated text, but 
> the
> classObj is always set to index=0. If I query the $layer->{numclasses} 
> I get
> 2.
>
> for (0..1) {
>     my $point = new mapscript::pointObj() or &AppletMsg('Unable to 
> create
> point',"error");
>     my $line = new mapscript::lineObj() or &AppletMsg('Unable to create
> line',"error");
>     my $shape = new mapscript::shapeObj($mapscript::MS_SHAPE_POINT);
>     $point->{x} = $QueryResultsmatrix[$_+100]->[1] or 
> &AppletMsg('Unable to
> add x value to point',"error");
>     $point->{y} = $QueryResultsmatrix[$_+100]->[2] or 
> &AppletMsg('Unable to
> add y value to point',"error");
>     $retval=$line->add($point);
>     $retval=$shape->add($line);
>     $shape->{classindex} = $_;  #### Always set to 0 no matter what I 
> enter.
>     $shape->{text} =Test.$_;
>     $retval=$layer->addFeature($shape);
> }
>
> Layer Information
> -------------------
> LAYER
>     NAME "GpsfeatPt"
>     STATUS OFF
>     TYPE POINT
>     TEMPLATE "ttt.html"
>     CLASS
>       #COLOR 128 255 164
>       SYMBOL "cross"
>       COLOR 254 0 0
>       SIZE 7
>       LABEL
>         SIZE small
>         POSITION UC
>         COLOR 254 0 0
>       END
>     END
>     CLASS
>       #COLOR 128 255 164
>       SYMBOL "cross"
>       COLOR 254 0 200
>       SIZE 7
>       LABEL
>         SIZE small
>         POSITION UC
>         COLOR 254 0 200
>       END
>     END
> END
>
>
--
Sean Gillies
sgillies at frii dot com
http://zcologia.com



More information about the mapserver-users mailing list