Opened 20 years ago

Closed 20 years ago

#496 closed defect (invalid)

ColorObj & Styles verson 3.6 to 4.0

Reported by: tmelhuish@… Owned by: sdlime
Priority: high Milestone:
Component: MapScript Version: 4.1
Severity: normal Keywords:
Cc:

Description

In mapscript 3.6 I was able to change a color of a class object. I see in 4.0 
you are now using styles to set the class colors. I see that the $style->color 
is set to a colorObj not an integer as before with a class. How do you get a 
colorObj that already exists so you can pass it to $style->color? I assume 
this is my problem.

Here is my code in MS 3.6 
+++++++++++++++++++++++++++
        local $lyrstr;
	foreach $lyrstr (@ChgPrtLayerColor) {
		local @name=split />/ , $lyrstr;
		$layer = $map->getLayerByName($name[0]) or &AppletMsg('Unable 
to get PrintColor layer',"error");
		$class= $layer->getClass(0);
		$class->{color}= 8;
	}

#############################################

I tried this in 4.0 with no luck

++++++++++++++++++++++++++++++++++++++
        local $lyrstr;
	foreach $lyrstr (@ChgPrtLayerColor) {
		local @name=split />/ , $lyrstr;
		$layer = $map->getLayerByName($name[0]) or &AppletMsg('Unable 
to get PrintColor layer',"error");
		$class= $layer->getClass(0);
                $style= $class->{styles};  # I get a hash from this
		$style->{color}= 8;  # Bombs here brcause I need a colorObj
                                        not an integer
	}

 ++++++++++++++++++
Thanks,
tom

Change History (1)

comment:1 by sgillies@…, 20 years ago

Resolution: invalid
Status: newclosed
Duplicate of 497, which has been resolved.

Note: See TracTickets for help on using tickets.