[Mapserver-users] set style on the fly with one class

Daniel Lagos dlagos at fdcconsult.com
Wed Apr 28 13:11:29 EDT 2004


This is a multi-part message in MIME format.

------=_NextPart_000_0056_01C42D22.518B2CF0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi list,
    I use ms4.0. and php_mapscript
    I have problem with $style->color->setRGB on-the-fly. I try =
something like this:

$class =3D $layer->getClass(0);
$style =3D $class->getStyle(0);
$style->color->setRGB(0, 0, 255);
$style->set ( 'symbol', $sym1 );
$pt->setXY( 2100000, 10100000 );
$pt->draw($map, $layer, $image, 0, "Pt1");

draw blue point ok.


$style =3D $class->getStyle(0);
$style->color->setRGB(0, 255,0); //draw a green point
$style->set ( 'symbol', $sym1 );
$pt->setXY( 2100000, 10100000 );
$pt->draw($map, $layer, $image, 0, "Pt1");

draw green point ok.


$style =3D $class->getStyle(0);
$style->color->setRGB(0, 0,255);=20
$style->set ( 'symbol', $sym1 );
$pt->setXY( 2100000, 10100000 );
$pt->draw($map, $layer, $image, 0, "Pt1");

FAILED, problem draw green point.



I read the discussion above "can I use different symbols in =
thesamedynamiclayer?" betwen September and October 2003 but not found =
the solution at problem.=20

I try create two styles in one class and try move the styles with:

$style->movestyleup()=20
$style->movestyledown().
 =20
LAYER
    NAME lpt
    TYPE POINT
    SYMBOLSCALE 20000
    STATUS OFF
    TEMPLATE void
    CLASS
        NAME 'ExcVel_0'=20
        SYMBOL 'ExcVel_0'=20
        STYLE
            OUTLINECOLOR 0 0 0
            COLOR 255 0 0
            SIZE 15
            MINSIZE 8
            MAXSIZE 20
        END
       =20
        STYLE
            OUTLINECOLOR 0 0 0
            COLOR 0 255 0
            SIZE 15
            MINSIZE 8
            MAXSIZE 20
        END
END

but the functions not found how say the documentation.=20

The problem is: $pt->draw($map, $layer, $image, 0, "Pt1")  with style 1 =
because default is style 0.=20

Somebody know how solved?...I need help.=20

PD: Sorry by my english.

Daniel Lagos.






    
------=_NextPart_000_0056_01C42D22.518B2CF0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi list,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; I use ms4.0. and=20
php_mapscript</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; I have&nbsp;problem=20
with</FONT><FONT face=3DArial size=3D2>&nbsp;$style-&gt;color-&gt;setRGB =
on-the-fly.=20
I try something like this:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial>$class =3D $layer-&gt;getClass(0);<BR>$style =3D =

$class-&gt;getStyle(0);<BR>$style-&gt;color-&gt;setRGB(0, 0, =
255);</FONT></DIV>
<DIV><FONT face=3DArial>$style-&gt;set ( 'symbol', $sym1 =
);<BR>$pt-&gt;setXY(=20
2100000, 10100000 );<BR>$pt-&gt;draw($map, $layer, $image, 0,=20
"Pt1");</FONT></DIV>
<DIV><FONT face=3DArial></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial>draw blue point ok.</DIV>
<DIV><FONT size=3D2></FONT><BR></DIV></FONT>
<DIV><FONT face=3DArial>$style =3D=20
$class-&gt;getStyle(0);<BR>$style-&gt;color-&gt;setRGB(0, 255,0); //draw =

