SUMO - Simulation of Urban MObility

GUIPointOfInterest.cpp

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