/home/andreas/src/svn/mapnik/include/mapnik/vertex_transform.hpp

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * 
00003  * This file is part of Mapnik (c++ mapping toolkit)
00004  *
00005  * Copyright (C) 2006 Artem Pavlenko
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; either
00010  * version 2.1 of the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00020  *
00021  *****************************************************************************/
00022 //$Id: vertex_transform.hpp 39 2005-04-10 20:39:53Z pavlenko $
00023 
00024 #ifndef VERTEX_TRANSFORM_HPP
00025 #define VERTEX_TRANSFORM_HPP
00026 
00027 // mapnik
00028 #include <mapnik/envelope.hpp>
00029 #include <mapnik/vertex.hpp>
00030 
00031 namespace mapnik
00032 {
00033     template <typename T0 ,typename T1,int shift=8>
00034     struct Shift
00035     {
00036         typedef T0 value_type;
00037         typedef T1 return_type;
00038         static return_type apply(value_type val)
00039         {
00040             return static_cast<return_type>(val*(1<<shift));
00041         }
00042     };
00043 
00044     template <typename T0,typename T1>
00045     struct Shift<T0,T1,0> 
00046     {
00047         typedef T0 value_type;
00048         typedef T1 return_type;
00049         static return_type apply(value_type val)
00050         {
00051             return static_cast<return_type>(val);
00052         }
00053     };
00054 
00055     template <typename T>
00056     struct Shift<T,T,0>
00057     {
00058         typedef T value_type;
00059         typedef T return_type;
00060         static T& apply(T& val)
00061         {
00062             return val;
00063         }
00064     };
00065 
00066     typedef Shift<double,double,0> NO_SHIFT;
00067     typedef Shift<double,int,0> SHIFT0;
00068     typedef Shift<double,int,8> SHIFT8;
00069     
00070     
00071     template <typename T0,typename T1,typename Trans>
00072     struct view_transform;
00073     
00074     template <typename Trans>
00075     struct view_transform <vertex2d,vertex2d,Trans>   
00076     {
00077         
00078     };
00079     
00080     template <typename Trans>
00081     struct view_transform <vertex2d,vertex2i,Trans>   
00082     {
00083         
00084     };
00085 
00086     template <typename Trans>
00087     struct view_transform<Envelope<double>,Envelope<double>,Trans>
00088     {
00089         
00090     };
00091 }
00092 
00093 #endif //VERTEX_TRANSFORM_HPP

Generated on Thu Jul 19 17:59:27 2007 for Mapnik by  doxygen 1.4.7