1.1 --- a/doc/maps.dox Sun Apr 04 09:16:35 2004 +0000
1.2 +++ b/doc/maps.dox Sun Apr 04 09:17:58 2004 +0000
1.3 @@ -1,10 +1,13 @@
1.4 /*!
1.5
1.6 -\page maps How to write maps
1.7 +\page maps How to write your own maps
1.8
1.9 \section read-maps Readable Maps
1.10
1.11 -It is quite easy to write your own readmap for the edges or nodes of a graph.
1.12 +The readable maps are very frequently used as the input of the
1.13 +algorithms. For this purpose the most straightforward is to use the
1.14 +maps provided by Hugo's graph structres. Very often however, it is more
1.15 +convenient and/or more efficient to write your own readable map.
1.16
1.17 You can find some example below.
1.18
1.19 @@ -14,14 +17,32 @@
1.20 struct MyMap
1.21 {
1.22 typedef double ValueType;
1.23 - double operator[](Graph::EdgeIt e) const { return M_PI;}
1.24 + double operator[](Graph::Edge e) const { return M_PI;}
1.25 };
1.26 \endcode
1.27
1.28 +An alternative way to define maps. For this, \c MapBase seems to
1.29 +be a better name then \c NullMap
1.30 +
1.31 +\code
1.32 +struct MyMap : public MapBase<Edge,double>
1.33 +{
1.34 + double operator[](Graph::Edge e) const { return M_PI;}
1.35 +};
1.36 +\endcode
1.37 +
1.38 +Or if we had \c KeyType and \c ValueType
1.39 +
1.40 +\code
1.41 +struct MyMap : public MapBase<Edge,double>
1.42 +{
1.43 + ValueType operator[](KeyType e) const { return M_PI;}
1.44 +};
1.45 +\endcode
1.46 +
1.47
1.48 Here is a more complex example. It provides a length function which is obtained
1.49 from a base length function modified by a potential difference.
1.50 -\todo Please improve on the english.
1.51
1.52 \code
1.53 class MyLengthMap
1.54 @@ -32,7 +53,7 @@
1.55 public:
1.56 typedef double ValueType;
1.57
1.58 - double operator[](Graph::EdgeIt e) const {
1.59 + double operator[](Graph::Edge e) const {
1.60 return ol.get(e)-pot.get(v)-pot.get(u);
1.61 }
1.62
1.63 @@ -41,5 +62,6 @@
1.64 };
1.65 \endcode
1.66
1.67 +\todo Please improve on the english.
1.68 \todo Don't we need \e to \e require a 'typedef xxx KeyType' tag, as well?
1.69 */