00001 /* 00002 * Copyright (C) 2003-2009 Olivier Boudeville 00003 * 00004 * This file is part of the Ceylan library. 00005 * 00006 * The Ceylan library is free software: you can redistribute it and/or modify 00007 * it under the terms of either the GNU Lesser General Public License or 00008 * the GNU General Public License, as they are published by the Free Software 00009 * Foundation, either version 3 of these Licenses, or (at your option) 00010 * any later version. 00011 * 00012 * The Ceylan 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 00015 * GNU Lesser General Public License and the GNU General Public License 00016 * for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public 00019 * License and the GNU General Public License along with the Ceylan library. 00020 * If not, see <http://www.gnu.org/licenses/>. 00021 * 00022 * Author: Olivier Boudeville (olivier.boudeville@esperide.com) 00023 * 00024 */ 00025 00026 00027 #ifndef CEYLAN_LOCATABLE_2D_H_ 00028 #define CEYLAN_LOCATABLE_2D_H_ 00029 00030 00031 #include "CeylanBipoint.h" // for Bipoint 00032 #include "CeylanHomogeneousMatrix3.h" // for HomogeneousMatrix3 00033 #include "CeylanLocatable.h" // for inheritance 00034 00035 #include <string> 00036 00037 00038 00039 namespace Ceylan 00040 { 00041 00042 00043 00056 class CEYLAN_DLL Locatable2D : public Locatable 00057 { 00058 00059 00060 public: 00061 00062 00077 explicit Locatable2D( Locatable2D & fatherLocatable ) ; 00078 00079 00080 00085 Locatable2D() ; 00086 00087 00088 00113 Locatable2D( Locatable2D & fatherLocatable, 00114 Maths::Linear::Matrix & localReferential ) ; 00115 00116 00117 00129 explicit Locatable2D( Maths::Linear::Matrix & localReferential ) ; 00130 00131 00132 00134 virtual ~Locatable2D() throw() ; 00135 00136 00137 00147 virtual Maths::Linear::Matrix & getLocalReferential() const ; 00148 00149 00150 00158 virtual void blankLocalReferential() ; 00159 00160 00161 00173 virtual Ceylan::Maths::Linear::Bipoint getCenter() const ; 00174 00175 00176 00188 virtual void setCenter( 00189 const Ceylan::Maths::Linear::Bipoint & newCenter ) ; 00190 00191 00192 00205 virtual void setCenter( 00206 Ceylan::Maths::Real newX = 0, 00207 Ceylan::Maths::Real newY = 0 ) ; 00208 00209 00210 00222 virtual const std::string toString( VerbosityLevels level = high ) 00223 const ; 00224 00225 00226 00227 protected: 00228 00229 00230 00243 virtual void updateFromFather( 00244 const Maths::Linear::Matrix & upToDateFatherReferential ) ; 00245 00246 00247 00254 inline Ceylan::Maths::Linear::HomogeneousMatrix3 & 00255 getLocalMatrix() const 00256 { 00257 00258 if ( _localReferential == 0 ) 00259 throw LocatableException( "Locatable2D::getLocalMatrix: " 00260 "no local matrix available." ) ; 00261 00262 Ceylan::Maths::Linear::HomogeneousMatrix3 * temp = 00263 dynamic_cast<Ceylan::Maths::Linear::HomogeneousMatrix3*>( 00264 _localReferential ) ; 00265 00266 if ( temp == 0 ) 00267 throw LocatableException( "Locatable2D::getLocalMatrix: " 00268 "was not an HomogeneousMatrix3 instance." ) ; 00269 00270 return * temp ; 00271 00272 } 00273 00274 00275 } ; 00276 00277 00278 } 00279 00280 00281 00282 #endif // CEYLAN_LOCATABLE_2D_H_ 00283