[Mapserver-users] set style on the fly with one class
Daniel Lagos
dlagos at fdcconsult.com
Wed Apr 28 10:11:29 PDT 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> I use ms4.0. and=20
php_mapscript</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> I have problem=20
with</FONT><FONT face=3DArial size=3D2> $style->color->setRGB =
on-the-fly.=20
I try something like this:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial>$class =3D $layer->getClass(0);<BR>$style =3D =
$class->getStyle(0);<BR>$style->color->setRGB(0, 0, =
255);</FONT></DIV>
<DIV><FONT face=3DArial>$style->set ( 'symbol', $sym1 =
);<BR>$pt->setXY(=20
2100000, 10100000 );<BR>$pt->draw($map, $layer, $image, 0,=20
"Pt1");</FONT></DIV>
<DIV><FONT face=3DArial></FONT> </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->getStyle(0);<BR>$style->color->setRGB(0, 255,0); //draw =
a green point<BR>$style->set ( 'symbol', $sym1 =
);<BR>$pt->setXY(=20
2100000, 10100000 );<BR>$pt->draw($map, $layer, $image, 0,=20
"Pt1");</FONT></DIV>
<DIV><FONT face=3DArial></FONT> </DIV>
<DIV><FONT face=3DArial>draw green point ok.</FONT></DIV>
<DIV><FONT face=3DArial></FONT> </DIV>
<DIV><FONT face=3DArial></FONT> </DIV>
<DIV><FONT face=3DArial>$style =3D=20
$class->getStyle(0);<BR>$style->color->setRGB(0, 0,255); =
</FONT></DIV>
<DIV><FONT face=3DArial>$style->set ( 'symbol', $sym1 =
);<BR>$pt->setXY(=20
2100000, 10100000 );<BR>$pt->draw($map, $layer, $image, 0,=20
"Pt1");</FONT></DIV>
<DIV><FONT face=3DArial></FONT> </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> </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> </DIV>
<DIV><FONT face=3DArial size=3D2><FONT face=3D"Times New Roman" =
size=3D3>I try=20
create two styles in one class and try move the styles=20
with:</FONT></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>$style->movestyleup() </FONT>
<DIV><FONT face=3DArial =
size=3D2>$style->movestyledown().</FONT></DIV></DIV>
<DIV><FONT face=3DArial size=3D1> </FONT>=20
<DIV><FONT size=3D2>LAYER</FONT></DIV>
<DIV><FONT size=3D2> NAME lpt</FONT></DIV>
<DIV><FONT size=3D2> TYPE POINT</FONT></DIV>
<DIV><FONT size=3D2> SYMBOLSCALE 20000</FONT></DIV>
<DIV><FONT size=3D2> STATUS OFF</FONT></DIV>
<DIV><FONT size=3D2> TEMPLATE void</FONT></DIV>
<DIV><FONT size=3D2> CLASS</FONT></DIV>
<DIV><FONT size=3D2> NAME=20
'ExcVel_0' </FONT></DIV>
<DIV><FONT size=3D2> SYMBOL =
'ExcVel_0'=20
</FONT></DIV>
<DIV><FONT size=3D2> =
STYLE</FONT></DIV>
<DIV><FONT size=3D2> =
=20
OUTLINECOLOR 0 0 0</FONT></DIV>
<DIV><FONT size=3D2> =
COLOR=20
255 0 0</FONT></DIV>
<DIV><FONT size=3D2> =
SIZE=20
15</FONT></DIV>
<DIV><FONT size=3D2> =
=20
MINSIZE 8</FONT></DIV>
<DIV><FONT size=3D2> =
=20
MAXSIZE 20</FONT></DIV>
<DIV><FONT size=3D2> =
END</FONT></DIV>
<DIV><FONT size=3D2> =
</FONT></DIV>
<DIV><FONT size=3D2> =
STYLE</FONT></DIV>
<DIV><FONT size=3D2> =
=20
OUTLINECOLOR 0 0 0</FONT></DIV>
<DIV><FONT size=3D2> =
COLOR=20
0 255 0</FONT></DIV>
<DIV><FONT size=3D2> =
SIZE=20
15</FONT></DIV>
<DIV><FONT size=3D2> =
=20
MINSIZE 8</FONT></DIV>
<DIV><FONT size=3D2> =
=20
MAXSIZE 20</FONT></DIV>
<DIV><FONT size=3D2> =
END</FONT></DIV>
<DIV><FONT size=3D2>END</FONT><FONT face=3DArial =
size=3D2></DIV></DIV><FONT size=3D1>
<DIV><FONT size=3D2></FONT> </DIV></FONT>
<DIV>but the functions not found how say the documentation. </DIV>
<DIV> </DIV>
<DIV>The problem is: $pt->draw($map, $layer, $image, 0, "Pt1") =
with=20
style 1 because default is style 0. </DIV>
<DIV> </DIV>
<DIV>Somebody know how solved?...I need help. </DIV>
<DIV> </DIV>
<DIV>PD: Sorry by my english.</DIV>
<DIV> </DIV>
<DIV>Daniel Lagos.</DIV>
<DIV> </DIV>
<DIV> </DIV></FONT>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> =
</FONT></DIV></BODY></HTML>
------=_NextPart_000_0056_01C42D22.518B2CF0--
More information about the MapServer-users
mailing list