1 /** 2 * SFCGAL 3 * 4 * Copyright (C) 2012-2013 Oslandia <infos@oslandia.com> 5 * Copyright (C) 2012-2013 IGN (http://www.ign.fr) 6 * 7 * This library is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU Library General Public 9 * License as published by the Free Software Foundation; either 10 * version 2 of the License, or (at your option) any later version. 11 * 12 * This library is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * Library General Public License for more details. 16 17 * You should have received a copy of the GNU Library General Public 18 * License along with this library; if not, see <http://www.gnu.org/licenses/>. 19 */ 20 21 #include <SFCGAL/detail/transform/ForceZ.h> 22 #include <SFCGAL/Point.h> 23 24 25 namespace SFCGAL { 26 namespace transform { 27 28 /// 29 /// 30 /// ForceZ(const Kernel::FT & defaultZ)31ForceZ::ForceZ( const Kernel::FT& defaultZ ): 32 _defaultZ( defaultZ ) 33 { 34 35 } 36 37 /// 38 /// 39 /// transform(Point & p)40void ForceZ::transform( Point& p ) 41 { 42 if ( ! p.isEmpty() && ! p.is3D() ) { 43 Point pt( p.x(), p.y(), _defaultZ ); 44 if ( p.isMeasured() ) 45 pt.setM( p.m() ); 46 p = pt; 47 } 48 } 49 50 51 }//transform 52 }//SFCGAL 53 54 55 56