00001 /****************************************************************************** 00002 STDR Simulator - Simple Two DImensional Robot Simulator 00003 Copyright (C) 2013 STDR Simulator 00004 This program is free software; you can redistribute it and/or modify 00005 it under the terms of the GNU General Public License as published by 00006 the Free Software Foundation; either version 3 of the License, or 00007 (at your option) any later version. 00008 This program is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 GNU General Public License for more details. 00012 You should have received a copy of the GNU General Public License 00013 along with this program; if not, write to the Free Software Foundation, 00014 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00015 00016 Authors : 00017 * Manos Tsardoulias, etsardou@gmail.com 00018 * Aris Thallas, aris.thallas@gmail.com 00019 * Chris Zalidis, zalidis@gmail.com 00020 ******************************************************************************/ 00021 00022 #include "stdr_gui/stdr_map_metainformation/stdr_gui_source.h" 00023 00024 namespace stdr_gui{ 00025 00032 CGuiSource::CGuiSource(QPoint p,std::string name, float resolution): 00033 position_(p), 00034 name_(name), 00035 resolution_(resolution) 00036 { 00037 00038 } 00039 00044 CGuiSource::~CGuiSource(void) 00045 { 00046 00047 } 00048 00053 std::string CGuiSource::getName(void) 00054 { 00055 return name_; 00056 } 00057 00063 bool CGuiSource::checkProximity(QPoint p) 00064 { 00065 float dx = p.x() * resolution_ - position_.x() * resolution_; 00066 float dy = p.y() * resolution_ - position_.y() * resolution_; 00067 float dist = sqrt( pow(dx,2) + pow(dy,2) ); 00068 return dist <= 0.3; 00069 } 00070 00071 } 00072