Mercator
|
00001 // This file may be redistributed and modified only under the terms of 00002 // the GNU General Public License (See COPYING for details). 00003 // Copyright (C) 2003 Damien McGinnes, Alistair Riddoch 00004 00005 #ifndef MERCATOR_TERRAIN_MOD_IMPL_H 00006 #define MERCATOR_TERRAIN_MOD_IMPL_H 00007 00008 #include <Mercator/TerrainMod.h> 00009 00010 namespace Mercator { 00011 00012 template <typename Shape> ShapeTerrainMod<Shape>::~ShapeTerrainMod() 00013 { 00014 } 00015 00016 template <typename Shape> 00017 WFMath::AxisBox<2> ShapeTerrainMod<Shape>::bbox() const 00018 { 00019 return m_shape.boundingBox(); 00020 } 00021 00022 00023 template <typename Shape> LevelTerrainMod<Shape>::~LevelTerrainMod() 00024 { 00025 } 00026 00027 template <typename Shape> 00028 void LevelTerrainMod<Shape>::apply(float &point, int x, int y) const 00029 { 00030 if (Contains(this->m_shape,WFMath::Point<2>(x,y),true)) { 00031 point = m_level; 00032 } 00033 } 00034 00035 template <typename Shape> 00036 TerrainMod * LevelTerrainMod<Shape>::clone() const 00037 { 00038 return new LevelTerrainMod<Shape>(m_level, this->m_shape); 00039 } 00040 00041 template <typename Shape> AdjustTerrainMod<Shape>::~AdjustTerrainMod() 00042 { 00043 } 00044 00045 template <typename Shape> 00046 void AdjustTerrainMod<Shape>::apply(float &point, int x, int y) const 00047 { 00048 if (Contains(this->m_shape,WFMath::Point<2>(x,y),true)) { 00049 point += m_dist; 00050 } 00051 } 00052 00053 template <typename Shape> 00054 TerrainMod * AdjustTerrainMod<Shape>::clone() const 00055 { 00056 return new AdjustTerrainMod<Shape>(m_dist, this->m_shape); 00057 } 00058 00059 template <typename Shape> SlopeTerrainMod<Shape>::~SlopeTerrainMod() 00060 { 00061 } 00062 00063 template <typename Shape> 00064 void SlopeTerrainMod<Shape>::apply(float &point, int x, int y) const 00065 { 00066 if (Contains(this->m_shape,WFMath::Point<2>(x,y),true)) { 00067 point = m_level + (this->m_shape.getCenter()[0] - x) * m_dx 00068 + (this->m_shape.getCenter()[1] - y) * m_dy; 00069 } 00070 } 00071 00072 template <typename Shape> 00073 TerrainMod * SlopeTerrainMod<Shape>::clone() const 00074 { 00075 return new SlopeTerrainMod<Shape>(m_level, m_dx, m_dy, this->m_shape); 00076 } 00077 00078 } //namespace Mercator 00079 00080 #endif // MERCATOR_TERRAIN_MOD_IMPL_H