SUMO - Simulation of Urban MObility
|
00001 /****************************************************************************/ 00009 // The GUI-version of a point of interest 00010 /****************************************************************************/ 00011 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/ 00012 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors 00013 /****************************************************************************/ 00014 // 00015 // This file is part of SUMO. 00016 // SUMO is free software: you can redistribute it and/or modify 00017 // it under the terms of the GNU General Public License as published by 00018 // the Free Software Foundation, either version 3 of the License, or 00019 // (at your option) any later version. 00020 // 00021 /****************************************************************************/ 00022 00023 00024 // =========================================================================== 00025 // included modules 00026 // =========================================================================== 00027 #ifdef _MSC_VER 00028 #include <windows_config.h> 00029 #else 00030 #include <config.h> 00031 #endif 00032 00033 #ifdef WIN32 00034 #include <windows.h> 00035 #endif 00036 00037 #include <GL/gl.h> 00038 00039 #include "GUIPointOfInterest.h" 00040 #include <utils/gui/div/GUIParameterTableWindow.h> 00041 #include <utils/gui/globjects/GUIGLObjectPopupMenu.h> 00042 #include <utils/gui/div/GUIGlobalSelection.h> 00043 #include <utils/gui/windows/GUIMainWindow.h> 00044 #include <utils/gui/images/GUIIconSubSys.h> 00045 #include <utils/gui/windows/GUIAppEnum.h> 00046 #include <utils/gui/settings/GUIVisualizationSettings.h> 00047 #include <utils/gui/div/GLHelper.h> 00048 #include <foreign/polyfonts/polyfonts.h> 00049 00050 #ifdef CHECK_MEMORY_LEAKS 00051 #include <foreign/nvwa/debug_new.h> 00052 #endif // CHECK_MEMORY_LEAKS 00053 00054 00055 // =========================================================================== 00056 // method definitions 00057 // =========================================================================== 00058 GUIPointOfInterest::GUIPointOfInterest(int layer, 00059 const std::string& id, 00060 const std::string& type, 00061 const Position& p, 00062 const RGBColor& c) : 00063 PointOfInterest(id, type, p, c), 00064 GUIGlObject_AbstractAdd("poi", GLO_SHAPE, id), 00065 myLayer(layer) {} 00066 00067 00068 GUIPointOfInterest::~GUIPointOfInterest() {} 00069 00070 00071 GUIGLObjectPopupMenu* 00072 GUIPointOfInterest::getPopUpMenu(GUIMainWindow& app, 00073 GUISUMOAbstractView& parent) { 00074 00075 GUIGLObjectPopupMenu* ret = new GUIGLObjectPopupMenu(app, parent, *this); 00076 buildPopupHeader(ret, app, false); 00077 FXString t(myType.c_str()); 00078 new FXMenuCommand(ret, "(" + t + ")", 0, 0, 0); 00079 new FXMenuSeparator(ret); 00080 buildCenterPopupEntry(ret); 00081 buildNameCopyPopupEntry(ret); 00082 buildSelectionPopupEntry(ret); 00083 buildPositionCopyEntry(ret, false); 00084 return ret; 00085 } 00086 00087 00088 GUIParameterTableWindow* 00089 GUIPointOfInterest::getParameterWindow(GUIMainWindow&, 00090 GUISUMOAbstractView&) { 00091 return 0; 00092 } 00093 00094 00095 Boundary 00096 GUIPointOfInterest::getCenteringBoundary() const { 00097 Boundary b; 00098 b.add(x(), y()); 00099 b.grow(10); 00100 return b; 00101 } 00102 00103 00104 void 00105 GUIPointOfInterest::drawGL(const GUIVisualizationSettings& s) const { 00106 if (s.scale * (1.3 / 3.0) < s.minPOISize) { 00107 return; 00108 } 00109 glPushName(getGlID()); 00110 glPushMatrix(); 00111 glColor3d(red(), green(), blue()); 00112 glTranslated(x(), y(), getLayer()); 00113 GLHelper::drawFilledCircle((SUMOReal) 1.3 * s.poiExaggeration, 16); 00114 glPopMatrix(); 00115 drawName(Position(x() + 1.32 * s.poiExaggeration, y() + 1.32 * s.poiExaggeration), 00116 s.scale, s.poiName); 00117 glPopName(); 00118 } 00119 00120 00121 int 00122 GUIPointOfInterest::getLayer() const { 00123 return myLayer; 00124 } 00125 00126 00127 00128 /****************************************************************************/ 00129