This page present a simple program that will show a map of the
topological map of the Mississippi river. The text of the program
can be found inside the MilleFeuille source tree under progs/primer/millefeuille_primer.cpp.
After making the program, and starting the muralserver, just type
millefeuille_primer in the progs/primer
directory to see the map on the screen.
#include <stdlib.h>
#include <iostream.h>
#include <stdio.h>
#include "MilleFeuilleToolkit.H"
#include "Feuilles/Image.H"
main(int argc, char **argv)
{
Mural *m;
utilInit( argc, argv, NULL);
muralInit(argc, argv);
MilleFeuilleToolkit::init(argc,argv);
if ((muralConnect( &m, NULL )) != IWORK_OK)
{
utilSimpleError( "Couldn't connect to the mural server!" );
}
try
{
CollagePtr background = MilleFeuilleToolkit::open_mural(m);
- Create the root window for the hierarchy. open_mural also create a cursor that will track the motion of the mouse.
Image mississippi("/n/radiance/mural/data/images/topomaps/Gorham.jpg");
- Create an image Feuille using a picture of the Mississippi River at Gorham.
mississippi.set_position(0,0);
- Set the initial position of the image at (0,0).
mississippi.set_size(m->width_pixels, m->height_pixels);
- Resize the image to cover the full mural.
background->add_feuille(&mississippi);
- Add the image to the background.
background->post_redisplay();
- Post a redisplay to show the changes on the screen.
getchar();
Wait for the user to finish the program by pressing a key
}
catch (Exception &exception)
{
exception.print_error();
}
catch (...)
{
cerr << "Unknown exception occured." << endl;
}
return (0);
}