Ticket #609 (closed defect: wontfix)
Creating classObj doesn't automatically set 'numstyles' to 1
| Reported by: | jwwilhit@… | Owned by: | sgillies@… |
|---|---|---|---|
| Priority: | high | Milestone: | |
| Component: | MapScript-SWIG | Version: | 4.0 |
| Severity: | normal | Keywords: | |
| Cc: | sgillies@… |
Description
When I create a classObj the default value of the attribute 'numstyles' is 0.
Since I can assign values to the 'styles' attribute of the classObj all day
long it would seem to me that a styleObj is being created automatically when a
classObj gets created. This would lead me to believe the default value for
the 'numstyles' attribute of the classObj should be 1 instead of 0.
If you don't explicitly set the 'numstyles' attribute to 1 then any of the
values you assign to the 'styles' attribute won't be rendered. It will let you
set them but they won't get drawn.
I'm including the email track and code snippet below:
-------------- Code -------------------
my $tclass = new mapscript::classObj( $warnLayer );
print "numstyles = $tclass->{numstyles}\n";
$tclass->{numstyles} = 1; ######## This has to be set in order for the stuff
below to work
$tclass->{name} = "Dynamic Class";
$tclass->{status} = $mapscript::MS_ON;
$tclass->{styles}->{symbol} = 1;
$tclass->{styles}->{outlinecolor}->{red} = 250;
$tclass->{styles}->{outlinecolor}->{green} = 0;
$tclass->{styles}->{outlinecolor}->{blue} = 0;
$tclass->{styles}->{color}->{red} = 0;
$tclass->{styles}->{color}->{green} = 250;
$tclass->{styles}->{color}->{blue} = 0;
----------- Email Track ------------------
> That was it! Thank you very much. Although...It would seem to me
> that that attribute should be set to 1 by default when a class gets created.
> Apparently a styleObj gets created when you create the class because I
> was able to set the styleObj attributes all day long but the numstyles
> attribute remains 0.
>
> Talk about a stealth requirement.
>
> Thanks again.
>
> -Jason
>
> -----Original Message-----
> From: mapserver-users-admin@lists.gis.umn.edu
> [mailto:mapserver-users-admin@lists.gis.umn.edu] On Behalf Of John
> Beisley - RSG
> Sent: Wednesday, March 31, 2004 1:42 AM
> To: mapserver-users@lists.gis.umn.edu
> Subject: Re: [Mapserver-users] Adding Dynamic layers in Mapscript
> 4.0.1 Perl
>
> WILHITE JASON W wrote:
>
>> <>The static members of the map file are showing up just fine but not
>> the dynamic layer. I have a feeling it might be a problem with the
>> color assignments but for the life of me I can't figure it out.
>>
>> Does anyone have any ideas?
>>
>> Thank you,
>>
>> -Jason
>>
> I think I ran into a similar problem myself. Although I don't recall
> the
>
> solution, I do remember finding that calling save() on the map object
> to
>
> save the generated map file to disk was a very useful debugging
> solution.
>
> However my own code for setting the style on a line layer that I have
> does something similar to the following: (where $layer is a layerObj)
>
> my $layerClass = new mapscript::classObj($layer);
>
> # ... Set the values inside $layerClass ...
>
> $layerClass->{numstyles} = 1;
>
>
> - John
>
Change History
Note: See
TracTickets for help on using
tickets.
