Hi, just to let you know, I just started with client side image maps (the dw-part). Below is an initial implementation of ImageMapsList. This is not yet ready at all, but perhaps someone might want have a look. Cheers, Johannes diff -r 877bbc03146b -r ebc6de688732 dw/image.cc --- a/dw/image.cc Thu Apr 17 22:14:42 2008 +0200 +++ b/dw/image.cc Mon Apr 21 21:03:51 2008 +0200 @@ -25,12 +25,44 @@ namespace dw { +ImageMapsList::ImageMap::ImageMap () +{ + shapesAndLinks = new container::typed::List <ShapeAndLink> (true); +} + +void ImageMapsList::ImageMap::add (core::Shape *shape, int link) { + ShapeAndLink *shapeAndLink = new ShapeAndLink (); + shapeAndLink->shape = shape; + shapeAndLink->link = link; + shapesAndLinks->append (shapeAndLink); +} + +int ImageMapsList::ImageMap::link (int x, int y) { + container::typed::Iterator <ShapeAndLink> it; + int link = -1; + + for (it = shapesAndLinks->iterator (); it.hasNext (); ) { + ShapeAndLink *shapeAndLink = it.getNext (); + + if (shapeAndLink->shape->isPointWithin (x, y)) { + link = shapeAndLink->link; + break; + } + } + + return link; +} + ImageMapsList::ImageMapsList () { + imageMaps = new container::typed::HashTable <object::Object, ImageMap> + (true, true); + currentMap = NULL; } ImageMapsList::~ImageMapsList () { + delete imageMaps; } /** @@ -42,6 +74,8 @@ ImageMapsList::~ImageMapsList () */ void ImageMapsList::startNewMap (object::Object *key) { + currentMap = new ImageMap (); + imageMaps->put (key, currentMap); } /** @@ -52,6 +86,7 @@ void ImageMapsList::startNewMap (object: */ void ImageMapsList::addShapeToCurrentMap (core::Shape *shape, int link) { + currentMap->add (shape, link); } // ---------------------------------------------------------------------- diff -r 877bbc03146b -r ebc6de688732 dw/image.hh --- a/dw/image.hh Thu Apr 17 22:14:42 2008 +0200 +++ b/dw/image.hh Mon Apr 21 21:03:51 2008 +0200 @@ -22,6 +22,27 @@ namespace dw { */ class ImageMapsList { +private: + class ImageMap: public object::Object { + private: + class ShapeAndLink: public object::Object { + public: + core::Shape *shape; + int link; + }; + + container::typed::List <ShapeAndLink> *shapesAndLinks; + public: + ImageMap (); + ~ImageMap (); + + void add (core::Shape *shape, int link); + int link (int x, int y); + }; + + container::typed::HashTable <object::Object, ImageMap> *imageMaps; + ImageMap *currentMap; + public: ImageMapsList (); ~ImageMapsList ();