Problem with ShapeObj->{classindex}
Tom Melhuish
tmelhuish at WEBINSIGHTSINC.COM
Tue Oct 11 12:14:00 PDT 2005
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