| 1 | = lineObj = |
| 2 | |
| 3 | == Drawing lines with mapscript == |
| 4 | (class definition requires a style - even if blank) (LINE type layer is rendered using COLOR and ignores OUTLINECOLOR) |
| 5 | {{{ |
| 6 | CLASS |
| 7 | STYLE |
| 8 | END |
| 9 | }}} |
| 10 | -------------------------------------------------------------------- |
| 11 | {{{ |
| 12 | #!perl |
| 13 | $layer = $map->getLayerByName('line_layer'); |
| 14 | $layer->{status} = 1; |
| 15 | my $linePoint1 = new mapscript::pointObj(); |
| 16 | $linePoint1->{x} = 272048; $linePoint1->{y} = 199772; |
| 17 | my $linePoint2 = new mapscript::pointObj(); |
| 18 | $linePoint2->{x} = 272450; $linePoint2->{y} = 200074; |
| 19 | my $line = new mapscript::lineObj(); |
| 20 | $line->add($linePoint1); |
| 21 | $line->add($linePoint2); |
| 22 | my $shape = new mapscript::shapeObj($mapscript::MS_SHAPE_LINE); |
| 23 | $shape->add($line); |
| 24 | $shape->{text} = "LINE TEXT"; |
| 25 | $shape->draw($map, $layer, $img); |
| 26 | }}} |
| 27 | ---- |
| 28 | back to PerlMapScript |