prepareImage() || draw()
Aaron Craig
mercutio at POBOX.COM
Fri Jan 21 07:27:58 PST 2005
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I'm confused about how we're supposed to draw the final map image
through mapscript.
I want to get a mapfile loaded, add a layer with some lines on it
connecting some dots already present in another layer. In pseudo code,
I'm doing more or less:
mapObj = mapscript::mapObj->new("mapfile.map");
imgObj = mapObj->prepareImage();
pntA = mapscript::pointObj->new();
pntA->setXY(X, Y);
pntA->draw(map, lyrObj, imgObj, null, "");
pntB = mapscript::pointObj->new();
pntB->setXY(X, Y);
pntB->draw(map, lyrObj, imgObj, null, "");
linObj = mapscript::lineObj->new();
linObj->add(pntA);
linObj->add(pntB);
shpObj = mapscript::shapeObj->new(MS_SHAPE_LINE);
shpObj->add(linObj);
shpObj->{index} = 0; # is this necessary?
lyrObj = mapscript::layerObj->new(mapObj);
mapObj->insertLayer(lyrObj);
lyrObj->{status} = MS_ON;
lyrObj->addFeature(shpObj);
lyrObj->draw(mapObj, imgObj);
imgObj->save("file.png");
Which results in an empty image.
If instead of calling prepareImage() I call draw(), then I get the map
drawn as described in the mapfile, without my new layer.
Help?
- --
Aaron Craig
mercutio at pobox.com
===========================================================
Get Firefox!
http://www.spreadfirefox.com/?q=affiliates&id=0&t=1
===========================================================
- -=-=-
The miserable have no other medicine but only hope. -- Measure for Measure
- -=-=-
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFB8R99oyEQRcU83p4RAsweAKCNMxdzbtwu063kDOiBOdXzkSPSfACglD0N
A+GUoMbJSvuwStyo9BwXn8w=
=AJq4
-----END PGP SIGNATURE-----
More information about the MapServer-users
mailing list