Problem with ShapeObj->{classindex}

Tom Melhuish tmelhuish at WEBINSIGHTSINC.COM
Wed Oct 12 16:53:13 EDT 2005


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



More information about the mapserver-users mailing list