a&nbsp;green point<BR>$style-&gt;set ( 'symbol', $sym1 =
);<BR>$pt-&gt;setXY(=20
2100000, 10100000 );<BR>$pt-&gt;draw($map, $layer, $image, 0,=20
"Pt1");</FONT></DIV>
<DIV><FONT face=3DArial></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial>draw green point ok.</FONT></DIV>
<DIV><FONT face=3DArial></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial>$style =3D=20
$class-&gt;getStyle(0);<BR>$style-&gt;color-&gt;setRGB(0, 0,255); =
</FONT></DIV>
<DIV><FONT face=3DArial>$style-&gt;set ( 'symbol', $sym1 =
);<BR>$pt-&gt;setXY(=20
2100000, 10100000 );<BR>$pt-&gt;draw($map, $layer, $image, 0,=20
"Pt1");</FONT></DIV>
<DIV><FONT face=3DArial></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial><FONT color=3D#ff0000>FAILED, problem <FONT =
face=3DArial>draw=20
green point.</FONT></FONT></DIV>
<DIV><FONT size=3D2></FONT><FONT size=3D2></FONT><BR></DIV>
<DIV></FONT><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I read the discussion above "<FONT=20
face=3D"Times New Roman" size=3D3><STRONG>can I use different symbols in =

thesamedynamiclayer?"</STRONG> betwen September and October 2003 but not =
found=20
the solution at problem. </FONT></FONT></DIV>
<DIV><FONT face=3DArial size=3D2><FONT face=3DArial =
size=3D2></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2><FONT face=3D"Times New Roman" =
size=3D3>I&nbsp;try=20
create two styles&nbsp;in one class and try move the styles=20
with:</FONT></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>$style-&gt;movestyleup() </FONT>
<DIV><FONT face=3DArial =
size=3D2>$style-&gt;movestyledown().</FONT></DIV></DIV>
<DIV><FONT face=3DArial size=3D1>&nbsp;</FONT>=20
<DIV><FONT size=3D2>LAYER</FONT></DIV>
<DIV><FONT size=3D2>&nbsp;&nbsp;&nbsp; NAME lpt</FONT></DIV>
<DIV><FONT size=3D2>&nbsp;&nbsp;&nbsp; TYPE POINT</FONT></DIV>
<DIV><FONT size=3D2>&nbsp;&nbsp;&nbsp; SYMBOLSCALE 20000</FONT></DIV>
<DIV><FONT size=3D2>&nbsp;&nbsp;&nbsp; STATUS OFF</FONT></DIV>
<DIV><FONT size=3D2>&nbsp;&nbsp;&nbsp; TEMPLATE void</FONT></DIV>
<DIV><FONT size=3D2>&nbsp;&nbsp;&nbsp; CLASS</FONT></DIV>
<DIV><FONT size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; NAME=20
'ExcVel_0'&nbsp;</FONT></DIV>
<DIV><FONT size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; SYMBOL =
'ExcVel_0'=20
</FONT></DIV>
<DIV><FONT size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
STYLE</FONT></DIV>
<DIV><FONT size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
OUTLINECOLOR 0 0 0</FONT></DIV>
<DIV><FONT size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp; COLOR=20
255&nbsp;0 0</FONT></DIV>
<DIV><FONT size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp; SIZE=20
15</FONT></DIV>
<DIV><FONT size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
MINSIZE 8</FONT></DIV>
<DIV><FONT size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
MAXSIZE 20</FONT></DIV>
<DIV><FONT size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
END</FONT></DIV>
<DIV><FONT size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
</FONT></DIV>
<DIV><FONT size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
STYLE</FONT></DIV>
<DIV><FONT size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
OUTLINECOLOR 0 0 0</FONT></DIV>
<DIV><FONT size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp; COLOR=20
0 255 0</FONT></DIV>
<DIV><FONT size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp; SIZE=20
15</FONT></DIV>
<DIV><FONT size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
MINSIZE 8</FONT></DIV>
<DIV><FONT size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
MAXSIZE 20</FONT></DIV>
<DIV><FONT size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
END</FONT></DIV>
<DIV><FONT size=3D2>END</FONT><FONT face=3DArial =
size=3D2></DIV></DIV><FONT size=3D1>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV></FONT>
<DIV>but the functions not found how say the documentation. </DIV>
<DIV>&nbsp;</DIV>
<DIV>The problem is: $pt-&gt;draw($map, $layer, $image, 0, "Pt1") =
&nbsp;with=20
style 1 because default is style 0.&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>Somebody know how solved?...I need help. </DIV>
<DIV>&nbsp;</DIV>
<DIV>PD: Sorry by my english.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Daniel Lagos.</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV></FONT>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; =
</FONT></DIV></BODY></HTML>

------=_NextPart_000_0056_01C42D22.518B2CF0--




More information about the mapserver-users mailing list