| 1 | = shapeObj = |
| 2 | |
| 3 | == drawing lines with mapscript == |
| 4 | |
| 5 | ...class definition in the map file needed a style section (even if it is empty)... |
| 6 | {{{ |
| 7 | #!perl |
| 8 | $layer = $map->getLayerByName('line_layer'); |
| 9 | $layer->{status} = 1; |
| 10 | my $linePoint1 = new mapscript::pointObj(); |
| 11 | $linePoint1->{x} = 272048; $linePoint1->{y} = 199772; |
| 12 | my $linePoint2 = new mapscript::pointObj(); |
| 13 | $linePoint2->{x} = 272450; $linePoint2->{y} = 200074; |
| 14 | my $line = new mapscript::lineObj(); |
| 15 | $line->add($linePoint1); |
| 16 | $line->add($linePoint2); |
| 17 | my $shape = new mapscript::shapeObj($mapscript::MS_SHAPE_LINE); |
| 18 | $shape->add($line); |
| 19 | $shape->{text} = "LINE TEXT"; |
| 20 | $shape->draw($map, $layer, $img); |
| 21 | }}} |
| 22 | ---------------------------------- |
| 23 | {{{ |
| 24 | LAYER |
| 25 | NAME "line_layer" |
| 26 | STATUS ON |
| 27 | PROJECTION |
| 28 | "init=epsg:26958" |
| 29 | END |
| 30 | TYPE LINE |
| 31 | CLASS |
| 32 | STYLE |
| 33 | END |
| 34 | LABEL |
| 35 | ANGLE AUTO |
| 36 | FONT arial |
| 37 | TYPE TRUETYPE |
| 38 | POSITION UC |
| 39 | SIZE 7 |
| 40 | COLOR 0 0 0 |
| 41 | END |
| 42 | COLOR 0 0 0 |
| 43 | SIZE 10 |
| 44 | END |
| 45 | END |
| 46 | }}} |
| 47 | ---- |
| 48 | back to PerlMapScript |