CLASS and php/mapscript

Luca Casagrande luca.casagrande at GMAIL.COM
Mon Oct 30 04:10:47 PST 2006


Hi Pietro and thx for your answer!
This is the code i use for creating the new class:

        $class = ms_newClassObj($layer);
	$class->setExpression("'[pixel]' EQ '1'");
        $style = ms_newStyleObj($class);
        $style=$class->getStyle(0);
        $style->color->setRGB( -1,-1,-1);

And this is the debug mapfile: 

CLASS
      EXPRESSION "'[pixel]' EQ '1'"
      METADATA
      END
      STYLE
        ANGLE 360
        SYMBOL 0
      END
    END

What i am doing wrong?

Thanks
Luca

On Mon, 30 Oct 2006 12:53:42 +0100
Pietro Giannini <pgiannini at BYTEWISE.IT> wrote:

> Luca,
> I had a similar problem.
> 
> Try:
> 
>    ....
>    $style=$class->getStyle(0);
>    $style->color->setRGB( -1,-1,-1);
> 
> In other words you must get the reference of the existing Style from the
> Class.
> I made so, and works... - I don't know because :) -
> 
> ciao
> 
> ___________________________
>       Pietro Giannini
>   Bytewise srl - Area GIS
> 41°50'38.58"N 12°29'13.39"E
> 
> 
> 
> 
> On Lun, 30 Ottobre 2006 12:03, Luca Casagrande disse:
> > Hi to all!
> > I am trying to create a new layer using php/mapscript; the problem is for
> > the class section:
> > this is the mapfile sample i'd like to crete:
> >
> > CLASS
> >     EXPRESSION "1"
> >     STYLE
> >       COLOR -1 -1 -1
> >     END
> >    END
> >
> > And this is the mapscript i have written:
> >
> >         $class = ms_newClassObj($layer);
> > 	$class->setExpression("'[pixel]' EQ '1'");
> >
> > 	$style = ms_newStyleObj($class);
> >         $style->color->setRGB( -1,-1,-1);
> >
> > Debugging the mapfile, the CLASS it's been created, but not the style of
> > the class.
> >
> > Thanks very much
> > Luca
> > --
> > Help QGIS development! Make a donation right now at
> > http://xrl.us/supportqgis
> >
> > LINUX User #411601
> > GENTOO-GIS Development Team
> > jabber: casagrande at jabber.linux.it
> >
> >
> >


-- 
Help QGIS development! Make a donation right now at http://xrl.us/supportqgis

LINUX User #411601
GENTOO-GIS Development Team
jabber: casagrande at jabber.linux.it

 



More information about the MapServer-users mailing list